Skip to content

Commit d7c5cbe

Browse files
committed
Produce a syncmer if any minimum is at the required position
This changes the way in which ties are handled during syncmer computation, that is, what happens when there are multiple s-mers in the k-mer that have the same minimum hash value (most likely because the s-mers are identical). Previously, a syncmer would be returned only if the s-mer at position t happened to be the rightmost minimum. Now it will be returned if any of the s-mers with minimum hash is at positon t. This increases the number of produced syncmers.
1 parent 5893f9b commit d7c5cbe

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/randstrobes.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Syncmer SyncmerIterator::next() {
115115
qs_min_pos = i - s + 1;
116116
}
117117
}
118-
if (qs_min_pos == i - k + t) { // occurs at t:th position in k-mer
118+
if (qs[t-1] == qs_min_val) { // occurs at t:th position in k-mer
119119
uint64_t yk = std::min(xk[0], xk[1]);
120120
auto syncmer = Syncmer{syncmer_kmer_hash(yk), i - k + 1};
121121
i++;

tests/test_randstrobes.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ TEST_CASE("SyncmerIterator") {
2828
Syncmer syncmer;
2929
syncmer = si.next();
3030
CHECK(!syncmer.is_end());
31-
CHECK(syncmer.position == 2ul);
31+
CHECK(syncmer.position == 0ul);
3232
}

0 commit comments

Comments
 (0)