Commit 93d22139 authored by Mikael Salson's avatar Mikael Salson

CountKmerAffectAnalyser: Correct bounds when looking for the maximum

That cannot be done in one line. Only the lower value must be impacted by the shift.
If we're increasing from 0 to 50, with shift == 10, we must start at 10, and still end at 50.
Conversely if we're decreasing from 50 to 0, with shift == 10, we must start at 50, and end at 10.
parent 2ec4965a
......@@ -376,7 +376,12 @@ int CountKmerAffectAnalyser<T>::searchMax(const T&before, const T& after,
int first_pos_max = -1;
int max_value = min;
int shift = KmerAffectAnalyser<T>::kms.getS() - overlap - 1;
for (int i = start+shift*iter; (i)*iter <= iter*end; i+=iter) {
int shiftedStart = start, shiftedEnd = end;
if (iter == 1)
shiftedStart += shift;
else
shiftedEnd += shift;
for (int i = shiftedStart; (i)*iter <= iter*shiftedEnd; i+=iter) {
int value = countBefore(before, i - shift) + countAfter(after, i);
if (value > max_value) {
max_value = value;
......
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