Skip to content

Commit

Permalink
Check unique IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
eaasna committed Aug 2, 2024
1 parent cae7a7c commit 1850b96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
5 changes: 2 additions & 3 deletions include/valik/search/cart_query_io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ inline bool get_cart_queries(rec_vec_t const & records,
seq_vec_t & seq_vec)
{

std::set<TId> uniqueIds; // set of short IDs (cut at first whitespace)
std::set<std::string> uniqueIds; // set of short IDs (cut at first whitespace)
bool idsUnique = true;

size_t seqCount{0};
Expand All @@ -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);
}

/*
Expand Down
21 changes: 6 additions & 15 deletions include/valik/search/iterate_queries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void iterate_all_queries(size_t const ref_seg_count,
search_arguments const & arguments,
cart_queue<shared_query_record<seq_t>> & queue)
{
using TId = seqan2::CharString;
using TId = std::string;
constexpr uint64_t chunk_size = (1ULL << 20) * 10;

seqan3::sequence_file_input<dna4_adaptor_traits> fin{arguments.query_file};
Expand All @@ -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<seq_t>(std::move(record.sequence())));

if (query_records.size() > chunk_size)
Expand Down Expand Up @@ -99,7 +96,7 @@ void iterate_short_queries(search_arguments const & arguments,
raptor::threshold::threshold const & thresholder,
cart_queue<shared_query_record<seq_t>> & queue)
{
using TId = seqan2::CharString;
using TId = std::string;
constexpr uint64_t chunk_size = (1ULL << 20) * 10;

seqan3::sequence_file_input<dna4_adaptor_traits> fin{arguments.query_file};
Expand All @@ -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<seq_t>(std::move(record.sequence())));

if (query_records.size() > chunk_size)
Expand Down Expand Up @@ -147,7 +141,7 @@ void iterate_split_queries(search_arguments const & arguments,
cart_queue<shared_query_record<seq_t>> & queue,
metadata & meta)
{
using TId = seqan2::CharString;
using TId = std::string;
constexpr uint64_t chunk_size = (1ULL << 20) * 10;

seqan3::sequence_file_input<dna4_adaptor_traits> fin{arguments.query_file};
Expand All @@ -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<seq_t>(std::move(record.sequence()));
for (auto const & seg : meta.segments_from_ind(seqCount))
{
Expand Down

0 comments on commit 1850b96

Please sign in to comment.