From 1850b96e0df361c4051a941bd38ed4b85e26c00e Mon Sep 17 00:00:00 2001 From: Evelin Date: Fri, 2 Aug 2024 21:29:43 +0200 Subject: [PATCH] Check unique IDs --- include/valik/search/cart_query_io.hpp | 5 ++--- include/valik/search/iterate_queries.hpp | 21 ++++++--------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/include/valik/search/cart_query_io.hpp b/include/valik/search/cart_query_io.hpp index 2b9e8be6..5a5bfd21 100644 --- a/include/valik/search/cart_query_io.hpp +++ b/include/valik/search/cart_query_io.hpp @@ -36,7 +36,7 @@ inline bool get_cart_queries(rec_vec_t const & records, seq_vec_t & seq_vec) { - std::set uniqueIds; // set of short IDs (cut at first whitespace) + std::set uniqueIds; // set of short IDs (cut at first whitespace) bool idsUnique = true; size_t seqCount{0}; @@ -45,8 +45,7 @@ inline bool get_cart_queries(rec_vec_t const & records, { seq_vec.emplace_back(record.sequence); seqCount++; - - //!TODO: idsUnique? + idsUnique &= stellar::_checkUniqueId(uniqueIds, record.sequence_id); } /* diff --git a/include/valik/search/iterate_queries.hpp b/include/valik/search/iterate_queries.hpp index e63f0318..318a5bd2 100644 --- a/include/valik/search/iterate_queries.hpp +++ b/include/valik/search/iterate_queries.hpp @@ -53,7 +53,7 @@ void iterate_all_queries(size_t const ref_seg_count, search_arguments const & arguments, cart_queue> & queue) { - using TId = seqan2::CharString; + using TId = std::string; constexpr uint64_t chunk_size = (1ULL << 20) * 10; seqan3::sequence_file_input fin{arguments.query_file}; @@ -65,10 +65,7 @@ void iterate_all_queries(size_t const ref_seg_count, size_t seqCount{0}; for (auto & record : fin) { - //!TODO: IDs unique?? - // TId id{}; - // idsUnique &= stellar::_checkUniqueId(uniqueIds, id); - + idsUnique &= stellar::_checkUniqueId(uniqueIds, record.id()); query_records.emplace_back(record.id(), std::make_shared(std::move(record.sequence()))); if (query_records.size() > chunk_size) @@ -99,7 +96,7 @@ void iterate_short_queries(search_arguments const & arguments, raptor::threshold::threshold const & thresholder, cart_queue> & queue) { - using TId = seqan2::CharString; + using TId = std::string; constexpr uint64_t chunk_size = (1ULL << 20) * 10; seqan3::sequence_file_input fin{arguments.query_file}; @@ -111,10 +108,7 @@ void iterate_short_queries(search_arguments const & arguments, size_t seqCount{0}; for (auto & record : fin) { - //!TODO: IDs unique?? - // TId id{}; - // idsUnique &= stellar::_checkUniqueId(uniqueIds, id); - + idsUnique &= stellar::_checkUniqueId(uniqueIds, record.id()); query_records.emplace_back(record.id(), std::make_shared(std::move(record.sequence()))); if (query_records.size() > chunk_size) @@ -147,7 +141,7 @@ void iterate_split_queries(search_arguments const & arguments, cart_queue> & queue, metadata & meta) { - using TId = seqan2::CharString; + using TId = std::string; constexpr uint64_t chunk_size = (1ULL << 20) * 10; seqan3::sequence_file_input fin{arguments.query_file}; @@ -159,10 +153,7 @@ void iterate_split_queries(search_arguments const & arguments, size_t seqCount{0}; for (auto & record : fin) { - //!TODO: IDs unique?? - // TId id{}; - // idsUnique &= stellar::_checkUniqueId(uniqueIds, id); - + idsUnique &= stellar::_checkUniqueId(uniqueIds, record.id()); auto query_ptr = std::make_shared(std::move(record.sequence())); for (auto const & seg : meta.segments_from_ind(seqCount)) {