diff --git a/algo/core/windowExtractor.cpp b/algo/core/windowExtractor.cpp index 390b71191c99213d75f87645aaede08ae1167a46..af9962d35a4d12fcf3fbc2bab17aa647b8fa2121 100644 --- a/algo/core/windowExtractor.cpp +++ b/algo/core/windowExtractor.cpp @@ -5,9 +5,10 @@ #define PROGRESS_POINT 25000 #define PROGRESS_LINE 40 -WindowExtractor::WindowExtractor(): out_segmented(NULL), out_unsegmented(NULL), out_affects(NULL), max_reads_per_window(~0){} +WindowExtractor::WindowExtractor(MultiGermline *multigermline): out_segmented(NULL), out_unsegmented(NULL), out_affects(NULL), max_reads_per_window(~0), multigermline(multigermline){ +} -WindowsStorage *WindowExtractor::extract(OnlineFasta *reads, MultiGermline *multigermline, +WindowsStorage *WindowExtractor::extract(OnlineFasta *reads, size_t w, map &windows_labels, bool only_labeled_windows, int stop_after, int only_nth_read, bool keep_unsegmented_as_clone, diff --git a/algo/core/windowExtractor.h b/algo/core/windowExtractor.h index ac9d52ee2ccdbb3066fa14cf71156531db58c340..29a45f953ed808d6799b8cc48a63c6cfb1b0c9f7 100644 --- a/algo/core/windowExtractor.h +++ b/algo/core/windowExtractor.h @@ -27,16 +27,17 @@ class WindowExtractor { Stats stats[STATS_SIZE]; size_t max_reads_per_window; + + MultiGermline *multigermline; public: - WindowExtractor(); + WindowExtractor(MultiGermline *multigermline); /** * Extract windows from the collection of input reads. * If (un)segmented sequences must be output, the functions * set(Un)SegmentedOutput() must be called before. * @param reads: the collection of input reads - * @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 @@ -47,7 +48,7 @@ class WindowExtractor { * @post Statistics on segmentation will be provided through the getSegmentationStats() methods * and getAverageSegmentationLength(). */ - WindowsStorage *extract(OnlineFasta *reads, MultiGermline *multigermline, + WindowsStorage *extract(OnlineFasta *reads, size_t w, map &windows_labels, bool only_labeled_windows=false, int stop_after=-1, int only_nth_reads=1, bool keep_unsegmented_as_clone=false, diff --git a/algo/tests/testSegment.cpp b/algo/tests/testSegment.cpp index 1a98a1d7c1b39073487e6ee818e4ad8e1a3439a9..1b2736083fe0b292baa18ae84c778cb41c929e6d 100644 --- a/algo/tests/testSegment.cpp +++ b/algo/tests/testSegment.cpp @@ -220,14 +220,14 @@ void testExtractor() { multi = new MultiGermline(); multi->insert(germline); - WindowExtractor we; + WindowExtractor we(multi); map labels; ofstream out_seg("segmented.log"); ofstream out_unseg("unsegmented.log"); we.setSegmentedOutput(&out_seg); we.setUnsegmentedOutput(&out_unseg); - WindowsStorage *ws = we.extract(&data, multi, 30, labels); + WindowsStorage *ws = we.extract(&data, 30, labels); // we.out_stats(cout); TAP_TEST(we.getNbReads() == 13, TEST_EXTRACTOR_NB_READS, ""); diff --git a/algo/vidjil.cpp b/algo/vidjil.cpp index e9c71ef913f10689025431eb21c36bbcd50f2453..e650284998b6de345c3eb9de525d50e47ddc0b15 100644 --- a/algo/vidjil.cpp +++ b/algo/vidjil.cpp @@ -951,7 +951,7 @@ int main (int argc, char **argv) ofstream *out_unsegmented = NULL; ofstream *out_affects = NULL; - WindowExtractor we; + WindowExtractor we(multigermline); if (! output_sequences_by_cluster) we.setMaximalNbReadsPerWindow(max_auditionned); @@ -976,7 +976,7 @@ int main (int argc, char **argv) we.setAffectsOutput(out_affects); } - WindowsStorage *windowsStorage = we.extract(reads, multigermline, w, + WindowsStorage *windowsStorage = we.extract(reads, w, windows_labels, only_labeled_windows, max_reads_processed, only_nth_read, keep_unsegmented_as_clone, expected_value, nb_reads_for_evalue);