-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgenogroup.h
61 lines (46 loc) · 1.36 KB
/
genogroup.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
//////////////////////////////////////////////////////////////////
// //
// PLINK (c) 2005-2006 Shaun Purcell //
// //
// This file is distributed under the GNU General Public //
// License, Version 2. Please see the file COPYING for more //
// details //
// //
//////////////////////////////////////////////////////////////////
#ifndef __GENOGROUP_H_
#define __GENOGROUP_H__
class MultiLocusGenotype {
public:
vector<bool> g;
int count;
int reference;
vector<bool> skip;
bool operator<(const MultiLocusGenotype & b) const {
for (int i=0; i<g.size(); i++)
if (g[i] != b.g[i])
return g[i];
return false;
}
bool operator==(const MultiLocusGenotype & b) const {
for (int i=0; i<g.size(); i++)
if (g[i] != b.g[i])
return false;
return true;
}
};
namespace std {
template<> class less<MultiLocusGenotype*> {
public:
bool operator()(MultiLocusGenotype const* p1,
MultiLocusGenotype const* p2) {
if (!p1)
return true;
if (!p2)
return false;
if (p1->g < p2->g)
return true;
return false;
}
};
};
#endif