Commit 6236ba11 authored by Mathieu Giraud's avatar Mathieu Giraud

core/segment.cpp, vidjil.cpp: set and use .seg_method() field

Selecting the segmentation method is now cleaner, and does
not require any string comparison. This allows to have (pseudo-)germlines with
the same locus but with different segmentation methods, as here
"xxx" for both MAX12 and MAX1U.
parent 727090df
......@@ -247,8 +247,8 @@ KmerSegmenter::KmerSegmenter(Sequence seq, Germline *germline, double threshold,
score = nb_strand[0] + nb_strand[1] ; // Used only for non-segmented germlines
if ((!strcmp(germline->code.c_str(), PSEUDO_GERMLINE_MAX12)
|| (!strcmp(germline->code.c_str(), PSEUDO_GERMLINE_MAX1U))))
if ((germline->seg_method == SEG_METHOD_MAX12)
|| (germline->seg_method == SEG_METHOD_MAX1U))
{ // Pseudo-germline, MAX12 and MAX1U
pair <KmerAffect, KmerAffect> max12 ;
CountKmerAffectAnalyser ckaa(*(germline->index), sequence);
......@@ -258,7 +258,7 @@ KmerSegmenter::KmerSegmenter(Sequence seq, Germline *germline, double threshold,
forbidden.insert(KmerAffect::getAmbiguous());
forbidden.insert(KmerAffect::getUnknown());
if (!strcmp(germline->code.c_str(), PSEUDO_GERMLINE_MAX12))
if (germline->seg_method == SEG_METHOD_MAX12)
// MAX12: two maximum k-mers (no unknown)
{
max12 = ckaa.max12(forbidden);
......@@ -644,8 +644,8 @@ FineSegmenter::FineSegmenter(Sequence seq, Germline *germline, Cost segment_c)
{
// We check whether this sequence is segmented with MAX12 or MAX1U (with default e-value parameters)
KmerSegmenter *kseg = new KmerSegmenter(seq, germline, THRESHOLD_NB_EXPECTED, 1);
if (kseg->isSegmented() && ((!strcmp(germline->code.c_str(), PSEUDO_GERMLINE_MAX12))
|| !strcmp(germline->code.c_str(), PSEUDO_GERMLINE_MAX1U)))
if (kseg->isSegmented() && ((germline->seg_method == SEG_METHOD_MAX12)
|| (germline->seg_method == SEG_METHOD_MAX1U)))
{
reversed = kseg->isReverse();
......
......@@ -808,13 +808,15 @@ int main (int argc, char **argv)
}
if (multi_germline_unexpected_recombinations_12) {
Germline *pseudo = new Germline(PSEUDO_GERMLINE_MAX12, 'x', -10, trim_sequences);
Germline *pseudo = new Germline("xxx", 'x', -10, trim_sequences);
pseudo->seg_method = SEG_METHOD_MAX12 ;
pseudo->index = multigermline->index ;
multigermline->germlines.push_back(pseudo);
}
if (multi_germline_unexpected_recombinations_1U) {
Germline *pseudo_u = new Germline(PSEUDO_GERMLINE_MAX1U, 'y', -10, trim_sequences);
Germline *pseudo_u = new Germline("xxx", 'y', -10, trim_sequences);
pseudo_u->seg_method = SEG_METHOD_MAX1U ;
// TODO: there should be more up/downstream regions for the 'yyy' germline. And/or smaller seeds ?
pseudo_u->index = multigermline->index ;
multigermline->germlines.push_back(pseudo_u);
......
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