58 template <u
int8_t SIZE = 51>
61 static_assert(SIZE >= 15 && SIZE <= 67 && SIZE % 2 == 1,
62 "The wuss<> alphabet size must be an odd number in range 15..67.");
83 constexpr
wuss() noexcept = default;
84 constexpr
wuss(
wuss const &) noexcept = default;
86 constexpr
wuss & operator=(
wuss const &) noexcept = default;
87 constexpr
wuss & operator=(
wuss &&) noexcept = default;
88 ~
wuss() noexcept = default;
102 return interaction_tab[
to_rank()] < 0;
112 return interaction_tab[
to_rank()] > 0;
122 return interaction_tab[
to_rank()] == 0;
143 if (interaction_tab[
to_rank()] != 0)
144 return std::abs(interaction_tab[
to_rank()]) - 1;
158 '.',
':',
',',
'-',
'_',
'~',
';',
'<',
'(',
'[',
'{',
'>',
')',
']',
'}'
165 chars[rnk] =
'A' + off;
166 chars[rnk + 1u] =
'a' + off;
186 rank_table[rank_to_char_table[rnk]] = rnk;
194 return rank_to_char_table[rank];
201 return char_to_rank_table[
static_cast<index_t
>(chr)];
210 template <u
int8_t SIZE>
217 for (rank_type rnk = 0u; rnk <= 6u; ++rnk)
219 interaction_table[rnk] = 0;
222 for (rank_type rnk = 7u; rnk <= 10u; ++rnk)
224 interaction_table[rnk] = --cnt_open;
227 for (rank_type rnk = 11u; rnk <= 14u; ++rnk)
229 interaction_table[rnk] = ++cnt_close;
232 for (rank_type rnk = 15u; rnk + 1u <
alphabet_size; rnk += 2u)
234 interaction_table[rnk] = --cnt_open;
235 interaction_table[rnk + 1u] = ++cnt_close;
238 return interaction_table;
246 inline namespace literals
262 constexpr
wuss51 operator""_wuss51(
char const ch) noexcept
283 for (
size_t idx = 0ul; idx < len; ++idx)
284 vec[idx].assign_char(str[idx]);
Provides seqan3::rna_structure_alphabet.
Provides seqan3::alphabet_base.
A CRTP-base that makes defining a custom alphabet easier.
Definition: alphabet_base.hpp:81
constexpr char_type to_char() const noexcept
Return the letter as a character of char_type.
Definition: alphabet_base.hpp:139
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
constexpr derived_type & assign_char(char_type const chr) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:211
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_t, void >, char, char_t > char_type
The char representation; conditional needed to make semi alphabet definitions legal.
Definition: alphabet_base.hpp:96
The WUSS structure alphabet of the characters .<>:,-_~;()[]{}AaBbCcDd...
Definition: wuss.hpp:60
static constexpr uint8_t max_pseudoknot_depth
The ability of this alphabet to represent pseudoknots, i.e. crossing interactions,...
Definition: wuss.hpp:131
constexpr bool is_pair_close() const noexcept
Check whether the character represents a leftward interaction in an RNA structure.
Definition: wuss.hpp:110
constexpr bool is_pair_open() const noexcept
Check whether the character represents a rightward interaction in an RNA structure.
Definition: wuss.hpp:100
constexpr std::optional< uint8_t > pseudoknot_id() const noexcept
Get an identifier for a pseudoknotted interaction, where opening and closing brackets of the same typ...
Definition: wuss.hpp:141
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
constexpr wuss() noexcept=default
Defaulted.
constexpr bool is_unpaired() const noexcept
Check whether the character represents an unpaired position in an RNA structure.
Definition: wuss.hpp:120
std::conditional_t< std::same_as< char_t, void >, char, char_t > char_type
The char representation; conditional needed to make semi alphabet definitions legal.
Definition: alphabet_base.hpp:96
constexpr auto alphabet_size
A type trait that holds the size of a (semi-)alphabet.
Definition: concept.hpp:858
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29