From 8ece1ed9dfb8bca0374b6dd879c3a627abcdd6c3 Mon Sep 17 00:00:00 2001 From: Marcel Martin Date: Tue, 14 Jan 2025 15:54:34 +0100 Subject: [PATCH] Remove the partial_start and partial_end attributes Since the first syncmer is always the base, we partial_start is always identical to start and partial_end is always identical to start + k. --- src/nam.cpp | 8 ++++---- src/randstrobes.cpp | 8 ++------ src/randstrobes.hpp | 5 ----- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/nam.cpp b/src/nam.cpp index b9d4dda7..1864eb62 100644 --- a/src/nam.cpp +++ b/src/nam.cpp @@ -243,7 +243,7 @@ std::tuple> find_nams( add_to_matches_map_full(matches_map[q.is_reverse], q.start, q.end, index, position); } else if (use_mcs) { - PartialHit ph{q.hash & index.get_main_hash_mask(), q.partial_start, q.is_reverse}; + PartialHit ph{q.hash & index.get_main_hash_mask(), q.start, q.is_reverse}; if (std::find(partial_queried.begin(), partial_queried.end(), ph) != partial_queried.end()) { // already queried continue; @@ -256,7 +256,7 @@ std::tuple> find_nams( continue; } nr_good_hits++; - add_to_matches_map_partial(matches_map[q.is_reverse], q.partial_start, q.partial_end, index, partial_pos); + add_to_matches_map_partial(matches_map[q.is_reverse], q.start, q.start + index.k(), index, partial_pos); } partial_queried.push_back(ph); } @@ -312,7 +312,7 @@ std::pair> find_nams_rescue( } } else if (use_mcs) { - PartialHit ph = {qr.hash & index.get_main_hash_mask(), qr.partial_start, qr.is_reverse}; + PartialHit ph = {qr.hash & index.get_main_hash_mask(), qr.start, qr.is_reverse}; if (std::find(partial_queried.begin(), partial_queried.end(), ph) != partial_queried.end()) { // already queried continue; @@ -320,7 +320,7 @@ std::pair> find_nams_rescue( size_t partial_pos = index.find_partial(qr.hash); if (partial_pos != index.end()) { unsigned int partial_count = index.get_count_partial(partial_pos); - RescueHit rh{partial_pos, partial_count, qr.partial_start, qr.partial_end, true}; + RescueHit rh{partial_pos, partial_count, qr.start, qr.start + index.k(), true}; if (qr.is_reverse){ hits_rc.push_back(rh); } else { diff --git a/src/randstrobes.cpp b/src/randstrobes.cpp index f9de12e0..9170437b 100644 --- a/src/randstrobes.cpp +++ b/src/randstrobes.cpp @@ -239,11 +239,9 @@ QueryRandstrobeVector randstrobes_query(const std::string_view seq, const IndexP RandstrobeIterator randstrobe_fwd_iter{syncmers, parameters.randstrobe}; while (randstrobe_fwd_iter.has_next()) { auto randstrobe = randstrobe_fwd_iter.next(); - const unsigned int partial_start = randstrobe.strobe1_pos; randstrobes.push_back( QueryRandstrobe { - randstrobe.hash, randstrobe.strobe1_pos, randstrobe.strobe2_pos + parameters.syncmer.k, - partial_start, partial_start + parameters.syncmer.k, false + randstrobe.hash, randstrobe.strobe1_pos, randstrobe.strobe2_pos + parameters.syncmer.k, false } ); } @@ -264,11 +262,9 @@ QueryRandstrobeVector randstrobes_query(const std::string_view seq, const IndexP RandstrobeIterator randstrobe_rc_iter{syncmers, parameters.randstrobe}; while (randstrobe_rc_iter.has_next()) { auto randstrobe = randstrobe_rc_iter.next(); - const unsigned int partial_start = randstrobe.strobe1_pos; randstrobes.push_back( QueryRandstrobe { - randstrobe.hash, randstrobe.strobe1_pos, randstrobe.strobe2_pos + parameters.syncmer.k, - partial_start, partial_start + parameters.syncmer.k, true + randstrobe.hash, randstrobe.strobe1_pos, randstrobe.strobe2_pos + parameters.syncmer.k, true } ); } diff --git a/src/randstrobes.hpp b/src/randstrobes.hpp index 60180e56..ae308966 100644 --- a/src/randstrobes.hpp +++ b/src/randstrobes.hpp @@ -68,11 +68,6 @@ struct QueryRandstrobe { randstrobe_hash_t hash; unsigned int start; unsigned int end; - /* Start and end of the main syncmer (relevant if the randstrobe couldn’t - * be found in the index and we fall back to a partial hit) - */ - unsigned int partial_start; - unsigned int partial_end; bool is_reverse; };