Commit 09287fd8 authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

core/affectanalyser.{h, cpp}: getLeftRightProbability, p-value at both sides...

core/affectanalyser.{h, cpp}: getLeftRightProbability, p-value at both sides of the segmentation point
parent 25c6bda0
......@@ -96,12 +96,11 @@ IKmerStore<KmerAffect> &KmerAffectAnalyser::getIndex() const{
affect_infos KmerAffectAnalyser::getMaximum(const KmerAffect &before,
const KmerAffect &after,
float ratioMin,
int maxOverlap) const {
int maxOverlap) {
/* currentValue is the { affectations[t] == before | t \in 1..i } - | { affectations[i] == after | t \in 1..i } */
int currentValue;
int span = kms.getS();
int length = count();
affect_infos results;
if (maxOverlap > span)
maxOverlap = span;
......@@ -178,6 +177,13 @@ double KmerAffectAnalyser::getProbabilityAtLeastOrAbove(int at_least) const {
return kms.getProbabilityAtLeastOrAbove(at_least, seq.size());
}
pair <double, double> KmerAffectAnalyser::getLeftRightProbabilityAtLeastOrAbove() const {
int pos = (results.first_pos_max + results.last_pos_max) / 2 ;
return make_pair(kms.getProbabilityAtLeastOrAbove(results.nb_before_left, pos),
kms.getProbabilityAtLeastOrAbove(results.nb_after_right, seq.size()-pos));
}
const string &KmerAffectAnalyser::getSequence() const{
return seq;
}
......
......@@ -119,6 +119,8 @@ class KmerAffectAnalyser: public AffectAnalyser {
IKmerStore<KmerAffect> &kms;
const string &seq;
vector<KmerAffect> affectations;
affect_infos results ;
public:
/**
* @param kms: the index storing the affectation for the k-mers
......@@ -169,7 +171,7 @@ class KmerAffectAnalyser: public AffectAnalyser {
*/
affect_infos getMaximum(const KmerAffect &before, const KmerAffect &after,
float ratioMin=2.,
int maxOverlap=1) const;
int maxOverlap=1);
/**
......@@ -177,6 +179,11 @@ class KmerAffectAnalyser: public AffectAnalyser {
*/
double getProbabilityAtLeastOrAbove(int at_least) const;
/**
* @return probabilities that the number of left/right kmers is 'at_least' or more
*/
pair <double, double> getLeftRightProbabilityAtLeastOrAbove() const;
const string &getSequence() const;
int first(const KmerAffect &affect) const;
......
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