SeqAn3 3.1.0
The Modern C++ library for sequence analysis.
structured_rna.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2021, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6// -----------------------------------------------------------------------------------------------------
7
13#pragma once
14
18
19namespace seqan3
20{
21
50template <nucleotide_alphabet sequence_alphabet_t, rna_structure_alphabet structure_alphabet_t>
55 public alphabet_tuple_base<structured_rna<sequence_alphabet_t, structure_alphabet_t>,
56 sequence_alphabet_t, structure_alphabet_t>
57{
58private:
61 sequence_alphabet_t, structure_alphabet_t>;
62public:
67 using sequence_alphabet_type = sequence_alphabet_t;
72 using structure_alphabet_type = structure_alphabet_t;
73
79
83 constexpr structured_rna() noexcept = default;
84 constexpr structured_rna(structured_rna const &) noexcept = default;
85 constexpr structured_rna(structured_rna &&) noexcept = default;
86 constexpr structured_rna & operator =(structured_rna const &) noexcept = default;
87 constexpr structured_rna & operator =(structured_rna &&) noexcept = default;
88 ~structured_rna() noexcept = default;
89
90 using base_type::base_type; // Inherit non-default constructors
91
92#if SEQAN3_DOXYGEN_ONLY(1)0
99 constexpr structured_rna(component_type const alph) noexcept {}
100
107 constexpr structured_rna(indirect_component_type const alph) noexcept {}
108
115 constexpr structured_rna & operator=(component_type const alph) noexcept {}
116
123 constexpr structured_rna & operator=(indirect_component_type const alph) noexcept {}
124#endif // SEQAN3_DOXYGEN_ONLY
126
127 // Inherit operators from base
128 using base_type::operator=;
129
132
137 constexpr structured_rna & assign_char(char_type const c) noexcept
138 {
139 seqan3::assign_char_to(c, get<0>(*this));
140 return *this;
141 }
143
146
151 constexpr char_type to_char() const noexcept
152 {
153 return seqan3::to_char(get<0>(*this));
154 }
155
168 constexpr structured_rna complement() const noexcept
169 {
170 return structured_rna{get<0>(*this).complement(), get<1>(*this)};
171 }
173
178 static constexpr bool char_is_valid(char_type const c) noexcept
179 {
180 return char_is_valid_for<sequence_alphabet_type>(c);
181 }
182
185
191 constexpr bool is_pair_open() const noexcept
192 {
193 return get<1>(*this).is_pair_open();
194 };
195
201 constexpr bool is_pair_close() const noexcept
202 {
203 return get<1>(*this).is_pair_close();
204 };
205
211 constexpr bool is_unpaired() const noexcept
212 {
213 return get<1>(*this).is_unpaired();
214 };
215
218
226 constexpr std::optional<uint8_t> pseudoknot_id() const noexcept
227 {
228 return get<1>(*this).pseudoknot_id();
229 };
231};
232
235template <typename sequence_alphabet_type, typename structure_alphabet_type>
238
239} // 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:124
A seqan3::alphabet_tuple_base that joins a nucleotide alphabet with an RNA structure alphabet....
Definition: structured_rna.hpp:57
constexpr bool is_unpaired() const noexcept
Check whether the character represents an unpaired position in an RNA structure.
Definition: structured_rna.hpp:211
constexpr bool is_pair_open() const noexcept
Check whether the character represents a rightward interaction in an RNA structure.
Definition: structured_rna.hpp:191
constexpr structured_rna complement() const noexcept
Return a structured_rna where the sequence letter is converted to its complement.
Definition: structured_rna.hpp:168
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:137
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:123
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:107
constexpr char_type to_char() const noexcept
Return a character. This reads the internal sequence letter.
Definition: structured_rna.hpp:151
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:178
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:67
constexpr structured_rna(component_type const alph) noexcept
Construction via a value of one of the components.
Definition: structured_rna.hpp:99
alphabet_char_t< sequence_alphabet_type > char_type
Equals the char_type of sequence_alphabet_type.
Definition: structured_rna.hpp:78
constexpr std::optional< uint8_t > pseudoknot_id() const noexcept
Get an identifier for a pseudoknotted interaction.
Definition: structured_rna.hpp:226
constexpr bool is_pair_close() const noexcept
Check whether the character represents a leftward interaction in an RNA structure.
Definition: structured_rna.hpp:201
static constexpr uint8_t max_pseudoknot_depth
The ability of this alphabet to represent pseudoknots, i.e. crossing interactions.
Definition: structured_rna.hpp:217
structure_alphabet_t structure_alphabet_type
Second template parameter as member type.
Definition: structured_rna.hpp:72
constexpr auto max_pseudoknot_depth
A type trait that holds the ability of the structure alphabet to represent pseudoknots,...
Definition: concept.hpp:388
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition: concept.hpp:526
constexpr auto to_char
Return the char representation of an alphabet object.
Definition: concept.hpp:387
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: concept.hpp:399
Refines seqan3::alphabet and adds assignability.
The main SeqAn3 namespace.
Definition: cigar_operation_table.hpp:2