Skip to content

Commit

Permalink
Ensure unmappable.41 really is unmappable
Browse files Browse the repository at this point in the history
Randstrobes that have no downstream partner at least w_min syncmers away get
their second hash set to 0, which means in the case of multi-context seeds
that the primary/main hash is also zero (because it is the smaller of the
two).

When this is done both for the reference and for queries, we get spurious
hits for all randstrobes towards the ends of queries (they get mapped to the
end of the reference).

Using the hash of the primary syncmer also as hash for the second syncmer
gets rid of the problem.
  • Loading branch information
marcelm committed Oct 3, 2024
1 parent 99b5030 commit 3b8c129
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/randstrobes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,7 @@ Randstrobe RandstrobeIterator::get(unsigned int strobe1_index) const {
Syncmer strobe2 = strobe1;

if (syncmers.size() < w_start) {
return Randstrobe{
randstrobe_hash(strobe1.hash, 0, aux_len),
static_cast<uint32_t>(strobe1.position),
static_cast<uint32_t>(strobe1.position),
true
};
return make_randstrobe(strobe1, strobe1, aux_len);
}

for (auto i = w_start; i <= w_end && syncmers[i].position <= max_position; i++) {
Expand Down Expand Up @@ -208,12 +203,7 @@ Randstrobe RandstrobeGenerator::next() {
auto strobe1 = syncmers[0];

if (syncmers.size() < w_min) {
auto randstrobe = Randstrobe{
randstrobe_hash(strobe1.hash, 0, aux_len),
static_cast<uint32_t>(strobe1.position),
static_cast<uint32_t>(strobe1.position),
true
};
auto randstrobe = make_randstrobe(strobe1, strobe1, aux_len);
syncmers.pop_front();
return randstrobe;
}
Expand Down

0 comments on commit 3b8c129

Please sign in to comment.