Commit 7348a553 authored by Mathieu Giraud's avatar Mathieu Giraud

core/kmerstore.h, core/affectanalyser.{h,cpp}: gives the actual kmer to .getIndexLoad()

The e-value computation could be more precise by taking into account the actual kmer.
parent 873cd348
......@@ -157,9 +157,11 @@ affect_infos KmerAffectAnalyser::getMaximum(const KmerAffect &before,
results.nb_before_right++;
}
left_evalue = kms.getProbabilityAtLeastOrAbove(results.nb_before_left,
left_evalue = kms.getProbabilityAtLeastOrAbove(before,
results.nb_before_left,
1 + results.first_pos_max);
right_evalue = kms.getProbabilityAtLeastOrAbove(results.nb_after_right,
right_evalue = kms.getProbabilityAtLeastOrAbove(after,
results.nb_after_right,
seq.size() - 1 - results.last_pos_max);
/* Main test:
......@@ -179,8 +181,8 @@ affect_infos KmerAffectAnalyser::getMaximum(const KmerAffect &before,
}
double KmerAffectAnalyser::getProbabilityAtLeastOrAbove(int at_least) const {
return kms.getProbabilityAtLeastOrAbove(at_least, seq.size());
double KmerAffectAnalyser::getProbabilityAtLeastOrAbove(const KmerAffect &kmer, int at_least) const {
return kms.getProbabilityAtLeastOrAbove(kmer, at_least, seq.size());
}
pair <double, double> KmerAffectAnalyser::getLeftRightProbabilityAtLeastOrAbove() const {
......
......@@ -177,7 +177,7 @@ class KmerAffectAnalyser: public AffectAnalyser {
/**
* @return probability that the number of kmers is 'at_least' or more
*/
double getProbabilityAtLeastOrAbove(int at_least) const;
double getProbabilityAtLeastOrAbove(const KmerAffect &kmer, int at_least) const;
/**
* @return probabilities that the number of left/right kmers is 'at_least' or more
......
......@@ -92,6 +92,7 @@ public:
/**
* @return the percentage of kmers that are set in the index
*/
float getIndexLoad(T kmer) const;
float getIndexLoad() const;
/**
......@@ -103,7 +104,7 @@ public:
/**
* @return probability that the number of kmers is 'at_least' or more in a sequence of length 'length'
*/
double getProbabilityAtLeastOrAbove(int at_least, int length) const;
double getProbabilityAtLeastOrAbove(T kmer, int at_least, int length) const;
/**
* @return the value of k
......@@ -279,6 +280,10 @@ void IKmerStore<T>::insert(const seqtype &sequence,
}
}
template<class T>
float IKmerStore<T>::getIndexLoad(const T kmer) const {
return getIndexLoad();
}
template<class T>
float IKmerStore<T>::getIndexLoad() const {
return nb_kmers_inserted / pow(4.0, k);
......@@ -293,11 +298,11 @@ int IKmerStore<T>::atMostMaxSizeIndexing(int n) const {
}
template<class T>
double IKmerStore<T>::getProbabilityAtLeastOrAbove(int at_least, int length) const {
double IKmerStore<T>::getProbabilityAtLeastOrAbove(const T kmer, int at_least, int length) const {
// n: number of kmers in the sequence
int n = length - getS() + 1;
float index_load = getIndexLoad() ;
float index_load = getIndexLoad(kmer) ;
double proba = 0;
double probability_having_system = pow(index_load, at_least);
......
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