From 8d94a36973314f91e3f33368c53ed05c7a25fec3 Mon Sep 17 00:00:00 2001 From: Enrico Seiler Date: Mon, 19 Aug 2024 13:51:31 +0200 Subject: [PATCH] [MISC] Validate hibf config --- src/chopper_layout.cpp | 1 + src/layout/execute.cpp | 23 +---------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/src/chopper_layout.cpp b/src/chopper_layout.cpp index b8ed2d01..24943145 100644 --- a/src/chopper_layout.cpp +++ b/src/chopper_layout.cpp @@ -55,6 +55,7 @@ int chopper_layout(chopper::configuration & config, sharg::parser & parser) config.hibf_config.input_fn = chopper::input_functor{filenames, config.precomputed_files, config.k, config.window_size}; config.hibf_config.number_of_user_bins = filenames.size(); + config.hibf_config.validate_and_set_defaults(); config.compute_sketches_timer.start(); seqan::hibf::sketch::compute_sketches(config.hibf_config, sketches); diff --git a/src/layout/execute.cpp b/src/layout/execute.cpp index 16775fba..6630447e 100644 --- a/src/layout/execute.cpp +++ b/src/layout/execute.cpp @@ -37,28 +37,7 @@ int execute(chopper::configuration & config, std::vector> const & filenames, std::vector const & sketches) { - assert(config.hibf_config.number_of_user_bins > 0); - - if (config.hibf_config.disable_estimate_union) - config.hibf_config.disable_rearrangement = true; - - if (config.hibf_config.tmax == 0) // no tmax was set by the user on the command line - { - // Set default as sqrt(#samples). Experiments showed that this is a reasonable default. - if (size_t number_samples = config.hibf_config.number_of_user_bins; - number_samples >= 1ULL << 32) // sqrt is bigger than uint16_t - throw std::invalid_argument{"Too many samples. Please set a tmax (see help via `-hh`)."}; // GCOVR_EXCL_LINE - else - config.hibf_config.tmax = - chopper::next_multiple_of_64(static_cast(std::ceil(std::sqrt(number_samples)))); - } - else if (config.hibf_config.tmax % 64 != 0) - { - config.hibf_config.tmax = chopper::next_multiple_of_64(config.hibf_config.tmax); - std::cerr << "[CHOPPER LAYOUT WARNING]: Your requested number of technical bins was not a multiple of 64. " - << "Due to the architecture of the HIBF, it will use up space equal to the next multiple of 64 " - << "anyway, so we increased your number of technical bins to " << config.hibf_config.tmax << ".\n"; - } + config.hibf_config.validate_and_set_defaults(); seqan::hibf::layout::layout hibf_layout; std::vector kmer_counts;