From 65a8df76e891616bcb6be09ca67fe3df80503a96 Mon Sep 17 00:00:00 2001 From: smehringer Date: Mon, 19 Aug 2024 14:00:07 +0200 Subject: [PATCH] Add config validation. --- src/chopper_layout.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/chopper_layout.cpp b/src/chopper_layout.cpp index aef768fa..08903684 100644 --- a/src/chopper_layout.cpp +++ b/src/chopper_layout.cpp @@ -28,6 +28,24 @@ namespace chopper { +void validate_configuration(sharg::parser & parser, + chopper::configuration & config, + chopper::configuration const & sketch_config) +{ + if (parser.is_option_set("sketch-bits")) + throw sharg::parser_error{"You cannot set --sketch-bits when using a sketch file as input."}; + + if (parser.is_option_set("kmer") && config.k != sketch_config.k) + { + std::cerr << sharg::detail::to_string( + "[WARNING] Given k-mer size (", + config.k, + ") differs from k-mer size in the sketch file (", + config.k, + "). The results may be suboptimal. If this was a conscious decision, you can ignore this warning.\n"); + } +} + int chopper_layout(chopper::configuration & config, sharg::parser & parser) { parser.parse(); @@ -55,6 +73,7 @@ int chopper_layout(chopper::configuration & config, sharg::parser & parser) filenames = std::move(sin.filenames); sketches = std::move(sin.hll_sketches); + validate_configuration(parser, config, sin.chopper_config); } else {