Skip to content

Commit 43a74d6

Browse files
committed
PartialHit is no longer needed
1 parent a7a2c1d commit 43a74d6

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

src/nam.cpp

+1-19
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,6 @@ std::tuple<float, int, std::vector<Nam>> find_nams(
223223
const StrobemerIndex& index,
224224
bool use_mcs
225225
) {
226-
std::vector<PartialHit> partial_queried; // TODO: is a small set more efficient than linear search in a small vector?
227-
if (use_mcs) {
228-
partial_queried.reserve(10);
229-
}
230226
std::array<robin_hood::unordered_map<unsigned int, std::vector<Match>>, 2> matches_map;
231227
matches_map[0].reserve(100);
232228
matches_map[1].reserve(100);
@@ -243,24 +239,18 @@ std::tuple<float, int, std::vector<Nam>> find_nams(
243239
add_to_matches_map_full(matches_map[q.is_reverse], q.start, q.end, index, position);
244240
}
245241
else if (use_mcs) {
246-
PartialHit ph{q.hash & index.get_main_hash_mask(), q.start, q.is_reverse};
247-
if (std::find(partial_queried.begin(), partial_queried.end(), ph) != partial_queried.end()) {
248-
// already queried
249-
continue;
250-
}
251242
size_t partial_pos = index.find_partial(q.hash);
252243
if (partial_pos != index.end()) {
253244
total_hits++;
254245
if (index.is_partial_filtered(partial_pos)) {
255-
partial_queried.push_back(ph);
256246
continue;
257247
}
258248
nr_good_hits++;
259249
add_to_matches_map_partial(matches_map[q.is_reverse], q.start, q.start + index.k(), index, partial_pos);
260250
}
261-
partial_queried.push_back(ph);
262251
}
263252
}
253+
264254
float nonrepetitive_fraction = total_hits > 0 ? ((float) nr_good_hits) / ((float) total_hits) : 1.0;
265255
auto nams = merge_matches_into_nams_forward_and_reverse(matches_map, index.k(), use_mcs);
266256
return {nonrepetitive_fraction, nr_good_hits, nams};
@@ -290,8 +280,6 @@ std::pair<int, std::vector<Nam>> find_nams_rescue(
290280
< std::tie(rhs.count, rhs.query_start, rhs.query_end);
291281
}
292282
};
293-
std::vector<PartialHit> partial_queried; // TODO: is a small set more efficient than linear search in a small vector?
294-
partial_queried.reserve(10);
295283
std::array<robin_hood::unordered_map<unsigned int, std::vector<Match>>, 2> matches_map;
296284
std::vector<RescueHit> hits_fw;
297285
std::vector<RescueHit> hits_rc;
@@ -312,11 +300,6 @@ std::pair<int, std::vector<Nam>> find_nams_rescue(
312300
}
313301
}
314302
else if (use_mcs) {
315-
PartialHit ph = {qr.hash & index.get_main_hash_mask(), qr.start, qr.is_reverse};
316-
if (std::find(partial_queried.begin(), partial_queried.end(), ph) != partial_queried.end()) {
317-
// already queried
318-
continue;
319-
}
320303
size_t partial_pos = index.find_partial(qr.hash);
321304
if (partial_pos != index.end()) {
322305
unsigned int partial_count = index.get_count_partial(partial_pos);
@@ -327,7 +310,6 @@ std::pair<int, std::vector<Nam>> find_nams_rescue(
327310
hits_fw.push_back(rh);
328311
}
329312
}
330-
partial_queried.push_back(ph);
331313
}
332314
}
333315

0 commit comments

Comments
 (0)