From 2a7b4f588a2b78f54d29b79aff86d566310b36bb Mon Sep 17 00:00:00 2001 From: Marcel Martin Date: Wed, 29 Jan 2025 23:12:56 +0100 Subject: [PATCH] PartialHit is no longer needed --- src/nam.cpp | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/src/nam.cpp b/src/nam.cpp index 9bcd55b0..266ee6d5 100644 --- a/src/nam.cpp +++ b/src/nam.cpp @@ -13,19 +13,6 @@ bool operator==(const Match& lhs, const Match& rhs) { return (lhs.query_start == rhs.query_start) && (lhs.query_end == rhs.query_end) && (lhs.ref_start == rhs.ref_start) && (lhs.ref_end == rhs.ref_end); } -/* - * A partial hit is a hit where not the full randstrobe hash could be found in - * the index but only the "main" hash (only the first aux_len bits). - */ -struct PartialHit { - randstrobe_hash_t hash; - unsigned int start; // position in strobemer index - bool is_reverse; - bool operator==(const PartialHit& rhs) const { - return (hash == rhs.hash) && (start == rhs.start) && (is_reverse == rhs.is_reverse); - } -}; - inline void add_to_matches_map_full( robin_hood::unordered_map>& matches_map, int query_start, @@ -223,10 +210,6 @@ std::tuple> find_nams( const StrobemerIndex& index, bool use_mcs ) { - std::vector partial_queried; // TODO: is a small set more efficient than linear search in a small vector? - if (use_mcs) { - partial_queried.reserve(10); - } std::array>, 2> matches_map; matches_map[0].reserve(100); matches_map[1].reserve(100); @@ -243,22 +226,15 @@ std::tuple> find_nams( add_to_matches_map_full(matches_map[q.is_revcomp], q.start, q.end, index, position); } else if (use_mcs) { - 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; - } size_t partial_pos = index.find_partial(q.hash); if (partial_pos != index.end()) { total_hits++; if (index.is_partial_filtered(partial_pos)) { - partial_queried.push_back(ph); continue; } nr_good_hits++; add_to_matches_map_partial(matches_map[q.is_revcomp], q.start, q.start + index.k(), index, partial_pos); } - partial_queried.push_back(ph); } } @@ -306,8 +282,6 @@ std::pair> find_nams_rescue( < std::tie(rhs.count, rhs.query_start, rhs.query_end); } }; - std::vector partial_queried; // TODO: is a small set more efficient than linear search in a small vector? - partial_queried.reserve(10); std::array>, 2> matches_map; std::array, 2> hits; matches_map[0].reserve(100); @@ -323,18 +297,12 @@ std::pair> find_nams_rescue( hits[qr.is_revcomp].push_back(rh); } else if (use_mcs) { - 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; - } 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.start, qr.start + index.k(), true}; hits[qr.is_revcomp].push_back(rh); } - partial_queried.push_back(ph); } }