Commit dd18ed6d authored by Mathieu Giraud's avatar Mathieu Giraud

core/windows.cpp: extract/rewrite getLabel() from isInterestingJunction()

Interesting sequences may have labels.
parent 222ee316
......@@ -21,14 +21,6 @@ map<junction, BinReadStorage>::iterator WindowsStorage::end() {
return seqs_by_window.end();
}
string WindowsStorage::getLabel(junction window) {
if (windows_labels.find(window) == windows_labels.end())
return "" ;
return windows_labels[window];
}
float WindowsStorage::getAverageLength(junction window) {
assert(hasWindow(window));
return seqs_by_window[window].getAverageScore();
......@@ -126,7 +118,8 @@ bool WindowsStorage::hasWindow(junction window) {
return (result != germline_by_window.end());
}
bool WindowsStorage::isInterestingJunction(junction window) {
string WindowsStorage::getLabel(junction window) {
bool found = false;
for (auto it: windows_labels) {
string sequence_of_interest = it.first;
......@@ -138,9 +131,13 @@ bool WindowsStorage::isInterestingJunction(junction window) {
|| sequence_of_interest.find(revcomp(window)) != string::npos;
}
if (found)
return true;
return it.second;
}
return false;
return "";
}
bool WindowsStorage::isInterestingJunction(junction window) {
return (getLabel(window).length() != 0) ;
}
size_t WindowsStorage::size() {
......
......@@ -121,6 +121,11 @@ class WindowsStorage {
*/
bool hasWindow(junction window);
/**
* @return the related label iff the window is contained (or contains) a sequence of interest
*/
string getLabel(junction window);
/**
* @return true iff the window is contained (or contains) a sequence of interest
*/
......@@ -181,13 +186,6 @@ 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);
/**
* @pre should be called before keepInterestingWindows()
* Compute, display, and return some diversity measures
......
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