Commit d9ddc010 authored by Mathieu Giraud's avatar Mathieu Giraud

core/windows.{h,cpp}: sortedWindowsToJson() can stop after a maximal number of clones

See #3347.
parent 5c54f210
...@@ -262,7 +262,7 @@ json WindowsStorage::computeDiversity(int nb_segmented) { ...@@ -262,7 +262,7 @@ json WindowsStorage::computeDiversity(int nb_segmented) {
} }
json WindowsStorage::sortedWindowsToJson(map <junction, json> json_data_segment) { json WindowsStorage::sortedWindowsToJson(map <junction, json> json_data_segment, int max_json_output) {
json windowsArray; json windowsArray;
int top = 1; int top = 1;
...@@ -290,6 +290,9 @@ json WindowsStorage::sortedWindowsToJson(map <junction, json> json_data_segment) ...@@ -290,6 +290,9 @@ json WindowsStorage::sortedWindowsToJson(map <junction, json> json_data_segment)
windowsList["seg_stat"] = this->statusToJson(it->first); windowsList["seg_stat"] = this->statusToJson(it->first);
windowsArray.push_back(windowsList); windowsArray.push_back(windowsList);
if (top == max_json_output + 1)
break ;
} }
return windowsArray; return windowsArray;
......
...@@ -215,10 +215,11 @@ class WindowsStorage { ...@@ -215,10 +215,11 @@ class WindowsStorage {
/** /**
* Print the windows from the most abundant to the least abundant * Print the windows from the most abundant to the least abundant
* @max_json_output: maximal number of windows to output (<= 0: no limit)
*/ */
ostream &printSortedWindows(ostream &os); ostream &printSortedWindows(ostream &os);
json sortedWindowsToJson(map<junction, json> json_data_segment); json sortedWindowsToJson(map<junction, json> json_data_segment, int max_json_output);
/** /**
* Display a window with its in size in a somewhat FASTA format * Display a window with its in size in a somewhat FASTA format
......
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