Debian Codegraph @

src/IndelAllele.cpp

raw
1 #include "IndelAllele.h"
2
3 using namespace std;
4
5
6 bool FBIndelAllele::homopolymer(void) {
7 string::iterator s = sequence.begin();
8 char c = *s++;
9 while (s != sequence.end()) {
10 if (c != *s++) return false;
11 }
12 return true;
13 }
14
15 bool FBhomopolymer(string sequence) {
16 string::iterator s = sequence.begin();
17 char c = *s++;
18 while (s != sequence.end()) {
19 if (c != *s++) return false;
20 }
21 return true;
22 }
23
24 ostream& operator<<(ostream& out, const FBIndelAllele& indel) {
25 string t = indel.insertion ? "i" : "d";
26 out << t << ":" << indel.position << ":" << indel.readPosition
27 << ":" << indel.sequence << ":" << (indel.splice?"splice":"");
28 return out;
29 }
30
31 bool operator==(const FBIndelAllele& a, const FBIndelAllele& b) {
32 return (a.insertion == b.insertion
33 && a.length == b.length
34 && a.position == b.position
35 && a.sequence == b.sequence
36 && a.splice == b.splice);
37 }
38
39 bool operator!=(const FBIndelAllele& a, const FBIndelAllele& b) {
40 return !(a==b);
41 }
42
43 bool operator<(const FBIndelAllele& a, const FBIndelAllele& b) {
44 ostringstream as, bs;
45 as << a;
46 bs << b;
47 return as.str() < bs.str();
48 }