Commit c99627cb authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

core/windows.{h,cpp}, core/windowExtractor.cpp: stores in the windowStorage the segmented germline

parent aaabe92c
......@@ -25,7 +25,7 @@ WindowsStorage *WindowExtractor::extract(OnlineFasta *reads, MultiGermline *mult
if (junc.size()) {
stats_segmented[TOTAL_SEG_AND_WINDOW]++ ;
stats_length[TOTAL_SEG_AND_WINDOW] += seg.getSequence().sequence.length() ;
windowsStorage->add(junc, reads->getSequence(), seg.getSegmentationStatus());
windowsStorage->add(junc, reads->getSequence(), seg.getSegmentationStatus(), seg.segmented_germline);
} else {
stats_segmented[TOTAL_SEG_BUT_TOO_SHORT_FOR_THE_WINDOW]++ ;
stats_length[TOTAL_SEG_BUT_TOO_SHORT_FOR_THE_WINDOW] += seg.getSequence().sequence.length() ;
......
......@@ -26,6 +26,10 @@ vector<int> WindowsStorage::getStatus(junction window) {
return status_by_window[window];
}
Germline *WindowsStorage::getGermline(junction window) {
return germline_by_window[window];
}
JsonList WindowsStorage::statusToJson(junction window) {
JsonList result;
......@@ -85,12 +89,14 @@ int WindowsStorage::getId(junction window) {
return id_by_window[window];
}
void WindowsStorage::add(junction window, Sequence sequence, int status) {
void WindowsStorage::add(junction window, Sequence sequence, int status, Germline *germline) {
seqs_by_window[window].push_back(sequence);
if (status_by_window.find(window) == status_by_window.end() ) {
status_by_window[window].resize(STATS_SIZE);
}
status_by_window[window][status]++;
germline_by_window[window] = germline;
}
pair <int, int> WindowsStorage::keepInterestingWindows(size_t min_reads_window) {
......
......@@ -16,7 +16,7 @@
#include "fasta.h"
#include "json.h"
#include "segment.h"
#include "json.h"
#include "germline.h"
using namespace std;
......@@ -26,6 +26,7 @@ class WindowsStorage {
private:
map<junction, list<Sequence> > seqs_by_window;
map<junction, vector<int> > status_by_window;
map<junction, Germline* > germline_by_window;
map<string, string> windows_labels;
list<pair <junction, int> > sort_all_windows;
map<junction, int> id_by_window;
......@@ -51,6 +52,7 @@ class WindowsStorage {
* @return the segmented status of reads supporting a given window
*/
vector<int> getStatus(junction window);
Germline *getGermline(junction window);
JsonList statusToJson(junction window);
......@@ -107,7 +109,7 @@ class WindowsStorage {
/**
* Add a new window with its list of sequences
*/
void add(junction window, Sequence sequence, int status);
void add(junction window, Sequence sequence, int status, Germline *germline);
/**
* Only keep windows that are interesting. Those windows are windows
......
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