Commit 684d2a66 authored by Mikael Salson's avatar Mikael Salson

WindowsStorage: add a hasWindow() method

parent 1c411938
......@@ -92,6 +92,11 @@ set<Germline *> WindowsStorage::getTopGermlines(size_t top, size_t min_reads) {
return top_germlines;
}
bool WindowsStorage::hasWindow(junction window) {
map<junction, Germline *>::iterator result = germline_by_window.find(window);
return (result != germline_by_window.end());
}
size_t WindowsStorage::size() {
return seqs_by_window.size();
}
......
......@@ -81,6 +81,10 @@ class WindowsStorage {
*/
void fillStatsClones();
/**
* @return true iff the window has been reported.
*/
bool hasWindow(junction window);
/**
* @return a list of windows together with the number of reads they appear in.
......
......@@ -15,6 +15,8 @@ void testWSAdd() {
TAP_TEST(ws.getGermline("ATTAG") == &germline,TEST_WS_GET_GERMLINE, "");
TAP_TEST(ws.getGermline("A") == NULL, TEST_WS_GET_GERMLINE_NONE, "");
TAP_TEST(ws.hasWindow("ATTAG") == true, TEST_WS_HAS_WINDOW, "");
TAP_TEST(ws.hasWindow("A") == false, TEST_WS_HAS_WINDOW, "");
TAP_TEST(ws.size() == 1, TEST_WS_SIZE, "");
TAP_TEST(ws.getLabel("ATTAG") == "", TEST_WS_GET_LABEL_NONE, "");
......
......@@ -114,6 +114,7 @@ enum {
/* WindowsStorage */
TEST_WS_GET_GERMLINE,
TEST_WS_GET_GERMLINE_NONE,
TEST_WS_HAS_WINDOW,
TEST_WS_SIZE,
TEST_WS_SIZE_NONE,
TEST_WS_GET_LABEL_NONE,
......@@ -234,6 +235,7 @@ inline void declare_tests() {
RECORD_TAP_TEST(TEST_EXTRACTOR_OUT_UNSEG, "Test unsegmentation output for WindowsExtractor");
RECORD_TAP_TEST(TEST_WS_GET_GERMLINE, "Test WindowsStorage::getGermline");
RECORD_TAP_TEST(TEST_WS_HAS_WINDOW, "Test WindowsStorage::hasWindow");
RECORD_TAP_TEST(TEST_WS_GET_GERMLINE_NONE, "Test WindowsStorage::getGermline() with undefined window");
RECORD_TAP_TEST(TEST_WS_SIZE, "Test WindowsStorage::size()");
RECORD_TAP_TEST(TEST_WS_SIZE_NONE, "Test WindowsStorage::size() when empty");
......
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