-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathReadVariants.C
56 lines (41 loc) · 1.21 KB
/
ReadVariants.C
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
/****************************************************************
ReadVariants.C
Copyright (C)2021 William H. Majoros ([email protected])
This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
License (GPL) version 3, as described at www.opensource.org.
****************************************************************/
#include <iostream>
#include "ReadVariants.H"
using namespace std;
using namespace BOOM;
ReadVariants::ReadVariants()
: firstOfPair(false), mate(NULL), wantToSkip(false)
{
// ctor
}
ReadVariants::ReadVariants(const String &id)
: id(id), firstOfPair(false), mate(NULL), wantToSkip(false)
{
// ctor
}
void ReadVariants::setFirstOfPair(bool f)
{
firstOfPair=f;
}
Vector<VariantInRead> &ReadVariants::getVariants()
{
return variants;
}
bool ReadVariants::consistentWithPhase()
{
const int L=variants.size();
for(int i=0 ; i<L-1 ; ++i) {
const VariantInRead &thisVar=variants[i], nextVar=variants[i+1];
const Allele a1=thisVar.allele, a2=nextVar.allele;
const VariantPhase readPhase=a1==a2 ? IN_PHASE : ANTI_PHASED;
const VariantPhase phase=thisVar.v->getPhase();
//if(phase==UNPHASED) ...?
if(readPhase!=phase) return false;
}
return true;
}