59template <u
int8_t SIZE = 51>
62 static_assert(SIZE >= 15 && SIZE <= 67 && SIZE % 2 == 1,
63 "The wuss<> alphabet size must be an odd number in range 15..67.");
84 constexpr wuss() noexcept = default;
85 constexpr
wuss(
wuss const &) noexcept = default;
87 constexpr
wuss & operator=(
wuss const &) noexcept = default;
88 constexpr
wuss & operator=(
wuss &&) noexcept = default;
89 ~
wuss() noexcept = default;
170 std::array<char_type, alphabet_size> chars{
'.',
':',
',',
'-',
'_',
'~',
';',
'<',
'(',
'[',
'{',
'>',
')',
177 chars[rnk] =
'A' +
off;
178 chars[rnk + 1u] =
'a' +
off;
212 int8_t cnt_close = 0;
214 for (
rank_type rnk = 0u; rnk <= 6u; ++rnk)
215 interaction_table[rnk] = 0;
217 for (
rank_type rnk = 7u; rnk <= 10u; ++rnk)
218 interaction_table[rnk] = --cnt_open;
220 for (
rank_type rnk = 11u; rnk <= 14u; ++rnk)
221 interaction_table[rnk] = ++cnt_close;
225 interaction_table[rnk] = --cnt_open;
226 interaction_table[rnk + 1u] = ++cnt_close;
229 return interaction_table;
240inline namespace literals
256constexpr wuss51 operator""_wuss51(
char const ch)
noexcept
277 for (
size_t idx = 0ul; idx < len; ++idx)
278 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:57
constexpr derived_type & assign_char(char_type const chr) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:163
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition: alphabet_base.hpp:137
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:80
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:199
constexpr char_type to_char() const noexcept
Return the letter as a character of char_type.
Definition: alphabet_base.hpp:115
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:72
rank_type rank
The value of the alphabet letter is stored as the rank.
Definition: alphabet_base.hpp:261
The WUSS structure alphabet of the characters .<>:,-_~;()[]{}AaBbCcDd...
Definition: wuss.hpp:61
friend base_t
Befriend seqan3::alphabet_base.
Definition: wuss.hpp:70
static constexpr uint8_t max_pseudoknot_depth
The ability of this alphabet to represent pseudoknots, i.e. crossing interactions,...
Definition: wuss.hpp:132
constexpr bool is_pair_close() const noexcept
Check whether the character represents a leftward interaction in an RNA structure.
Definition: wuss.hpp:111
constexpr bool is_pair_open() const noexcept
Check whether the character represents a rightward interaction in an RNA structure.
Definition: wuss.hpp:101
static constexpr std::array< char_type, alphabet_size > rank_to_char_table
The lookup table used in rank_to_char.
Definition: wuss.hpp:168
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:142
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition: alphabet_base.hpp:137
static constexpr rank_type char_to_rank(char_type const chr)
Returns the rank representation of character.
Definition: wuss.hpp:159
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:199
static constexpr char_type rank_to_char(rank_type const rank)
Returns the character representation of rank.
Definition: wuss.hpp:153
static constexpr std::array< int8_t, SIZE > interaction_tab
Lookup table for interactions: unpaired (0), pair-open (< 0), pair-close (> 0). Paired brackets have ...
Definition: wuss.hpp:205
constexpr wuss() noexcept=default
Defaulted.
static constexpr std::array< rank_type, 256 > char_to_rank_table
The lookup table used in char_to_rank.
Definition: wuss.hpp:187
constexpr bool is_unpaired() const noexcept
Check whether the character represents an unpaired position in an RNA structure.
Definition: wuss.hpp:121
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
@ off
Automatic update notifications should be disabled.