Maj terminée. Pour consulter la release notes associée voici le lien :
https://about.gitlab.com/releases/2021/07/07/critical-security-release-gitlab-14-0-4-released/

Commit aaa970f2 authored by Mikaël Salson's avatar Mikaël Salson Committed by Mathieu Giraud
Browse files

core/representative: New optional parameter: try_hard

When set, we will try hard to find a representative.
By default it is not set. The KmerRepresentativeComputer will
automatically try hard if the representative found by default is not
long enough (< THRESHOLD_BAD_COVERAGE).
parent f4f58cfa
......@@ -81,7 +81,7 @@ KmerRepresentativeComputer::KmerRepresentativeComputer(list<Sequence> &r,
string seed)
:RepresentativeComputer(r),seed(seed),stability_limit(DEFAULT_STABILITY_LIMIT){}
void KmerRepresentativeComputer::compute() {
void KmerRepresentativeComputer::compute(bool try_hard) {
assert(coverage_reference_length > 0);
is_computed = false;
......@@ -94,6 +94,10 @@ void KmerRepresentativeComputer::compute() {
"-##-##-##-##-##",
"--#--#--#--#--#--#--#--#--#--#"};
size_t nb_seeds = 5;
if (! try_hard)
nb_seeds = 1;
// Add sequences to the index, allowing extended nucleotides (false)
for (list<Sequence>::iterator it=sequences.begin(); it != sequences.end(); ++it) {
for (size_t i = 0; i < nb_seeds; i++)
......@@ -201,6 +205,13 @@ void KmerRepresentativeComputer::compute() {
length_run = 0;
}
coverage = (float) length_longest_run / coverage_reference_length;
if (coverage < THRESHOLD_BAD_COVERAGE && ! try_hard) {
compute(true);
return;
}
if (length_longest_run) {
is_computed = true;
representative = sequence_longest_run;
......@@ -237,12 +248,10 @@ void KmerRepresentativeComputer::compute() {
}
}
coverage = (float) length_longest_run / coverage_reference_length;
coverage_info = string_of_int(length_longest_run) + " bp"
+ " (" + string_of_int(100 * coverage) + "% of " + fixed_string_of_float(coverage_reference_length, 1) + " bp)";
representative.label += " - " + coverage_info ;
representative.label += " - " + coverage_info;
}
delete index;
}
......
......@@ -56,7 +56,7 @@ public:
/**
* Compute the representative depending on the parameters set by the functions
*/
virtual void compute() = 0;
virtual void compute(bool try_hard=false) = 0;
/**
* @param min_cover: minimal number of reads supporting each position of the
......@@ -124,7 +124,8 @@ public:
/**
* @pre setCoverageReferenceLength() must have been called previously
*/
void compute();
void compute(bool try_hard = false);
private:
/**
......
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