From eee0cd876332fa1599795f676aea46120c8c0961 Mon Sep 17 00:00:00 2001 From: ksahlin Date: Fri, 19 Apr 2024 11:10:41 +0200 Subject: [PATCH] Fixes that the mcs implementation gave different results depending on the -b parameter value --- src/index.hpp | 2 +- src/nam.cpp | 10 +++++----- src/randstrobes.hpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/index.hpp b/src/index.hpp index 48b8124a..6ee9d631 100644 --- a/src/index.hpp +++ b/src/index.hpp @@ -110,7 +110,7 @@ struct StrobemerIndex { randstrobes.begin() + position_end, RefRandstrobe{key, 0, 0}, cmp); - if (pos->hash == key) return pos - randstrobes.begin(); + if (pos->hash >> aux_len == key_prefix) return pos - randstrobes.begin(); return end(); } diff --git a/src/nam.cpp b/src/nam.cpp index 6bccb41a..cded85e9 100644 --- a/src/nam.cpp +++ b/src/nam.cpp @@ -52,13 +52,13 @@ inline void add_to_hits_per_ref_partial( adj_ref_start = index.get_strobe1_position(position) + index.strobe2_offset(position); } adj_ref_end = adj_ref_start + index.k(); - int diff = std::abs((query_end - query_start) - (adj_ref_end - adj_ref_start)); - if (diff <= min_diff) { +// int diff = std::abs((query_end - query_start) - (adj_ref_end - adj_ref_start)); +// if (diff <= min_diff) { hits_per_ref[index.reference_index(position)].push_back( Hit{query_start, query_end, adj_ref_start, adj_ref_end} ); - min_diff = diff; - } +// min_diff = diff; +// } } } @@ -211,7 +211,7 @@ std::pair> find_nams( size_t partial_pos = index.partial_find(q.hash); if (partial_pos != index.end()) { total_hits++; - if (index.is_partial_filtered(position)) { + if (index.is_partial_filtered(partial_pos)) { continue; } nr_good_hits++; diff --git a/src/randstrobes.hpp b/src/randstrobes.hpp index 070b874b..cdd8d1da 100644 --- a/src/randstrobes.hpp +++ b/src/randstrobes.hpp @@ -58,7 +58,7 @@ struct RefRandstrobe { packed_t m_packed; // packed representation of ref_index and strobe offset public: - static constexpr uint32_t max_number_of_references = (1 << (32 - bit_alloc)) - 1; + static constexpr uint32_t max_number_of_references = (1 << (32 - bit_alloc - 1)) - 1; // bit_alloc - 1 because 1 bit to main_is_first() }; struct QueryRandstrobe {