Commit 6577fd78 authored by Mathieu Giraud's avatar Mathieu Giraud

core/segment.cpp: put getMaximum test before e-value check

This will report again UNSEG_AMBIGUOUS cases when the heuristic
does not find a nice segmentation point.
parent 73178e81
......@@ -386,6 +386,23 @@ void KmerSegmenter::computeSegmentation(int strand, KmerAffect before, KmerAffec
affect_infos max;
max = kaa->getMaximum(before, after);
// We did not find a good segmentation point
if (!max.max_found) {
// We labeled it detected if there were both enough affect_5 and enough affect_3
bool detected = (max.nb_before_left + max.nb_before_right >= DETECT_THRESHOLD)
&& (max.nb_after_left + max.nb_after_right >= DETECT_THRESHOLD);
if ((strand == 1 && max.nb_before_left == 0) || (strand == -1 && max.nb_after_right == 0))
because = detected ? UNSEG_AMBIGUOUS : UNSEG_TOO_FEW_V ;
else if ((strand == 1 && max.nb_after_right == 0)|| (strand == -1 && max.nb_before_left == 0))
because = detected ? UNSEG_AMBIGUOUS : UNSEG_TOO_FEW_J ;
else
because = UNSEG_AMBIGUOUS;
return ;
}
pair <double, double> pvalues = kaa->getLeftRightProbabilityAtLeastOrAbove();
evalue_left = pvalues.first * multiplier ;
evalue_right = pvalues.second * multiplier ;
......@@ -407,26 +424,6 @@ void KmerSegmenter::computeSegmentation(int strand, KmerAffect before, KmerAffec
return ;
}
//
// We labeled it detected if there were both enough affect_5 and enough affect_3
bool detected = (max.nb_before_left + max.nb_before_right >= DETECT_THRESHOLD)
&& (max.nb_after_left + max.nb_after_right >= DETECT_THRESHOLD);
if (! max.max_found) {
if ((strand == 1 && max.nb_before_left == 0)
|| (strand == -1 && max.nb_after_right == 0))
because = detected ? UNSEG_AMBIGUOUS : UNSEG_TOO_FEW_V ;
else if ((strand == 1 && max.nb_after_right == 0)
|| (strand == -1 && max.nb_before_left == 0))
{
because = detected ? UNSEG_AMBIGUOUS : UNSEG_TOO_FEW_J ;
} else
because = UNSEG_AMBIGUOUS;
return ;
}
// There was a good segmentation point
Vend = max.first_pos_max;
......
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