File: QualityTransform.cpp

package info (click to toggle)
pbseqlib 0~20161219-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,924 kB
  • ctags: 5,123
  • sloc: cpp: 82,727; makefile: 305; python: 239; sh: 8
file content (23 lines) | stat: -rw-r--r-- 600 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <cassert>
#include "QualityTransform.hpp"
/*
* Base lookup table class for quality values.
*/

float QualityToProb::operator()(int index) {
    assert(index >= 0);
    assert(index <= MAX_QUALITY_VALUE);
    return prob[index];
}

/* 
* Create a lookup table for transforming from quality value
* to p-value using Patrick Marks' low-end expand qv = -100*log10(p/(1-p))
*/
void LowEndExpandQualityTransform::operator()(QualityToProb &qt) {
    int i;
    for (i = MIN_QUALITY_VALUE; i <= MAX_QUALITY_VALUE; i++) {
        float v = pow(10,i/-100.0);
        qt.prob[i] = 1 - v/(1+v);
    }
}