56template <u
int8_t SIZE = 51>
59 static_assert(SIZE >= 15 && SIZE <= 67 && SIZE % 2 == 1,
60 "The wuss<> alphabet size must be an odd number in range 15..67.");
81 constexpr wuss() noexcept = default;
82 constexpr
wuss(
wuss const &) noexcept = default;
84 constexpr
wuss & operator=(
wuss const &) noexcept = default;
85 constexpr
wuss & operator=(
wuss &&) noexcept = default;
86 ~
wuss() noexcept = default;
100 return interaction_tab[
to_rank()] < 0;
110 return interaction_tab[
to_rank()] > 0;
120 return interaction_tab[
to_rank()] == 0;
141 if (interaction_tab[
to_rank()] != 0)
142 return std::abs(interaction_tab[
to_rank()]) - 1;
152 return rank_to_char_table[rank];
159 return char_to_rank_table[
static_cast<index_t
>(chr)];
163 static constexpr std::array<char_type, alphabet_size> rank_to_char_table{
166 std::array<char_type, alphabet_size>
167 chars{
'.',
':',
',',
'-',
'_',
'~',
';',
'<',
'(',
'[',
'{',
'>',
')',
']',
'}'};
173 chars[rnk] =
'A' +
off;
174 chars[rnk + 1u] =
'a' +
off;
181 static constexpr std::array<rank_type, 256> char_to_rank_table{[]()
constexpr
183 std::array<rank_type, 256> rank_table{};
190 rank_table[rank_to_char_table[rnk]] = rnk;
198 static constexpr std::array<int8_t, SIZE> interaction_tab{
204 std::array<int8_t, alphabet_size> interaction_table{};
206 int8_t cnt_close = 0;
208 for (
rank_type rnk = 0u; rnk <= 6u; ++rnk)
209 interaction_table[rnk] = 0;
211 for (
rank_type rnk = 7u; rnk <= 10u; ++rnk)
212 interaction_table[rnk] = --cnt_open;
214 for (
rank_type rnk = 11u; rnk <= 14u; ++rnk)
215 interaction_table[rnk] = ++cnt_close;
219 interaction_table[rnk] = --cnt_open;
220 interaction_table[rnk + 1u] = ++cnt_close;
223 return interaction_table;
248constexpr wuss51 operator""_wuss51(
char const ch)
noexcept
250 return wuss51{}.assign_char(ch);
269 for (
size_t idx = 0ul; idx < len; ++idx)
Provides seqan3::rna_structure_alphabet.
Provides seqan3::alphabet_base.
constexpr wuss< SIZE > & assign_char(char_type const chr) noexcept
Definition alphabet_base.hpp:160
constexpr alphabet_base() noexcept=default
constexpr rank_type to_rank() const noexcept
Definition alphabet_base.hpp:134
detail::min_viable_uint_t< size - 1 > rank_type
Definition alphabet_base.hpp:77
static constexpr detail::min_viable_uint_t< size > alphabet_size
Definition alphabet_base.hpp:196
constexpr char_type to_char() const noexcept
Definition alphabet_base.hpp:112
std::conditional_t< std::same_as< char, void >, char, char > char_type
Definition alphabet_base.hpp:69
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition alphabet_base.hpp:134
static constexpr detail::min_viable_uint_t< size > alphabet_size
static constexpr uint8_t max_pseudoknot_depth
Definition wuss.hpp:129
constexpr bool is_pair_close() const noexcept
Check whether the character represents a leftward interaction in an RNA structure.
Definition wuss.hpp:108
constexpr bool is_pair_open() const noexcept
Definition wuss.hpp:98
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:139
wuss< 51 > wuss51
Alias for the default type wuss51.
Definition wuss.hpp:230
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:118
The SeqAn namespace for literals.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
@ off
Automatic update notifications should be disabled.
Definition auxiliary.hpp:270