Commit 181dafd7 authored by Mathieu Giraud's avatar Mathieu Giraud

core/windows.cpp: define and use windowsStorage.getLabel(window)

Accessing this method while the window is not label does not create an element in the map.
parent 518068d4
......@@ -26,6 +26,14 @@ vector<int> WindowsStorage::getStatus(junction window) {
return status_by_window[window];
}
string WindowsStorage::getLabel(junction window) {
if (windows_labels.find(window) == windows_labels.end())
return "" ;
return windows_labels[window];
}
Germline *WindowsStorage::getGermline(junction window) {
return germline_by_window[window];
}
......@@ -187,7 +195,7 @@ JsonArray WindowsStorage::sortedWindowsToJsonArray(map <junction, JsonList> json
ostream &WindowsStorage::windowToStream(ostream &os, junction window, int num_seq,
size_t size) {
os << ">" << size << "--window--" << num_seq << " " << windows_labels[window] << endl ;
os << ">" << size << "--window--" << num_seq << " " << getLabel(window) << endl ;
os << window << endl;
return os;
}
......@@ -111,6 +111,12 @@ class WindowsStorage {
*/
void add(junction window, Sequence sequence, int status, Germline *germline);
/**
* Return the label of a window, if it exists
*/
string getLabel(junction window);
/**
* Only keep windows that are interesting. Those windows are windows
* supported by at least min_reads_window reads as well as windows that are
......
......@@ -1038,8 +1038,7 @@ int main (int argc, char **argv)
string clone_id_human = oss_human.str();
// Window label
string window_str = ">" + clone_id + "--window" + " " + windows_labels[it->first] + '\n' + it->first + '\n' ;
string window_str = ">" + clone_id + "--window" + " " + windowsStorage->getLabel(it->first) + '\n' + it->first + '\n' ;
//$$ If max_representatives is reached, we stop here but still outputs the window
......
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