-
Notifications
You must be signed in to change notification settings - Fork 7
/
Match.h
51 lines (42 loc) · 1.33 KB
/
Match.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
#ifndef MATCH_H
#define MATCH_H
#include "BasicDefinitions.h"
#include "SNPs.h"
#include "MarkerSet.h"
#include "Individual.h"
#include "WindowsList.h"
#include "math.h"
#include <iomanip>
class Individual;
class Match
{
public:
Match() {}
Individual * node[2];
unsigned int start_ms, end_ms;
//TODO: update to use WIndowSize instead of MARKER_SET_SIZE
long physicalStart(){ return ALL_SNPS.getSNP(start_ms*MARKER_SET_SIZE).getPhysPos(); }
long physicalEnd(){ return ALL_SNPS.getSNP((end_ms+1)*MARKER_SET_SIZE-1).getPhysPos(); }
string chromosome(){ return ALL_SNPS.getSNP(start_ms*MARKER_SET_SIZE).getChr(); }
double length()
{
return ALL_SNPS.getDistance(start_ms*MARKER_SET_SIZE,(end_ms+1)*MARKER_SET_SIZE-1);
}
bool assertLength()
{
unsigned int buff_start;
if ( start_ms > 0 ) buff_start = start_ms - 1; else buff_start = start_ms;
return ALL_SNPS.getDistance(buff_start*MARKER_SET_SIZE,(end_ms+2)*MARKER_SET_SIZE-1) >= MIN_MATCH_LEN;
}
Individual * getTarget(Individual * me){ if( node[0] == me ) return node[1]; else return node[0]; }
void print( ostream& );
bool approxEqual();
void erase();
void extendBack();
private:
int scanLeft( unsigned int ms );
int scanRight( unsigned int ms );
int diff( unsigned int ms );
bool isHom( int n , unsigned int ms );
};
#endif