Commit 8753385c authored by Mikaël Salson's avatar Mikaël Salson
Browse files

Representative: isSufficientlyExpressed computes if a value is large enough

We delegate the computation of the coverage to a function (makes code easier to read and… see next commit)
parent 5ff0aef0
......@@ -34,6 +34,12 @@ bool RepresentativeComputer::hasRepresentative() const{
return is_computed;
}
bool RepresentativeComputer::isSufficienlyExpressed(size_t count,
size_t max) const {
return count>= min_cover
&& count >= max*percent_cover;
}
void RepresentativeComputer::setMinCover(size_t min_cover) {
this->min_cover = min_cover;
}
......@@ -110,8 +116,7 @@ void KmerRepresentativeComputer::compute() {
// Search the longest "run" of consecutive k-mers that are sufficiently
// expressed in the read collection.
while (i < counts.size()
&& counts[i].count >= min_cover
&& counts[i].count >= max*percent_cover) {
&& isSufficienlyExpressed(counts[i].count, max)) {
length_run++;
i++;
}
......
......@@ -47,6 +47,12 @@ public:
*/
bool hasRepresentative() const;
/**
* @return if the count is sufficiently elevated to be considered as expressed.
ie. count >= getMinCover() && count*1./max >= getPercentCoverage()
*/
bool isSufficienlyExpressed(size_t count, size_t max) const;
/**
* Compute the representative depending on the parameters set by the functions
*/
......
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