Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Overwrite kmer and window configuration from sketch file to current config. #273

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/chopper_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
namespace chopper
{

/*!\brief Validates the chopper configuration of the current chopper call with that from the sketch file
*
* If a sketch file is given as input, certain configurations have been already used for generating the sketches but
* the user can still give the same arguments to the current command line.
* This function checks for consistency als overwrites default values within the chopper configuration with those from the
* sketch file. Overwriting is needed because the current chopper config is written to the layout file and should
* be consistent with the sketch file.
*/
void validate_configuration(sharg::parser & parser,
chopper::configuration & config,
chopper::configuration const & sketch_config)
Expand All @@ -44,6 +52,21 @@ void validate_configuration(sharg::parser & parser,
sketch_config.k,
"). The results may be suboptimal. If this was a conscious decision, you can ignore this warning.\n");
}
else
{
config.k = sketch_config.k; // make sure default is overwritten
}

if (parser.is_option_set("window") && config.window_size != sketch_config.window_size)
{
throw sharg::parser_error{"You are using a sketch file as input but want to use a --window size that differs "
"from the one used for sketching. This will result in a layout (and subsequently "
"an index that does not represent your data correctly."};
}
else
{
config.window_size = sketch_config.window_size; // make sure default is overwritten
}
}

int chopper_layout(chopper::configuration & config, sharg::parser & parser)
Expand Down