-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDoubleFragsAlnResult.h
executable file
·115 lines (91 loc) · 2.5 KB
/
DoubleFragsAlnResult.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef DOUBLEFRAGSALNRESULT
#define DOUBLEFRAGSALNRESULT
#include "alignmentresult.h"
#include "AlignmentFragment.h"
class DoubleFragsAlnResult : public IAlignmentResult
{
public:
DoubleFragsAlnResult(const std::string& v,
const std::string& w,
int score,
const AlignmentFragment& alnFrag1,
const AlignmentFragment& alnFrag2)
: IAlignmentResult(v, w, score),
alnFrag1(alnFrag1),
alnFrag2(alnFrag2)
{}
int GetAlnFrag1EndV() const
{
return alnFrag1.GetMatch1().GetEnd();
}
int GetAlnFrag2StartV() const
{
return alnFrag2.GetMatch1().GetStart();
}
int GetAlnFrag1EndW() const
{
return alnFrag1.GetMatch2().GetEnd();
}
int GetAlnFrag2StartW() const
{
return alnFrag2.GetMatch2().GetStart();
}
int GetAlnFrag1LengthV() const
{
return alnFrag1.GetMatch1().Length();
}
int GetAlnFrag1LengthW() const
{
return alnFrag1.GetMatch2().Length();
}
int GetAlnFrag2LengthV() const
{
return alnFrag2.GetMatch1().Length();
}
int GetAlnFrag2LengthW() const
{
return alnFrag2.GetMatch2().Length();
}
// std::string GetAlnFrag1AlignedW() const
// {
// return alnFrag1.GetAlignedS2();
// }
double GetAlnFrag1PercentIdentity() const
{
return alnFrag1.GetPercentageIdentity();
}
double GetAlnFrag2PercentIdentity() const
{
return alnFrag2.GetPercentageIdentity();
}
AlignmentFragment GetAlnFrag1() const { return alnFrag1; }
AlignmentFragment GetAlnFrag2() const { return alnFrag2; }
int NumOfWBasesBetweenTwoFrags() const
{
return GetAlnFrag2StartW() - GetAlnFrag1EndW() - 1;
}
int NumOfVBasesBetweenTwoFrags() const
{
return GetAlnFrag2StartV() - GetAlnFrag1EndV() - 1;
}
std::string WBasesBetweenTwoFrags() const
{
return WBasesBetweenTwoFragsExtLeft(0);
}
std::string WBasesBetweenTwoFragsExtLeft(int shift) const
{
assert(shift >= 0);
int n_bases = NumOfWBasesBetweenTwoFrags();
if (n_bases == 0) return "";
return w.substr(GetAlnFrag1EndW() + 1 - shift, n_bases + shift);
}
private:
AlignmentFragment alnFrag1;
AlignmentFragment alnFrag2;
// IAlignmentResult interface
public:
void PrintAlignment();
double GetPercentIdentity();
void Flip();
};
#endif // DOUBLEFRAGSALNRESULT