17#include <bio/alphabet/detail/convert.hpp>
18#include <bio/alphabet/detail/to_lower.hpp>
40template <
typename derived_type, auto size>
75 template <meta::different_from<derived_type> other_nucl_type>
79 static_cast<derived_type &
>(*this) =
105 requires(requires(derived_type d) { d.complement_table; })
107 return derived_type::complement_table[
to_rank()];
132 return valid_char_table[
static_cast<uint8_t
>(c)];
139 static_assert(
sizeof(
char_type) == 1,
"This table is unusable for char types larger than 1 byte.");
145 for (
char_type c : derived_type::rank_to_char)
148 ret[detail::to_lower(c)] =
true;
163 return a.complement();
Provides bio::alphabet::nucleotide.
Provides bio::alphabet::base.
A CRTP-base that makes defining a custom alphabet easier.
Definition: base.hpp:55
static constexpr size_t alphabet_size
The size of the alphabet, i.e. the number of different values it can take.
Definition: base.hpp:177
meta::detail::min_viable_uint_t< size - 1 > rank_type
The type of the alphabet when represented as a number (e.g. via to_rank()).
Definition: base.hpp:65
std::conditional_t< std::same_as< char, void >, char, char > char_type
The char representation; conditional needed to make semi alphabet definitions legal.
Definition: base.hpp:63
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition: base.hpp:124
A CRTP-base that refines bio::alphabet::base and is used by the nucleotides.
Definition: nucleotide_base.hpp:42
friend constexpr derived_type tag_invoke(custom::complement, derived_type const a) noexcept
tag_invoke() wrapper around member.
Definition: nucleotide_base.hpp:161
static constexpr bool char_is_valid(char_type const c) noexcept
Validate whether a character value has a one-to-one mapping to an alphabet value.
Definition: nucleotide_base.hpp:130
constexpr derived_type complement() const noexcept
Return the complement of the letter.
Definition: nucleotide_base.hpp:104
constexpr nucleotide_base(other_nucl_type const &other) noexcept
Allow explicit construction from any other nucleotide type and convert via the character representati...
Definition: nucleotide_base.hpp:77
A concept that indicates whether an alphabet represents nucleotides.
Definition: concept.hpp:113
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition: concept.hpp:70
The alphabet module's namespace.
Definition: aa10li.hpp:23
Customisation tag for bio::alphabet::complement.
Definition: tag.hpp:49