Commit 1211e00f authored by Mikael Salson's avatar Mikael Salson

WindowsStorage: get the germlines of the most abundant clones

parent 62c605ba
......@@ -73,6 +73,21 @@ list<Sequence> WindowsStorage::getSample(junction window, size_t nb_sampled,
return SequenceSampler(reads).getLongest(nb_sampled, nb_buckets);
}
set<Germline *> WindowsStorage::getTopGermlines(size_t top, size_t min_reads) {
assert(sort_all_windows.size() == seqs_by_window.size());
set<Germline *> top_germlines;
size_t count = 0;
for (list<pair <junction, int> >::const_iterator it = sort_all_windows.begin();
it != sort_all_windows.end() && count < top && (size_t)it->second >= min_reads;
++it, ++count) {
top_germlines.insert(getGermline(it->first));
}
return top_germlines;
}
size_t WindowsStorage::size() {
return seqs_by_window.size();
}
......
......@@ -11,6 +11,7 @@
#include <iostream>
#include <map>
#include <set>
#include <utility>
#include <string>
#include "fasta.h"
......@@ -103,6 +104,16 @@ class WindowsStorage {
*/
string getLabel(junction window);
/**
* @pre sort() must have been called.
* @param top: Only the germlines of the top most abundant windows will
* be considered
* @param min_reads: (optional) minimal number (inclusive) of reads the window
* must be supported by.
* @return a set of the most abundant germlines.
*/
set<Germline *> getTopGermlines(size_t top, size_t min_reads=1);
/**
* Only keep windows that are interesting. Those windows are windows
* supported by at least min_reads_window reads as well as windows that are
......
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