55 struct search_config_max_error_rate
58 std::tuple<double, double, double, double> value;
64 struct search_config_max_error_rate_adaptor :
65 public configuration_fn_base<search_config_max_error_rate_adaptor>
73 template <
typename error_type_t,
typename out_t,
typename ... error_types_t>
74 constexpr
void get_type_out(out_t & out, std::tuple<error_types_t...>
const & in)
const 76 constexpr
auto count = meta::count<meta::list<error_types_t...>, error_type_t>::value;
77 static_assert(count <= 1,
"The same error type has been passed multiple times to max_error.");
78 if constexpr (count > 0)
79 std::
get<error_type_t>(out) =
std::
get<error_type_t>(in);
89 template <typename configuration_t, typename ... error_types_t>
91 requires is_algorithm_configuration_v<
remove_cvref_t<configuration_t>>
93 constexpr auto invoke(configuration_t && cfg, error_types_t && ...error_types)
const 95 static_assert(is_valid_search_configuration_v<search_cfg::id::max_error_rate, remove_cvref_t<configuration_t>>,
96 SEQAN3_INVALID_CONFIG(search_cfg::id::max_error_rate));
98 std::tuple in{error_types...};
99 std::tuple<search_cfg::total<double>, search_cfg::substitution<double>,
100 search_cfg::insertion<double>, search_cfg::deletion<double>> out{.0, .0, .0, .0};
102 get_type_out<search_cfg::total<double>>(out, in);
103 get_type_out<search_cfg::substitution<double>>(out, in);
104 get_type_out<search_cfg::insertion<double>>(out, in);
105 get_type_out<search_cfg::deletion<double>>(out, in);
107 using error_types_list_t = meta::list<remove_cvref_t<error_types_t>...>;
108 constexpr
bool total_set = meta::in<error_types_list_t, search_cfg::total<double>>::value;
109 constexpr
bool other_error_types_set = meta::count<error_types_list_t, search_cfg::total<double>>::value !=
110 meta::size<error_types_list_t>::value;
112 double const total_v {std::get<0>(out)};
113 double const substitution_v{std::get<1>(out)};
114 double const insertion_v {std::get<2>(out)};
115 double const deletion_v {std::get<3>(out)};
117 if ((0 > total_v || total_v > 1) || (0 > substitution_v || substitution_v > 1) ||
118 (0 > insertion_v || insertion_v > 1) || (0 > deletion_v || deletion_v > 1))
120 throw std::invalid_argument(
"Error rates must be between 0 and 1.");
124 if constexpr (!other_error_types_set)
127 if constexpr (total_set)
129 std::get<1>(out) = search_cfg::substitution<double>{total_v};
130 std::get<2>(out) = search_cfg::insertion<double>{total_v};
131 std::get<3>(out) = search_cfg::deletion<double>{total_v};
135 else if constexpr (!total_set)
138 std::get<0>(out) = search_cfg::total<double>{std::min(1., substitution_v + insertion_v + deletion_v)};
141 search_config_max_error_rate tmp{
static_cast<std::tuple<double, double, double, double>
>(out)};
142 return std::forward<configuration_t>(cfg).push_front(std::move(tmp));
152 template <config_element_concept t>
153 using invoke =
typename std::is_same<t, search_config_max_error_rate>::type;
159 struct search_config_type_to_id<search_config_max_error_rate>
162 static constexpr
search_cfg::id value = search_cfg::id::max_error_rate;
Provides the error types for maximum number of errors.
Provides functionality to access get function by enum values.
Provides seqan3::type_list and auxiliary metafunctions.
constexpr detail::search_config_max_error_rate_adaptor max_error_rate
A configuration element for the maximum number of errors in percent of the query length across all er...
Definition: max_error_rate.hpp:176
SeqAn specific customisations in the standard namespace.
Definition: align_result.hpp:221
A special sub namespace for the search configurations.
constexpr auto const & get(detail::configuration< cfg_elements_t... > const &cfg) noexcept
Definition: utility.hpp:364
id
Specifies an id for every configuration element.
Definition: utility.hpp:68
Definition: aligned_sequence_concept.hpp:288
Provides various metafunctions on generic types.
Meta-Header for components of the algorithm submodule.