Skip to content

Commit

Permalink
Add config validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
smehringer committed Aug 19, 2024
1 parent 5b909d9 commit 65a8df7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/chopper_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
{
Expand Down

0 comments on commit 65a8df7

Please sign in to comment.