SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
structured_rna.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
15
16namespace seqan3
17{
18
47template <nucleotide_alphabet sequence_alphabet_t, rna_structure_alphabet structure_alphabet_t>
50 public alphabet_tuple_base<structured_rna<sequence_alphabet_t, structure_alphabet_t>,
51 sequence_alphabet_t,
52 structure_alphabet_t>
53{
54private:
57 sequence_alphabet_t,
58 structure_alphabet_t>;
59
60public:
65 using sequence_alphabet_type = sequence_alphabet_t;
70 using structure_alphabet_type = structure_alphabet_t;
71
77
81 constexpr structured_rna() noexcept = default;
82 constexpr structured_rna(structured_rna const &) noexcept = default;
83 constexpr structured_rna(structured_rna &&) noexcept = default;
84 constexpr structured_rna & operator=(structured_rna const &) noexcept = default;
85 constexpr structured_rna & operator=(structured_rna &&) noexcept = default;
86 ~structured_rna() noexcept = default;
87
88 using base_type::base_type; // Inherit non-default constructors
89
90#if SEQAN3_DOXYGEN_ONLY(1) 0
97 constexpr structured_rna(component_type const alph) noexcept
98 {}
99
106 constexpr structured_rna(indirect_component_type const alph) noexcept
107 {}
108
115 constexpr structured_rna & operator=(component_type const alph) noexcept
116 {}
117
124 constexpr structured_rna & operator=(indirect_component_type const alph) noexcept
125 {}
126#endif // SEQAN3_DOXYGEN_ONLY
128
129 // Inherit operators from base
130 using base_type::operator=;
131
134
139 constexpr structured_rna & assign_char(char_type const c) noexcept
140 {
141 seqan3::assign_char_to(c, get<0>(*this));
142 return *this;
143 }
145
148
153 constexpr char_type to_char() const noexcept
154 {
155 return seqan3::to_char(get<0>(*this));
156 }
157
170 constexpr structured_rna complement() const noexcept
171 {
172 return structured_rna{get<0>(*this).complement(), get<1>(*this)};
173 }
175
180 static constexpr bool char_is_valid(char_type const c) noexcept
181 {
182 return char_is_valid_for<sequence_alphabet_type>(c);
183 }
184
187
193 constexpr bool is_pair_open() const noexcept
194 {
195 return get<1>(*this).is_pair_open();
196 };
197
203 constexpr bool is_pair_close() const noexcept
204 {
205 return get<1>(*this).is_pair_close();
206 };
207
213 constexpr bool is_unpaired() const noexcept
214 {
215 return get<1>(*this).is_unpaired();
216 };
217
219 static constexpr uint8_t max_pseudoknot_depth{structure_alphabet_t::max_pseudoknot_depth};
220
228 constexpr std::optional<uint8_t> pseudoknot_id() const noexcept
229 {
230 return get<1>(*this).pseudoknot_id();
231 };
233};
234
237template <typename sequence_alphabet_type, typename structure_alphabet_type>
240
241} // namespace seqan3
Provides seqan3::nucleotide_alphabet.
Provides seqan3::rna_structure_alphabet.
Provides seqan3::alphabet_tuple_base.
The CRTP base for a combined alphabet that contains multiple values of different alphabets at the sam...
Definition alphabet_tuple_base.hpp:113
A seqan3::alphabet_tuple_base that joins a nucleotide alphabet with an RNA structure alphabet.
Definition structured_rna.hpp:53
constexpr bool is_unpaired() const noexcept
Check whether the character represents an unpaired position in an RNA structure.
Definition structured_rna.hpp:213
constexpr bool is_pair_open() const noexcept
Check whether the character represents a rightward interaction in an RNA structure.
Definition structured_rna.hpp:193
constexpr structured_rna complement() const noexcept
Return a structured_rna where the sequence letter is converted to its complement.
Definition structured_rna.hpp:170
constexpr structured_rna & assign_char(char_type const c) noexcept
Assign from a nucleotide character. This modifies the internal sequence letter.
Definition structured_rna.hpp:139
constexpr structured_rna & operator=(indirect_component_type const alph) noexcept
Assignment via a value of a subtype that is assignable to one of the components.
Definition structured_rna.hpp:124
constexpr structured_rna(indirect_component_type const alph) noexcept
Construction via a value of a subtype that is assignable to one of the components.
Definition structured_rna.hpp:106
constexpr char_type to_char() const noexcept
Return a character. This reads the internal sequence letter.
Definition structured_rna.hpp:153
structured_rna(sequence_alphabet_type &&, structure_alphabet_type &&) -> structured_rna< std::decay_t< sequence_alphabet_type >, std::decay_t< structure_alphabet_type > >
Type deduction guide enables usage of structured_rna without specifying template args.
static constexpr bool char_is_valid(char_type const c) noexcept
Validate whether a character is valid in the sequence alphabet.
Definition structured_rna.hpp:180
constexpr structured_rna() noexcept=default
Defaulted.
constexpr structured_rna & operator=(component_type const alph) noexcept
Assignment via a value of one of the components.
Definition structured_rna.hpp:115
sequence_alphabet_t sequence_alphabet_type
First template parameter as member type.
Definition structured_rna.hpp:65
constexpr structured_rna(component_type const alph) noexcept
Construction via a value of one of the components.
Definition structured_rna.hpp:97
alphabet_char_t< sequence_alphabet_type > char_type
Equals the char_type of sequence_alphabet_type.
Definition structured_rna.hpp:76
constexpr std::optional< uint8_t > pseudoknot_id() const noexcept
Get an identifier for a pseudoknotted interaction.
Definition structured_rna.hpp:228
constexpr bool is_pair_close() const noexcept
Check whether the character represents a leftward interaction in an RNA structure.
Definition structured_rna.hpp:203
static constexpr uint8_t max_pseudoknot_depth
The ability of this alphabet to represent pseudoknots, i.e. crossing interactions.
Definition structured_rna.hpp:219
structure_alphabet_t structure_alphabet_type
Second template parameter as member type.
Definition structured_rna.hpp:70
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition alphabet/concept.hpp:521
constexpr auto to_char
Return the char representation of an alphabet object.
Definition alphabet/concept.hpp:383
decltype(seqan3::to_char(std::declval< alphabet_type const >())) alphabet_char_t
The char_type of the alphabet; defined as the return type of seqan3::to_char.
Definition alphabet/concept.hpp:397
Refines seqan3::alphabet and adds assignability.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Hide me