From 99cc2a51158bc359db06d2e6df07c2e5cb8e3e18 Mon Sep 17 00:00:00 2001 From: tibvdm Date: Wed, 28 Aug 2024 11:13:10 +0200 Subject: [PATCH] fix the amount of iterations to calculate the k-mers --- sa-index/src/sa_searcher.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sa-index/src/sa_searcher.rs b/sa-index/src/sa_searcher.rs index 73701b2..b41942d 100644 --- a/sa-index/src/sa_searcher.rs +++ b/sa-index/src/sa_searcher.rs @@ -157,7 +157,9 @@ impl Searcher { let start_cache_fill_time = get_time_ms().unwrap(); // Update the bounds for all 3-mers in the KTable - for i in 0..searcher.kmer_cache.base.pow(k as u32) { + let base = searcher.kmer_cache.base; + let length = (base.pow(k as u32 + 1) - base) / (base - 1); + for i in 0..length { if i % print_step_size == 0 { eprintln!("Updating kmer cache: {}% ({} seconds since start)", i / print_step_size, (get_time_ms().unwrap() - start_cache_fill_time) / 1000.0); }