21# include <cereal/types/array.hpp>
36template <arithmetic score_type>
48template <arithmetic score_type>
61template <arithmetic score_type>
73template <arithmetic score_type>
95template <
typename derived_t, alphabet alphabet_t, arithmetic score_t>
143 template <arithmetic score_arg_t>
174 template <arithmetic score_arg_t>
182 throw std::invalid_argument{
"You passed a score value to set_simple_scheme that is out of range of the "
183 "scoring scheme's underlying type. Define your scoring scheme with a larger "
184 "template parameter or down-cast you score value beforehand to prevent "
190 matrix[i][j] = (i == j) ?
static_cast<score_t
>(i_ms) :
static_cast<score_t
>(i_mms);
212 template <
typename alph1_t,
typename alph2_t>
214 constexpr score_t &
score(alph1_t
const alph1, alph2_t
const alph2)
noexcept
216 return matrix[
to_rank(
static_cast<alphabet_t
>(alph1))][
to_rank(
static_cast<alphabet_t
>(alph2))];
220 template <
typename alph1_t,
typename alph2_t>
222 constexpr score_t
score(alph1_t
const alph1, alph2_t
const alph2)
const noexcept
224 return matrix[
to_rank(
static_cast<alphabet_t
>(alph1))][
to_rank(
static_cast<alphabet_t
>(alph2))];
234 return matrix == rhs.matrix;
240 return matrix != rhs.matrix;
251 template <cereal_archive archive_t>
Core alphabet concept and free function/type trait wrappers.
Adaptions of concepts from the Cereal library.
CRTP base class to declare a strong typedef for a regular type to avoid ambiguous parameter settings ...
Definition strong_type.hpp:174
constexpr strong_type() noexcept=default
Defaulted.
A CRTP base class for scoring schemes.
Definition scoring_scheme_base.hpp:97
constexpr void set_simple_scheme(match_score< score_arg_t > const ms, mismatch_score< score_arg_t > const mms)
Set the simple scheme (everything is either match or mismatch).
Definition scoring_scheme_base.hpp:175
friend derived_t
Befriend derived_t so it can instantiate.
Definition scoring_scheme_base.hpp:122
constexpr void set_hamming_distance() noexcept
Set the hamming scheme, a variant of the simple scheme where match is scored 0 and mismatch -1.
Definition scoring_scheme_base.hpp:163
constexpr scoring_scheme_base(scoring_scheme_base &&) noexcept=default
Defaulted.
constexpr score_t score(alph1_t const alph1, alph2_t const alph2) const noexcept
Score two letters (either two nucleotids or two amino acids).
Definition scoring_scheme_base.hpp:222
alphabet_t alphabet_type
Type of the underlying alphabet.
Definition scoring_scheme_base.hpp:105
constexpr scoring_scheme_base(scoring_scheme_base const &) noexcept=default
Defaulted.
constexpr bool operator!=(derived_t const &rhs) const noexcept
Checks whether *this is not equal to rhs.
Definition scoring_scheme_base.hpp:238
constexpr bool operator==(derived_t const &rhs) const noexcept
Checks whether *this is equal to rhs.
Definition scoring_scheme_base.hpp:232
matrix_type matrix
The actual data member.
Definition scoring_scheme_base.hpp:260
constexpr scoring_scheme_base(matrix_type const &matrix) noexcept
Constructor for a custom scheme (delegates to set_custom_matrix()).
Definition scoring_scheme_base.hpp:152
constexpr void set_custom_matrix(matrix_type const &matrix) noexcept
Set a custom scheme by passing a full matrix with arbitrary content.
Definition scoring_scheme_base.hpp:196
constexpr scoring_scheme_base(match_score< score_arg_t > const ms, mismatch_score< score_arg_t > const mms)
Constructor for the simple scheme (delegates to set_simple_scheme()).
Definition scoring_scheme_base.hpp:144
score_t score_type
Type of the score values.
Definition scoring_scheme_base.hpp:103
constexpr score_t & score(alph1_t const alph1, alph2_t const alph2) noexcept
Score two letters (either two nucleotids or two amino acids).
Definition scoring_scheme_base.hpp:214
static constexpr matrix_size_type matrix_size
Size of the matrix dimensions (i.e. size of the alphabet).
Definition scoring_scheme_base.hpp:111
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition alphabet/concept.hpp:152
Checks whether from can be explicitly converted to to.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Provides basic data structure for strong types.
A strong type of underlying type score_type that represents the score of two matching characters.
Definition scoring_scheme_base.hpp:38
match_score(score_type) -> match_score< score_type >
Deduce the score type from the provided argument.
A strong type of underlying type score_type that represents the score two different characters.
Definition scoring_scheme_base.hpp:63
mismatch_score(score_type) -> mismatch_score< score_type >
Deduce the score type from the provided argument.
Provides concepts that do not have equivalents in C++20.