-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAlleleRecords.h
82 lines (68 loc) · 1.83 KB
/
AlleleRecords.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* AlleleRecords
* Date: Mar-28-2013
* Author : Gabriel Renaud gabriel.reno [at sign here] gmail.com
*
*/
#ifndef AlleleRecords_h
#define AlleleRecords_h
#include <string>
#include <vector>
#include "SingleAllele.h"
#include "SingleGL.h"
using namespace std;
class AlleleRecords{
private:
bool glFormat;
public:
AlleleRecords(bool glFormat_=false);
AlleleRecords(uint32_t sizePops_,bool glFormat_);
AlleleRecords(const AlleleRecords & other);
~AlleleRecords();
AlleleRecords & operator= (const AlleleRecords & other){
chr = other.chr;
chri = other.chri;
coordinate = other.coordinate;
ref = other.ref;
alt = other.alt;
glFormat = other.glFormat;
if(other.glFormat){
vectorAlleles = 0;
vectorGLs = new vector<SingleGL> ( *(other.vectorGLs) );
}else{
vectorAlleles = new vector<SingleAllele> ( *(other.vectorAlleles) );
vectorGLs = 0;
}
return *this;
}
void copyCoreFields(const AlleleRecords & other);
string chr;
uint16_t chri;
uint32_t coordinate;
uint32_t sizePops;
char ref;
char alt;
vector<SingleAllele> * vectorAlleles;
vector<SingleGL> * vectorGLs;
//bool buildFromData(char * buffer,
bool everyRecordNonNull() const;
bool everyNonChimpAncRecordNonNull() const;
bool isGlFormat() const;
void writeBinary(char * buffer) const;
uint32_t getSizePops() const;
friend ostream& operator<<(ostream& os, const AlleleRecords & ar){
os<<ar.chr<<"\t";
os<<stringify(ar.coordinate)<<"\t";
os<<ar.ref<<",";
os<<ar.alt<<"\t";
//exit(1);
if(ar.glFormat)
os<<vectorToString(*(ar.vectorGLs),"\t");
else
os<<vectorToString(*(ar.vectorAlleles),"\t");
// exit(1);
return os;
}
friend bool operator== (const AlleleRecords & first,const AlleleRecords & second);
};
#endif