Commit 6f85cfea authored by Marc Duez's avatar Marc Duez
Browse files

c++: windowsextractor.cpp : store reads segmented per germline

parent e3b9f5b5
......@@ -11,6 +11,12 @@ WindowsStorage *WindowExtractor::extract(OnlineFasta *reads, MultiGermline *mult
WindowsStorage *windowsStorage = new WindowsStorage(windows_labels);
for (list<Germline*>::const_iterator it = multigermline->germlines.begin(); it != multigermline->germlines.end(); ++it)
{
Germline *germline = *it ;
nb_reads_germline[germline->code] = 0;
}
while (reads->hasNext()) {
reads->next();
nb_reads++;
......@@ -36,6 +42,8 @@ WindowsStorage *WindowExtractor::extract(OnlineFasta *reads, MultiGermline *mult
*out_segmented << seg.getKmerAffectAnalyser()->toString() << endl;
}
nb_reads_germline[seg.system]++;
} else if (out_unsegmented) {
*out_unsegmented << reads->getSequence();
*out_unsegmented << "#" << segmented_mesg[seg.getSegmentationStatus()] << endl;
......@@ -59,6 +67,10 @@ size_t WindowExtractor::getNbSegmented(SEGMENTED seg) {
return stats[seg].nb;
}
size_t WindowExtractor::getNbReadsGermline(string germline) {
return nb_reads_germline[germline];
}
void WindowExtractor::setSegmentedOutput(ostream *out) {
out_segmented = out;
}
......
......@@ -2,6 +2,8 @@
#define WINDOW_EXTRACTOR_H
#include <iostream>
#include <string>
#include <map>
#include "segment.h"
#include "germline.h"
#include "kmerstore.h"
......@@ -17,6 +19,7 @@ using namespace std;
class WindowExtractor {
private:
size_t nb_reads;
map<string, size_t> nb_reads_germline;
ostream *out_segmented;
ostream *out_unsegmented;
......@@ -63,6 +66,13 @@ class WindowExtractor {
*/
size_t getNbSegmented(SEGMENTED seg);
/**
* @return the number of reads segmented from germline
* @param germline_code: one of the germline code in multigermline
* @pre extract() must have been launched.
*/
size_t getNbReadsGermline(string germline_code);
/**
* Defines the output stream where the segmented sequences will be output.
* Otherwise no output will be given.
......
Supports Markdown
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