From a8bbb035a36383d8ed4f5e644d0bbcb312be61a4 Mon Sep 17 00:00:00 2001 From: ksahlin Date: Thu, 18 Apr 2024 17:23:27 +0200 Subject: [PATCH] adding syncmers at the ends of reads as seeds without 'aucillary' (context) hash. Increases the number of seeds per read with 2*w_min seeds' --- src/randstrobes.cpp | 8 ++++++++ src/randstrobes.hpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/randstrobes.cpp b/src/randstrobes.cpp index 6dc30391..be127651 100644 --- a/src/randstrobes.cpp +++ b/src/randstrobes.cpp @@ -158,6 +158,14 @@ Randstrobe RandstrobeIterator::get(unsigned int strobe1_index) const { uint64_t min_val = std::numeric_limits::max(); Syncmer strobe2 = strobe1; + if (syncmers.size() < w_start) { + return Randstrobe{ + randstrobe_hash(strobe1.hash, 0, aux_len), + static_cast(strobe1.position), + static_cast(strobe1.position), true + }; + } + for (auto i = w_start; i <= w_end && syncmers[i].position <= max_position; i++) { assert(i < syncmers.size()); diff --git a/src/randstrobes.hpp b/src/randstrobes.hpp index 070b874b..ac554f1a 100644 --- a/src/randstrobes.hpp +++ b/src/randstrobes.hpp @@ -126,7 +126,7 @@ class RandstrobeIterator { } bool has_next() { - return strobe1_index + w_min < syncmers.size(); + return strobe1_index < syncmers.size(); } private: