Skip to content

Commit 65a8df7

Browse files
committed
Add config validation.
1 parent 5b909d9 commit 65a8df7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/chopper_layout.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@
2828
namespace chopper
2929
{
3030

31+
void validate_configuration(sharg::parser & parser,
32+
chopper::configuration & config,
33+
chopper::configuration const & sketch_config)
34+
{
35+
if (parser.is_option_set("sketch-bits"))
36+
throw sharg::parser_error{"You cannot set --sketch-bits when using a sketch file as input."};
37+
38+
if (parser.is_option_set("kmer") && config.k != sketch_config.k)
39+
{
40+
std::cerr << sharg::detail::to_string(
41+
"[WARNING] Given k-mer size (",
42+
config.k,
43+
") differs from k-mer size in the sketch file (",
44+
config.k,
45+
"). The results may be suboptimal. If this was a conscious decision, you can ignore this warning.\n");
46+
}
47+
}
48+
3149
int chopper_layout(chopper::configuration & config, sharg::parser & parser)
3250
{
3351
parser.parse();
@@ -55,6 +73,7 @@ int chopper_layout(chopper::configuration & config, sharg::parser & parser)
5573

5674
filenames = std::move(sin.filenames);
5775
sketches = std::move(sin.hll_sketches);
76+
validate_configuration(parser, config, sin.chopper_config);
5877
}
5978
else
6079
{

0 commit comments

Comments
 (0)