16 #include <seqan3/alphabet/detail/convert.hpp>
20 #ifdef SEQAN3_DEPRECATED_310
21 namespace seqan3::detail
25 template <
typename alphabet_t>
26 SEQAN3_CONCEPT has_complement_table = requires()
28 { alphabet_t::complement_table[0] };
55 template <
typename derived_type, auto size>
94 template <
typename other_nucl_type>
96 requires (!std::same_as<nucleotide_base, other_nucl_type>) &&
97 (!std::same_as<derived_type, other_nucl_type>) &&
102 static_cast<derived_type &
>(*this) =
103 detail::convert_through_char_representation<derived_type, other_nucl_type>[
seqan3::to_rank(other)];
131 #ifdef SEQAN3_DEPRECATED_310
132 if constexpr (detail::has_complement_table<derived_type>)
133 return complement_table_deprecated(
to_rank());
135 return derived_type{}.assign_rank(derived_type{}.rank_complement(
to_rank()));
137 return derived_type{}.assign_rank(derived_type{}.rank_complement(
to_rank()));
141 #ifdef SEQAN3_DEPRECATED_310
150 return derived_type::complement_table[rank];
180 return valid_char_table[
static_cast<uint8_t
>(c)];
196 #ifdef SEQAN3_DEPRECATED_310
197 if constexpr (detail::has_rank_to_char_table<derived_type>)
198 c = derived_type::rank_to_char[rank];
200 c = derived_type::rank_to_char(rank);
202 c = derived_type::rank_to_char(rank);
Provides seqan3::nucleotide_alphabet.
Provides seqan3::alphabet_base.
A CRTP-base that makes defining a custom alphabet easier.
Definition: alphabet_base.hpp:81
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition: alphabet_base.hpp:185
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: alphabet_base.hpp:104
static constexpr detail::min_viable_uint_t< size > alphabet_size
The size of the alphabet, i.e. the number of different values it can take.
Definition: alphabet_base.hpp:276
std::conditional_t< std::same_as< char, void >, char, char > char_type
The char representation; conditional needed to make semi alphabet definitions legal.
Definition: alphabet_base.hpp:96
A CRTP-base that refines seqan3::alphabet_base and is used by the nucleotides.
Definition: nucleotide_base.hpp:57
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:178
constexpr derived_type complement() const noexcept
Return the complement of the letter.
Definition: nucleotide_base.hpp:129
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:100
constexpr auto alphabet_size
A type trait that holds the size of a (semi-)alphabet.
Definition: concept.hpp:858
constexpr auto to_rank
Return the rank representation of a (semi-)alphabet object.
Definition: concept.hpp:155
A concept that indicates whether an alphabet represents nucleotides.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
constexpr char_type to_lower(char_type const c) noexcept
Converts 'A'-'Z' to 'a'-'z' respectively; other characters are returned as is.
Definition: transform.hpp:81