Commit 0b8a6e8e authored by Mikaël Salson's avatar Mikaël Salson
Browse files

Segment: Bad bounds for computing probability.

+1 missing for taking into account the number of potential kmers.
<= n for taking into account the (rare) case where all the affectations
would be set.
parent c5c3405e
......@@ -363,13 +363,13 @@ KmerMultiSegmenter::KmerMultiSegmenter(Sequence seq, MultiGermline *multigermlin
double KmerSegmenter::getProbabilityAtLeastOrAbove(int at_least) const {
// n: number of kmers in the sequence
int n = getSequence().sequence.size() - getKmerAffectAnalyser()->getIndex().getS();
int n = getSequence().sequence.size() - getKmerAffectAnalyser()->getIndex().getS() + 1;
float index_load = getKmerAffectAnalyser()->getIndex().getIndexLoad() ;
double proba = 0;
double probability_having_system = pow(index_load, at_least);
double probability_not_having_system = pow(1 - index_load, n - at_least);
for (int i=at_least; i<n; i++) {
for (int i=at_least; i<=n; i++) {
proba += nChoosek(n, i) * probability_having_system * probability_not_having_system;
probability_having_system *= index_load;
probability_not_having_system /= index_load;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment