Skip to content

Commit

Permalink
[MISC] Default should be w=k if no w given
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Nov 2, 2023
1 parent a50253e commit 1fc4834
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/chopper/configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct configuration
uint8_t k{19};

//!\brief The window size to compute minimizers before computing a HyperLogLog sketch from them.
uint8_t window_size{19};
uint8_t window_size{k};

//!\brief Do not write the sketches into a dedicated directory.
bool disable_sketch_output{false};
Expand Down
5 changes: 5 additions & 0 deletions src/chopper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ int main(int argc, char const * argv[])
{
parser.parse();

if (!parser.is_option_set("window"))
config.window_size = config.k;
else if (config.k > config.window_size)
throw sharg::parser_error{"The k-mer size cannot be bigger than the window size."};

Check warning on line 40 in src/chopper.cpp

View check run for this annotation

Codecov / codecov/patch

src/chopper.cpp#L39-L40

Added lines #L39 - L40 were not covered by tests

config.disable_sketch_output = !parser.is_option_set("output-sketches-to");
}
catch (sharg::parser_error const & ext) // the user did something wrong
Expand Down
4 changes: 3 additions & 1 deletion src/set_up_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ void set_up_parser(sharg::parser & parser, configuration & config)
"runtime performance. On the other hand, it also decreases accuracy and might cause false negatives."
"For DNA sequences, a window size of 2-4 positions more than the kmers size, e.g. (42,20)-minimizers, "
"has proven to reduce the computational effort significantly while only slightly descreasing the "
"accuracy."});
"accuracy.",
.default_message = "k-mer size",
});

parser.add_option(
config.hibf_config.tmax,
Expand Down
1 change: 1 addition & 0 deletions test/cli/cli_chopper_pipeline_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ TEST_F(cli_test, chopper_layout)
"@ \"value0\": \"\"\n"
"@ },\n"
"@ \"k\": 15,\n"
"@ \"window_size\": 15,\n"
"@ \"disable_sketch_output\": true,\n"
"@ \"precomputed_files\": false,\n"
"@ \"output_filename\": {\n"
Expand Down

0 comments on commit 1fc4834

Please sign in to comment.