Commit 0cc84ddf authored by Mikaël Salson's avatar Mikaël Salson

representative.cpp: setCoverageReferenceLength must be called before compute()

parent bb850f1e
......@@ -9,7 +9,8 @@ using namespace std;
RepresentativeComputer::RepresentativeComputer(list<Sequence> &r)
:sequences(r),is_computed(false),representative(),min_cover(1),
percent_cover(0.5),revcomp(true),required(""),coverage(0.0),coverage_info("") {
percent_cover(0.5),revcomp(true),required(""),coverage_reference_length(0),
coverage(0.0),coverage_info("") {
}
Sequence RepresentativeComputer::getRepresentative() const{
......@@ -75,6 +76,7 @@ KmerRepresentativeComputer::KmerRepresentativeComputer(list<Sequence> &r,
:RepresentativeComputer(r),seed(seed),stability_limit(DEFAULT_STABILITY_LIMIT){}
void KmerRepresentativeComputer::compute() {
assert(coverage_reference_length > 0);
is_computed = false;
// First create an index on the set of reads
......
......@@ -115,6 +115,9 @@ public:
void setStabilityLimit(int limit);
// Actions
/**
* @pre setCoverageReferenceLength() must have been called previously
*/
void compute();
};
......
......@@ -10,6 +10,7 @@ void testRepresentative() {
krc.setRevcomp(false);
krc.setMinCover(1);
krc.setPercentCoverage(0.5);
krc.setCoverageReferenceLength(50);
krc.compute();
Sequence representative = krc.getRepresentative();
......@@ -55,6 +56,7 @@ void testRevcompRepresentative() {
KmerRepresentativeComputer krc(reads, "##############");
krc.setOptions(false, 3, 0.5);
krc.setCoverageReferenceLength(50);
krc.compute();
Sequence representative = krc.getRepresentative();
......@@ -65,6 +67,7 @@ void testRevcompRepresentative() {
KmerRepresentativeComputer krc2(reads, "##############");
krc2.setOptions(false, 3, 0.5);
krc2.setCoverageReferenceLength(50);
krc2.compute();
Sequence representative2 = krc2.getRepresentative();
......
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