Commit 539f5527 authored by Mikaël Salson's avatar Mikaël Salson

WindowExtractor: Multigermline is given to the constructor.

The object is (and will be in the upcoming commits) more dependent on multigermline.
Therefore that makes sense to give it to the constructor so that the multigermline can be accessed by any method.
parent dcdeca66
......@@ -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<string, string> &windows_labels, bool only_labeled_windows,
int stop_after, int only_nth_read, bool keep_unsegmented_as_clone,
......
......@@ -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<string, string> &windows_labels, bool only_labeled_windows=false,
int stop_after=-1, int only_nth_reads=1, bool keep_unsegmented_as_clone=false,
......
......@@ -220,14 +220,14 @@ void testExtractor() {
multi = new MultiGermline();
multi->insert(germline);
WindowExtractor we;
WindowExtractor we(multi);
map<string, string> 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, "");
......
......@@ -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);
......
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