Commit 9601d8c8 authored by Cyprien Borée's avatar Cyprien Borée Committed by Mikaël Salson

add new parameter in FineSegmenter constructor

The FineSegmenter constructor handles the filtering of the germline. By default
the value is "NO_LIMIT_VALUE", which means the filtering isn't active.

For more informations about it #3268.
parent 2de67363
......@@ -950,7 +950,7 @@ string format_del(int deletions)
return deletions ? *"(" + string_of_int(deletions) + " del)" : "" ;
}
FineSegmenter::FineSegmenter(Sequence seq, Germline *germline, Cost segment_c, double threshold, double multiplier)
FineSegmenter::FineSegmenter(Sequence seq, Germline *germline, Cost segment_c, double threshold, double multiplier, int kmer_threshold)
{
box_V = new AlignBox("5");
box_D = new AlignBox("4");
......@@ -1049,9 +1049,14 @@ FineSegmenter::FineSegmenter(Sequence seq, Germline *germline, Cost segment_c,
/* Regular 53 Segmentation */
BioReader filtered = filterBioReaderWithACAutomaton(germline->automaton_5, germline->rep_5, sequence_or_rc);
align_against_collection(sequence_or_rc, filtered, NO_FORBIDDEN_ID, reverse_V, reverse_V, false,
if(kmer_threshold != NO_LIMIT_VALUE){
BioReader filtered = filterBioReaderWithACAutomaton(germline->automaton_5, germline->rep_5, sequence_or_rc);
align_against_collection(sequence_or_rc, filtered, NO_FORBIDDEN_ID, reverse_V, reverse_V, false,
box_V, segment_cost);
}else{
align_against_collection(sequence_or_rc, germline->rep_5, NO_FORBIDDEN_ID, reverse_V, reverse_V, false,
box_V, segment_cost);
}
align_against_collection(sequence_or_rc, germline->rep_3, NO_FORBIDDEN_ID, reverse_J, !reverse_J, false,
box_J, segment_cost);
// J was run with '!reverseJ', we copy the box informations from right to left
......
......@@ -354,14 +354,17 @@ class FineSegmenter : public Segmenter
vector<pair<int, int> > score_J;
vector <AlignBox*> boxes ;
/**
* Build a fineSegmenter based on KmerSegmentation
* @param seq: An object read from a FASTA/FASTQ file
* @param germline: germline used
* @param kmer_threshold: The number of the best k-mers for filtering.
* By default this parameter doesn't filter the germline.
*/
FineSegmenter(Sequence seq, Germline *germline, Cost segment_cost,
double threshold = THRESHOLD_NB_EXPECTED, double multiplier=1.0);
double threshold = THRESHOLD_NB_EXPECTED, double multiplier=1.0,
int kmer_threshold=NO_LIMIT_VALUE);
~FineSegmenter();
......
......@@ -1405,8 +1405,8 @@ int main (int argc, char **argv)
// FineSegmenter
size_t nb_fine_segmented = (size_t) max_clones; // When -1, it will become the max value.
nb_fine_segmented = MIN(nb_fine_segmented, sort_clones.size());
FineSegmenter seg(representative, segmented_germline, segment_cost, expected_value, nb_fine_segmented);
FineSegmenter seg(representative, segmented_germline, segment_cost, expected_value, nb_fine_segmented, kmer_threshold);
if (segmented_germline->seg_method == SEG_METHOD_543)
seg.FineSegmentD(segmented_germline, several_D, expected_value_D, nb_fine_segmented);
......@@ -1622,8 +1622,8 @@ int main (int argc, char **argv)
KmerMultiSegmenter kmseg(reads->getSequence(), multigermline, NULL); // out_unsegmented);
KmerSegmenter *seg = kmseg.the_kseg ;
Germline *germline = seg->segmented_germline ;
FineSegmenter s(seq, germline, segment_cost, expected_value, nb_reads_for_evalue);
FineSegmenter s(seq, germline, segment_cost, expected_value, nb_reads_for_evalue, kmer_threshold);
json json_clone;
json_clone["id"] = seq.label;
......
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