28 uint8_t
const kmer_size{arguments.
shape.size()};
29 size_t const kmers_per_window = arguments.
window_size - kmer_size + 1;
33 threshold_kind = threshold_kinds::percentage;
36 else if (kmers_per_window == 1u)
38 threshold_kind = threshold_kinds::lemma;
39 size_t const kmer_lemma_minuend = arguments.
pattern_size + 1u;
40 size_t const kmer_lemma_subtrahend = (arguments.
errors + 1u) * kmer_size;
41 kmer_lemma = kmer_lemma_minuend > kmer_lemma_subtrahend ? kmer_lemma_minuend - kmer_lemma_subtrahend : 0;
45 threshold_kind = threshold_kinds::probabilistic;
46 size_t const kmers_per_pattern = arguments.
pattern_size - kmer_size + 1;
47 minimal_number_of_minimizers = kmers_per_pattern / kmers_per_window;
54 size_t get(
size_t const minimiser_count)
const noexcept
56 switch (threshold_kind)
58 case threshold_kinds::lemma:
60 case threshold_kinds::percentage:
61 return static_cast<size_t>(minimiser_count * threshold_percentage);
64 assert(threshold_kind == threshold_kinds::probabilistic);
65 size_t const index = std::clamp(minimiser_count, minimal_number_of_minimizers, maximal_number_of_minimizers)
66 - minimal_number_of_minimizers;
67 return precomp_thresholds[index] + precomp_correction[index];
73 enum class threshold_kinds
80 threshold_kinds threshold_kind{threshold_kinds::probabilistic};
81 std::vector<size_t> precomp_correction{};
82 std::vector<size_t> precomp_thresholds{};
84 size_t minimal_number_of_minimizers{};
85 size_t maximal_number_of_minimizers{};
86 double threshold_percentage{};
Definition: threshold.hpp:17
threshold(threshold const &)=default
threshold & operator=(threshold &&)=default
threshold(threshold_parameters const &arguments)
Definition: threshold.hpp:26
threshold(threshold &&)=default
threshold & operator=(threshold const &)=default
size_t get(size_t const minimiser_count) const noexcept
Definition: threshold.hpp:54
Definition: forward_strand_minimiser.hpp:19
std::vector< size_t > precompute_correction(threshold_parameters const &arguments)
Definition: precompute_correction.cpp:60
std::vector< size_t > precompute_threshold(threshold_parameters const &arguments)
Definition: precompute_threshold.cpp:61
Definition: threshold_parameters.hpp:18
uint32_t window_size
Definition: threshold_parameters.hpp:20
double percentage
Definition: threshold_parameters.hpp:26
uint8_t errors
Definition: threshold_parameters.hpp:25
uint64_t pattern_size
Definition: threshold_parameters.hpp:22
seqan3::shape shape
Definition: threshold_parameters.hpp:21