Skip to content

Commit

Permalink
Print warning for verbose output
Browse files Browse the repository at this point in the history
  • Loading branch information
eaasna committed Sep 25, 2024
1 parent 9c8f8fc commit 54af274
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
9 changes: 7 additions & 2 deletions include/valik/search/producer_threads_parallel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ inline void prefilter_queries_parallel(seqan3::interleaved_bloom_filter<ibf_data

auto prefilter_cb = [&queue,&arguments,&verbose_out,&ibf](query_t const& record, std::unordered_set<size_t> 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)
{
Expand Down
10 changes: 9 additions & 1 deletion include/valik/search/sync_out.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ class sync_out

sync_out(std::filesystem::path const & path) : file{path} {}

template <typename t>
void write_warning(t && query_record, size_t const & bin_count)
{
std::lock_guard<std::mutex> 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 <typename t>
void write_record(t && query_record, size_t const & bin_count)
{
Expand All @@ -34,7 +42,7 @@ class sync_out
fasta_string += '\n';

std::lock_guard<std::mutex> 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

Expand Down
1 change: 1 addition & 0 deletions include/valik/shared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t>::max()};
Expand Down
5 changes: 5 additions & 0 deletions src/argument_parsing/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 54af274

Please sign in to comment.