Commit 4a87b4eb authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

core/segment.{cpp,h}: remembers the evalue when it is computed, and output in .json

parent 7113617c
...@@ -194,6 +194,7 @@ KmerSegmenter::KmerSegmenter(Sequence seq, Germline *germline) ...@@ -194,6 +194,7 @@ KmerSegmenter::KmerSegmenter(Sequence seq, Germline *germline)
Dend=0; Dend=0;
because = 0 ; // Cause of unsegmentation because = 0 ; // Cause of unsegmentation
score = 0 ; score = 0 ;
evalue = NO_LIMIT_VALUE;
int s = (size_t)germline->index->getS() ; int s = (size_t)germline->index->getS() ;
int length = sequence.length() ; int length = sequence.length() ;
...@@ -348,9 +349,15 @@ KmerMultiSegmenter::KmerMultiSegmenter(Sequence seq, MultiGermline *multigermlin ...@@ -348,9 +349,15 @@ KmerMultiSegmenter::KmerMultiSegmenter(Sequence seq, MultiGermline *multigermlin
} }
} // end for (Germlines) } // end for (Germlines)
// E-value threshold
if (threshold_nb_expected > NO_LIMIT_VALUE) if (threshold_nb_expected > NO_LIMIT_VALUE)
if (the_kseg->isSegmented() && getNbExpected() > threshold_nb_expected) if (the_kseg->isSegmented()) {
the_kseg->setSegmentationStatus(UNSEG_NOISY); // the_kseg->evalue also depends on the number of germlines from the *Multi*KmerSegmenter
the_kseg->evalue = getNbExpected();
if (the_kseg->evalue > threshold_nb_expected) {
the_kseg->setSegmentationStatus(UNSEG_NOISY);
}
}
} }
double KmerSegmenter::getProbabilityAtLeastOrAbove(int at_least) const { double KmerSegmenter::getProbabilityAtLeastOrAbove(int at_least) const {
...@@ -936,6 +943,9 @@ void KmerSegmenter::toJsonList(JsonList *seg) ...@@ -936,6 +943,9 @@ void KmerSegmenter::toJsonList(JsonList *seg)
{ {
int sequenceSize = sequence.size(); int sequenceSize = sequence.size();
if (evalue > NO_LIMIT_VALUE)
seg->add("evalue", evalue);
JsonList *json_affectValues; JsonList *json_affectValues;
json_affectValues=new JsonList(); json_affectValues=new JsonList();
json_affectValues->add("start", 0); json_affectValues->add("start", 0);
......
...@@ -76,6 +76,7 @@ protected: ...@@ -76,6 +76,7 @@ protected:
string seg_V, seg_N, seg_J, system; string seg_V, seg_N, seg_J, system;
int best_D; int best_D;
int evalue;
string seg_N1, seg_D, seg_N2; string seg_N1, seg_D, seg_N2;
Cost segment_cost; Cost segment_cost;
......
...@@ -1233,8 +1233,8 @@ int main (int argc, char **argv) ...@@ -1233,8 +1233,8 @@ int main (int argc, char **argv)
seg.toJsonList(&json_seg); seg.toJsonList(&json_seg);
// Re-launch also a KmerMultiSegmenter, for debug purposes // Re-launch also a KmerMultiSegmenter, for control purposes (affectations, evalue)
KmerMultiSegmenter kmseg(seg.getSequence(), multigermline, 0); KmerMultiSegmenter kmseg(seg.getSequence(), multigermline, 0, expected_value);
KmerSegmenter *kseg = kmseg.the_kseg ; KmerSegmenter *kseg = kmseg.the_kseg ;
kseg->toJsonList(&json_seg); kseg->toJsonList(&json_seg);
......
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