Commit 8ea42fff authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

core/segment.c: MAX1U, KmerSegment a read with the most frequent KmerAffect and the unknwown kmer.

The very special germline PSEUDO_GERMLINE_MAX1U is similar to the PSEUDO_GERMLINE_MAX12 germline.

It uses the usual KmerSegmenter, but launches computeSegmentation()
on the most frequent KmerAffect of the read and on the unknown kmer, detecting
translocations involving, for one part, the V(D)J region.
parent 4a83f281
......@@ -11,6 +11,7 @@
#include "../lib/json.hpp"
#define PSEUDO_GERMLINE_MAX12 "xxx"
#define PSEUDO_GERMLINE_MAX1U "yyy"
using namespace std;
using json = nlohmann::json;
......
......@@ -247,25 +247,48 @@ 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))
{ // Pseudo-germline, max12
if ((!strcmp(germline->code.c_str(), PSEUDO_GERMLINE_MAX12)
|| (!strcmp(germline->code.c_str(), PSEUDO_GERMLINE_MAX1U))))
{ // Pseudo-germline, MAX12 and MAX1U
pair <KmerAffect, KmerAffect> max12 ;
CountKmerAffectAnalyser ckaa(*(germline->index), sequence);
set<KmerAffect> forbidden;
forbidden.insert(KmerAffect::getAmbiguous());
forbidden.insert(KmerAffect::getUnknown());
CountKmerAffectAnalyser ckaa(*(germline->index), sequence);
pair <KmerAffect, KmerAffect> max12 = ckaa.sortLeftRight(ckaa.max12(forbidden));
if (!strcmp(germline->code.c_str(), PSEUDO_GERMLINE_MAX12))
// MAX12: two maximum k-mers (no unknown)
{
max12 = ckaa.max12(forbidden);
before = max12.first ;
after = max12.second ;
if (max12.first.isUnknown() || max12.second.isUnknown())
{
because = UNSEG_TOO_FEW_ZERO ;
return ;
}
}
if (max12.first.isUnknown() || max12.second.isUnknown())
else
// MAX1U: the maximum k-mers (no unknown) + unknown
{
because = UNSEG_TOO_FEW_ZERO ;
return ;
CountKmerAffectAnalyser ckaa(*(germline->index), sequence);
KmerAffect max = ckaa.max(forbidden);
if (max.isUnknown())
{
because = UNSEG_TOO_FEW_ZERO ;
return ;
}
max12 = make_pair(max, KmerAffect::getUnknown());
}
pair <KmerAffect, KmerAffect> before_after = ckaa.sortLeftRight(max12);
before = before_after.first ;
after = before_after.second ;
// This strand computation is only a heuristic, especially for chimera +/- reads
// Anyway, it allows to gather such reads and their reverse complement into a unique window...
// ... except when the read is quite different outside the window
......
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