From 54af2748a7e28e435577dce96479bd4940bb3e1d Mon Sep 17 00:00:00 2001 From: Evelin Date: Fri, 20 Sep 2024 13:29:09 +0200 Subject: [PATCH] Print warning for verbose output --- include/valik/search/producer_threads_parallel.hpp | 9 +++++++-- include/valik/search/sync_out.hpp | 10 +++++++++- include/valik/shared.hpp | 1 + src/argument_parsing/search.cpp | 5 +++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/include/valik/search/producer_threads_parallel.hpp b/include/valik/search/producer_threads_parallel.hpp index 83590986..ccfea993 100644 --- a/include/valik/search/producer_threads_parallel.hpp +++ b/include/valik/search/producer_threads_parallel.hpp @@ -45,8 +45,13 @@ inline void prefilter_queries_parallel(seqan3::interleaved_bloom_filter const& bin_hits) { - if (arguments.verbose && (bin_hits.size() > std::max((size_t) 4, (size_t) std::round(ibf.bin_count() / 2.0)))) - verbose_out.write_record(record, bin_hits.size()); + if (bin_hits.size() > std::max((size_t) 4, (size_t) std::round(ibf.bin_count() / 2.0))) + { + if (arguments.very_verbose) + verbose_out.write_record(record, bin_hits.size()); + else if (arguments.verbose) + verbose_out.write_warning(record, bin_hits.size()); + } for (size_t const bin : bin_hits) { diff --git a/include/valik/search/sync_out.hpp b/include/valik/search/sync_out.hpp index 2ea34bb0..42287cab 100644 --- a/include/valik/search/sync_out.hpp +++ b/include/valik/search/sync_out.hpp @@ -23,6 +23,14 @@ class sync_out sync_out(std::filesystem::path const & path) : file{path} {} + template + void write_warning(t && query_record, size_t const & bin_count) + { + std::lock_guard lock(write_mutex); + seqan3::debug_stream << "[Warning] Insufficient prefiltering. " << bin_count << " bins match query of length " << query_record.sequence.size() << '\n'; + } + // outfile gets unlocked as soon as the current thread exits the write function + template void write_record(t && query_record, size_t const & bin_count) { @@ -34,7 +42,7 @@ class sync_out fasta_string += '\n'; std::lock_guard lock(write_mutex); - seqan3::debug_stream << "[Warning] Insufficient prefiltering. " << bin_count << " bins match query:\n" << fasta_string << "\n"; + seqan3::debug_stream << "[Warning] Insufficient prefiltering. " << bin_count << " bins match query:\n" << fasta_string << '\n'; } // outfile gets unlocked as soon as the current thread exits the write function diff --git a/include/valik/shared.hpp b/include/valik/shared.hpp index e17cb9f5..8fd73483 100644 --- a/include/valik/shared.hpp +++ b/include/valik/shared.hpp @@ -181,6 +181,7 @@ struct search_arguments final : public minimiser_threshold_arguments, search_pro bool write_time{false}; bool fast{false}; bool verbose{false}; + bool very_verbose{false}; size_t cart_max_capacity{1000}; size_t max_queued_carts{std::numeric_limits::max()}; diff --git a/src/argument_parsing/search.cpp b/src/argument_parsing/search.cpp index 131d0492..faf68f76 100644 --- a/src/argument_parsing/search.cpp +++ b/src/argument_parsing/search.cpp @@ -79,6 +79,11 @@ void init_search_parser(sharg::parser & parser, search_arguments & arguments) .long_id = "without-parameter-tuning", .description = "Preprocess database without setting default parameters.", .advanced = true}); + parser.add_flag(arguments.very_verbose, + sharg::config{.short_id = '\0', + .long_id = "very-verbose", + .description = "Print very verbose output.", + .advanced = true}); parser.add_option(arguments.seg_count_in, sharg::config{.short_id = 'n', .long_id = "seg-count",