-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlignmentFragment.h
executable file
·74 lines (54 loc) · 1.63 KB
/
AlignmentFragment.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
#ifndef ALIGNMENTFRAGMENT
#define ALIGNMENTFRAGMENT
#include "Interval.h"
#include "error.h"
#include <string>
class AlignmentFragment
{
public:
AlignmentFragment(const std::string& alignedS1,
const std::string& alignedS2,
const Interval& match1,
const Interval& match2)
: alignedS1(alignedS1),
alignedS2(alignedS2),
match1(match1),
match2(match2)
{}
AlignmentFragment()
: AlignmentFragment("NA", "NA", Interval(), Interval())
{}
int GetAlignmentLength() const
{
return alignedS1.length();
}
Interval GetMatch1() const { return match1; }
Interval GetMatch2() const { return match2; }
std::string GetAlignedS1() const { return alignedS1; }
std::string GetAlignedS2() const { return alignedS2; }
int NumOfIdenticalBases() const;
void PrintAlignment() const;
double GetPercentageIdentity() const
{
if (GetAlignmentLength() == 0) error("Divided by zero.");
return 100.0f * NumOfIdenticalBases() / GetAlignmentLength();
}
void Flip(int origLength1, int origLength2);
// void ShiftMatch1(int val)
// {
// match1 += val;
// }
int GetMatch2Length() const
{
return match2.Length();
}
bool operator == (const AlignmentFragment& other) const;
private:
std::string alignedS1;
std::string alignedS2;
Interval match1;
Interval match2;
};
int NumOfIdenticalChars(const std::string &v, const std::string &w);
bool IsLastCharIdentical(const std::string &v, const std::string &w);
#endif // ALIGNMENTFRAGMENT