Commit b2fe72dc authored by Mathieu Giraud's avatar Mathieu Giraud

core/windowExtractor.{h,cpp}: detailed outputs in out_segmented, out_unsegmented, out_affects

This streamlines the different detailed outputs, requiring a new 'out_affects' attribute.
parent ddea0157
#include "windowExtractor.h"
#include "segment.h"
WindowExtractor::WindowExtractor(): out_segmented(NULL), out_unsegmented(NULL){}
WindowExtractor::WindowExtractor(): out_segmented(NULL), out_unsegmented(NULL), out_affects(NULL){}
WindowsStorage *WindowExtractor::extract(OnlineFasta *reads, MultiGermline *multigermline,
......@@ -21,11 +21,11 @@ WindowsStorage *WindowExtractor::extract(OnlineFasta *reads, MultiGermline *mult
reads->next();
nb_reads++;
if (out_unsegmented) {
*out_unsegmented << reads->getSequence();
if (out_affects) {
*out_affects << reads->getSequence();
}
KmerMultiSegmenter kmseg(reads->getSequence(), multigermline, out_unsegmented);
KmerMultiSegmenter kmseg(reads->getSequence(), multigermline, out_affects);
KmerSegmenter *seg = kmseg.the_kseg ;
int read_length = seg->getSequence().sequence.length();
......@@ -46,17 +46,18 @@ WindowsStorage *WindowExtractor::extract(OnlineFasta *reads, MultiGermline *mult
if (out_segmented) {
*out_segmented << *seg ; // KmerSegmenter output (V/N/J)
if (out_unsegmented) {
*out_segmented << seg->getKmerAffectAnalyser()->toString() << endl;
*out_unsegmented << "#>" << reads->getSequence().label << " segmented " << segmented_mesg[seg->getSegmentationStatus()] << " on " << seg->segmented_germline->code << endl << endl;
}
}
nb_reads_germline[seg->system]++;
} else if (out_unsegmented) {
*out_unsegmented << "#>" << reads->getSequence().label << " not segmented " << segmented_mesg[seg->getSegmentationStatus()] << " (" << seg->segmented_germline->code << ")" << endl << endl;
*out_unsegmented << *seg ;
}
// Last line of detailed affects output
if (out_affects) {
*out_affects << "#>" << reads->getSequence().label << (seg->isSegmented() ? "" : " not") << " segmented "
<< segmented_mesg[seg->getSegmentationStatus()] << " on " << seg->segmented_germline->code << endl << endl;
}
}
return windowsStorage;
......@@ -86,6 +87,10 @@ void WindowExtractor::setUnsegmentedOutput(ostream *out) {
out_unsegmented = out;
}
void WindowExtractor::setAffectsOutput(ostream *out) {
out_affects = out;
}
void WindowExtractor::init_stats() {
for (int i = 0; i < STATS_SIZE; i++) {
stats[i].label = segmented_mesg[i];
......
......@@ -23,6 +23,7 @@ class WindowExtractor {
ostream *out_segmented;
ostream *out_unsegmented;
ostream *out_affects;
Stats stats[STATS_SIZE];
......@@ -87,6 +88,13 @@ class WindowExtractor {
*/
void setUnsegmentedOutput(ostream *out);
/**
* Defines the output stream where the detailed affects will be output.
* Otherwise no output will be given.
* @param out: The output stream
*/
void setAffectsOutput(ostream *out);
/**
* Output the segmentation stats
* @param out: The output stream
......
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