-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuality.cpp
More file actions
33 lines (26 loc) · 816 Bytes
/
Quality.cpp
File metadata and controls
33 lines (26 loc) · 816 Bytes
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
/*
* Quality.cpp
*
* Created on: Mar 3, 2010
* Author: marcus
*/
#include "Quality.h"
Quality::Quality(string q_str, int offs) {
quality_str = q_str;
offset = offs;
calculate_error_probabilites();
}
Quality::~Quality() {
}
void Quality::calculate_error_probabilites(){
for(unsigned int i=0; i<quality_str.length(); i++){
// cout << "conv to int " << (int)quality_str.at(i) << " " << quality_str.at(i) << endl;
int qualint = (int)quality_str.at(i);
// cout << "qualint " << qualint << " minus offset " << qualint - offset << endl;
error_probabilities.push_back(phred_probability(qualint - offset));
}
}
double Quality::phred_probability(int phredscore){
// cout << "phredscore " << phredscore << " " << phredscore/(long double)-10 << endl;
return pow(10, phredscore/(long double)-10);
}