18#include <bio/alphabet/detail/convert.hpp>
19#include <bio/alphabet/detail/to_lower.hpp>
29template <
typename derived_type, auto size>
67 template <meta::different_from<derived_type> other_aa_type>
72 detail::writable_constexpr_alphabet<other_aa_type>)
74 static_cast<derived_type &
>(*this) =
103 return valid_char_table[
static_cast<uint8_t
>(c)];
110 static_assert(
sizeof(
char_type) == 1,
"This table is unusable for char types larger than 1 byte.");
116 for (
char_type c : derived_type::rank_to_char)
119 ret[detail::to_lower(c)] =
true;
Provides bio::alphabet::aminoacid.
Provides bio::alphabet::base.
A CRTP-base that refines bio::alphabet::base and is used by the amino acids.
Definition: aminoacid_base.hpp:31
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: aminoacid_base.hpp:101
constexpr aminoacid_base(other_aa_type const other) noexcept
Allow explicit construction from any other aminoacid type and convert via the character representatio...
Definition: aminoacid_base.hpp:69
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 concept that indicates whether an alphabet represents amino acids.
Definition: concept.hpp:97
constexpr auto to_char
Return the char representation of an alphabet object.
Definition: concept.hpp:192
constexpr auto assign_char_to
Assign a char to an alphabet object.
Definition: concept.hpp:260
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
This is an empty base class that can be inherited by types that shall model bio::alphabet::aminoacid.
Definition: concept.hpp:34