Skip to content

Commit

Permalink
avoid division by 0 to determine minhash_kmer_size
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGuarracino committed Jun 23, 2024
1 parent 577c3de commit c455a67
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common/wflign/src/wflign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ void WFlign::wflign_affine_wavefront(
return;
}

const int minhash_kmer_size = std::max(8, std::min(17, (int)std::floor(1.0 / (1.0 - mashmap_estimated_identity))));
// Check if mashmap_estimated_identity == 1 to avoid division by zero, leading to a minhash_kmer_size of 8.
// Such low value was leading to confusion in HORs alignments in the human centromeres (high runtime and memory usage, and wrong alignments)
const int minhash_kmer_size = mashmap_estimated_identity == 1 ? 17 : std::max(8, std::min(17, (int)std::floor(1.0 / (1.0 - mashmap_estimated_identity))));

// Set penalties for wfa affine
wflign_penalties_t wfa_affine_penalties;
Expand Down

0 comments on commit c455a67

Please sign in to comment.