/
DNA.cpp
56 lines (42 loc) · 1.03 KB
/
DNA.cpp
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
#include "DNA.h"
#include <math.h>
DNA::DNA(){
}
void DNA::append(string& sDNA){
base b;
for(auto it = sDNA.begin(); it != sDNA.end(); ++it) {
b = char2DNA(*it);
sequence.push_back(b);
}
}
void DNA::addQuality(string& qal){
uint q;
uint i = 0;
for(auto it = qal.begin(); it != qal.end(); ++it) {
q = static_cast<uint>(*it);
if( i < sequence.size()){
sequence[i].quality = q;
}
i++;
}
}
base DNA::char2DNA(char& dnaChar){
base b;
b.code = dnaChar;
return b;
}
void DNA::printColoredDNA(WINDOW* win, std::pair<uint, uint> p, bool changeColor){
base b;
char a;
for(auto it = sequence.begin(); it != sequence.end(); ++it) {
b = (*it);
a = b.code;
if(changeColor and b.quality > 0 and (int)b.quality < COLOR_PAIRS){
wattron(win, COLOR_PAIR(b.quality));
waddch(win, a);
wattroff(win, COLOR_PAIR(b.quality));
}else{
waddch(win, a);
}
}
}