Skip to content

Commit 7cc49aa

Browse files
authored
Merge pull request #252 from eseiler/misc/validate_config
[MISC] Validate hibf config
2 parents 771eb30 + 8d94a36 commit 7cc49aa

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

src/chopper_layout.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ int chopper_layout(chopper::configuration & config, sharg::parser & parser)
5555
config.hibf_config.input_fn =
5656
chopper::input_functor{filenames, config.precomputed_files, config.k, config.window_size};
5757
config.hibf_config.number_of_user_bins = filenames.size();
58+
config.hibf_config.validate_and_set_defaults();
5859

5960
config.compute_sketches_timer.start();
6061
seqan::hibf::sketch::compute_sketches(config.hibf_config, sketches);

src/layout/execute.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,7 @@ int execute(chopper::configuration & config,
3737
std::vector<std::vector<std::string>> const & filenames,
3838
std::vector<seqan::hibf::sketch::hyperloglog> const & sketches)
3939
{
40-
assert(config.hibf_config.number_of_user_bins > 0);
41-
42-
if (config.hibf_config.disable_estimate_union)
43-
config.hibf_config.disable_rearrangement = true;
44-
45-
if (config.hibf_config.tmax == 0) // no tmax was set by the user on the command line
46-
{
47-
// Set default as sqrt(#samples). Experiments showed that this is a reasonable default.
48-
if (size_t number_samples = config.hibf_config.number_of_user_bins;
49-
number_samples >= 1ULL << 32) // sqrt is bigger than uint16_t
50-
throw std::invalid_argument{"Too many samples. Please set a tmax (see help via `-hh`)."}; // GCOVR_EXCL_LINE
51-
else
52-
config.hibf_config.tmax =
53-
chopper::next_multiple_of_64(static_cast<uint16_t>(std::ceil(std::sqrt(number_samples))));
54-
}
55-
else if (config.hibf_config.tmax % 64 != 0)
56-
{
57-
config.hibf_config.tmax = chopper::next_multiple_of_64(config.hibf_config.tmax);
58-
std::cerr << "[CHOPPER LAYOUT WARNING]: Your requested number of technical bins was not a multiple of 64. "
59-
<< "Due to the architecture of the HIBF, it will use up space equal to the next multiple of 64 "
60-
<< "anyway, so we increased your number of technical bins to " << config.hibf_config.tmax << ".\n";
61-
}
40+
config.hibf_config.validate_and_set_defaults();
6241

6342
seqan::hibf::layout::layout hibf_layout;
6443
std::vector<size_t> kmer_counts;

0 commit comments

Comments
 (0)