Skip to content

Commit a7a2c1d

Browse files
committed
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.
1 parent f2d9e9f commit a7a2c1d

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

src/nam.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ std::tuple<float, int, std::vector<Nam>> find_nams(
243243
add_to_matches_map_full(matches_map[q.is_reverse], q.start, q.end, index, position);
244244
}
245245
else if (use_mcs) {
246-
PartialHit ph{q.hash & index.get_main_hash_mask(), q.partial_start, q.is_reverse};
246+
PartialHit ph{q.hash & index.get_main_hash_mask(), q.start, q.is_reverse};
247247
if (std::find(partial_queried.begin(), partial_queried.end(), ph) != partial_queried.end()) {
248248
// already queried
249249
continue;
@@ -256,7 +256,7 @@ std::tuple<float, int, std::vector<Nam>> find_nams(
256256
continue;
257257
}
258258
nr_good_hits++;
259-
add_to_matches_map_partial(matches_map[q.is_reverse], q.partial_start, q.partial_end, index, partial_pos);
259+
add_to_matches_map_partial(matches_map[q.is_reverse], q.start, q.start + index.k(), index, partial_pos);
260260
}
261261
partial_queried.push_back(ph);
262262
}
@@ -312,15 +312,15 @@ std::pair<int, std::vector<Nam>> find_nams_rescue(
312312
}
313313
}
314314
else if (use_mcs) {
315-
PartialHit ph = {qr.hash & index.get_main_hash_mask(), qr.partial_start, qr.is_reverse};
315+
PartialHit ph = {qr.hash & index.get_main_hash_mask(), qr.start, qr.is_reverse};
316316
if (std::find(partial_queried.begin(), partial_queried.end(), ph) != partial_queried.end()) {
317317
// already queried
318318
continue;
319319
}
320320
size_t partial_pos = index.find_partial(qr.hash);
321321
if (partial_pos != index.end()) {
322322
unsigned int partial_count = index.get_count_partial(partial_pos);
323-
RescueHit rh{partial_pos, partial_count, qr.partial_start, qr.partial_end, true};
323+
RescueHit rh{partial_pos, partial_count, qr.start, qr.start + index.k(), true};
324324
if (qr.is_reverse){
325325
hits_rc.push_back(rh);
326326
} else {

src/randstrobes.cpp

+2-6
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,9 @@ QueryRandstrobeVector randstrobes_query(const std::string_view seq, const IndexP
239239
RandstrobeIterator randstrobe_fwd_iter{syncmers, parameters.randstrobe};
240240
while (randstrobe_fwd_iter.has_next()) {
241241
auto randstrobe = randstrobe_fwd_iter.next();
242-
const unsigned int partial_start = randstrobe.strobe1_pos;
243242
randstrobes.push_back(
244243
QueryRandstrobe {
245-
randstrobe.hash, randstrobe.strobe1_pos, randstrobe.strobe2_pos + parameters.syncmer.k,
246-
partial_start, partial_start + parameters.syncmer.k, false
244+
randstrobe.hash, randstrobe.strobe1_pos, randstrobe.strobe2_pos + parameters.syncmer.k, false
247245
}
248246
);
249247
}
@@ -264,11 +262,9 @@ QueryRandstrobeVector randstrobes_query(const std::string_view seq, const IndexP
264262
RandstrobeIterator randstrobe_rc_iter{syncmers, parameters.randstrobe};
265263
while (randstrobe_rc_iter.has_next()) {
266264
auto randstrobe = randstrobe_rc_iter.next();
267-
const unsigned int partial_start = randstrobe.strobe1_pos;
268265
randstrobes.push_back(
269266
QueryRandstrobe {
270-
randstrobe.hash, randstrobe.strobe1_pos, randstrobe.strobe2_pos + parameters.syncmer.k,
271-
partial_start, partial_start + parameters.syncmer.k, true
267+
randstrobe.hash, randstrobe.strobe1_pos, randstrobe.strobe2_pos + parameters.syncmer.k, true
272268
}
273269
);
274270
}

src/randstrobes.hpp

-5
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ struct QueryRandstrobe {
6868
randstrobe_hash_t hash;
6969
unsigned int start;
7070
unsigned int end;
71-
/* Start and end of the main syncmer (relevant if the randstrobe couldn’t
72-
* be found in the index and we fall back to a partial hit)
73-
*/
74-
unsigned int partial_start;
75-
unsigned int partial_end;
7671
bool is_reverse;
7772
};
7873

0 commit comments

Comments
 (0)