File: QualityTransform.cpp

package info (click to toggle)
pbseqlib 5.3.4%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 7,020 kB
  • sloc: cpp: 77,246; python: 331; sh: 103; makefile: 42
file content (26 lines) | stat: -rw-r--r-- 618 bytes parent folder | download | duplicates (3)
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
#include <pbdata/qvs/QualityTransform.hpp>

#include <cassert>
/*
* 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);
    }
}