-
Notifications
You must be signed in to change notification settings - Fork 7
/
MarkerSet.cpp
90 lines (71 loc) · 1.82 KB
/
MarkerSet.cpp
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
83
84
85
86
87
88
89
90
// MarkerSet.cpp: a marker set
#include "MarkerSet.h"
#include <iostream>
using namespace std;
//
// MarkerSet(): default constructor
MarkerSet::MarkerSet()
{
markers.resize(MARKER_SET_SIZE);
}
// constructor for new implementation for Variable Window Sizes
MarkerSet::MarkerSet(bool flag)
{
}
MarkerSet::MarkerSet(const MarkerSet& copy)
{
markers = copy.markers; // copy.getMarkerBits();
}
void MarkerSet::clear()
{
markers.reset();
}
boost::dynamic_bitset<>& MarkerSet::getMarkerBits()
{
return markers;
}
// getMarker(): gets marker
bool MarkerSet::getMarker(int index) const
{
return markers.test( index );
}
// have a push back instead of set....
void MarkerSet::pushback(bool bit)
{
markers.push_back(bit);
}
void MarkerSet::set(int index , bool bit )
{
markers.set( index , bit );
}
//TODO: update to use WIndowSize instead of MARKER_SET_SIZE
void MarkerSet::print(ostream& out, unsigned int start, unsigned int end)
{
for(int i=start;i<end && (position_ms*MARKER_SET_SIZE)+i < ALL_SNPS.currentSize();i++)
{
out << ALL_SNPS.getSNP(position_ms*MARKER_SET_SIZE + i).getVariant( markers[i] );
}
}
//TODO: update to use WIndowSize instead of MARKER_SET_SIZE
void MarkerSet::print(ostream& out)
{
print( out , 0 , MARKER_SET_SIZE);
}
// equal(): compares another MarkerSet to see if it has the
bool MarkerSet::equal(MarkerSet * ms)
{
return markers == ms->markers;
}
int MarkerSet::diff(MarkerSet * ms) const
{
return (int) ( markers ^ ms->markers ).count();
}
//TODO: update to use WIndowSize instead of MARKER_SET_SIZE
// operator<<:overloaded insertion operator
ostream& operator<<(ostream& fout, const MarkerSet& m1)
{
for (int i = 0; i < MARKER_SET_SIZE; i++)
fout << m1.getMarker(i);
return fout;
}
// end MarkerSet.cpp