Commit 03abd35c authored by Mathieu Giraud's avatar Mathieu Giraud

core/windowExtractor.{h,cpp}: only_labeled_windows, keeps only windows from windows_label

Hey, could windows labels (-l) be used for another thing ?
parent 9c8e4913
......@@ -9,7 +9,7 @@ WindowExtractor::WindowExtractor(): out_segmented(NULL), out_unsegmented(NULL),
WindowsStorage *WindowExtractor::extract(OnlineFasta *reads, MultiGermline *multigermline,
size_t w,
map<string, string> &windows_labels,
map<string, string> &windows_labels, bool only_labeled_windows,
int stop_after, int only_nth_read, bool keep_unsegmented_as_clone,
double nb_expected, int nb_reads_for_evalue) {
init_stats();
......@@ -57,6 +57,10 @@ WindowsStorage *WindowExtractor::extract(OnlineFasta *reads, MultiGermline *mult
stats[seg->getSegmentationStatus()].insert(read_length);
if (seg->isSegmented()) {
// Filter
if (!only_labeled_windows || (windows_labels.find(junc) != windows_labels.end()))
// Store the window
windowsStorage->add(junc, reads->getSequence(), seg->getSegmentationStatus(), seg->segmented_germline);
......
......@@ -39,6 +39,7 @@ class WindowExtractor {
* @param multigermline: the multigermline
* @param w: length of the window
* @param windows_labels: Windows that must be kept and registered as such.
* @param only_labeled_windows: remember only windows from windows_labels
* @param nb_expected: maximal e-value of the segmentation
* @param nb_reads_for_evalue: number of reads, used for e-value computation. Can be approximate or faked.
* @return a pointer to a WindowsStorage that will contain all the windows.
......@@ -48,7 +49,7 @@ class WindowExtractor {
*/
WindowsStorage *extract(OnlineFasta *reads, MultiGermline *multigermline,
size_t w,
map<string, string> &windows_labels,
map<string, string> &windows_labels, bool only_labeled_windows=false,
int stop_after=-1, int only_nth_reads=1, bool keep_unsegmented_as_clone=false,
double nb_expected = THRESHOLD_NB_EXPECTED, int nb_reads_for_evalue = 1);
......
......@@ -331,6 +331,7 @@ int main (int argc, char **argv)
string forced_edges = "" ;
string windows_labels_file = "" ;
bool only_labeled_windows = false ;
char c ;
......@@ -954,7 +955,9 @@ int main (int argc, char **argv)
we.setAffectsOutput(out_affects);
}
WindowsStorage *windowsStorage = we.extract(reads, multigermline, w, windows_labels, max_reads_processed, only_nth_read, keep_unsegmented_as_clone,
WindowsStorage *windowsStorage = we.extract(reads, multigermline, w,
windows_labels, only_labeled_windows,
max_reads_processed, only_nth_read, keep_unsegmented_as_clone,
expected_value, nb_reads_for_evalue);
windowsStorage->setIdToAll();
size_t nb_total_reads = we.getNbReads();
......
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