Loading...
Searching...
No Matches
structured_rna.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <seqan3/alphabet/composite/alphabet_tuple_base.hpp>
#include <seqan3/alphabet/nucleotide/concept.hpp>
#include <seqan3/alphabet/structure/concept.hpp>
namespace seqan3
{
template <nucleotide_alphabet sequence_alphabet_t, rna_structure_alphabet structure_alphabet_t>
requires writable_alphabet<sequence_alphabet_t> && writable_alphabet<structure_alphabet_t>
class structured_rna :
public alphabet_tuple_base<structured_rna<sequence_alphabet_t, structure_alphabet_t>,
sequence_alphabet_t,
structure_alphabet_t>
{
private:
using base_type = alphabet_tuple_base<structured_rna<sequence_alphabet_t, structure_alphabet_t>,
sequence_alphabet_t,
structure_alphabet_t>;
public:
using sequence_alphabet_type = sequence_alphabet_t;
using structure_alphabet_type = structure_alphabet_t;
using char_type = alphabet_char_t<sequence_alphabet_type>;
constexpr structured_rna() noexcept = default;
constexpr structured_rna(structured_rna const &) noexcept = default;
constexpr structured_rna(structured_rna &&) noexcept = default;
constexpr structured_rna & operator=(structured_rna const &) noexcept = default;
constexpr structured_rna & operator=(structured_rna &&) noexcept = default;
~structured_rna() noexcept = default;
using base_type::base_type; // Inherit non-default constructors
#if SEQAN3_DOXYGEN_ONLY(1) 0
constexpr structured_rna(component_type const alph) noexcept
{}
constexpr structured_rna(indirect_component_type const alph) noexcept
{}
constexpr structured_rna & operator=(component_type const alph) noexcept
{}
constexpr structured_rna & operator=(indirect_component_type const alph) noexcept
{}
#endif // SEQAN3_DOXYGEN_ONLY
// Inherit operators from base
using base_type::operator=;
constexpr structured_rna & assign_char(char_type const c) noexcept
{
seqan3::assign_char_to(c, get<0>(*this));
return *this;
}
constexpr char_type to_char() const noexcept
{
return seqan3::to_char(get<0>(*this));
}
constexpr structured_rna complement() const noexcept
{
return structured_rna{get<0>(*this).complement(), get<1>(*this)};
}
static constexpr bool char_is_valid(char_type const c) noexcept
{
return char_is_valid_for<sequence_alphabet_type>(c);
}
constexpr bool is_pair_open() const noexcept
{
return get<1>(*this).is_pair_open();
};
constexpr bool is_pair_close() const noexcept
{
return get<1>(*this).is_pair_close();
};
constexpr bool is_unpaired() const noexcept
{
return get<1>(*this).is_unpaired();
};
static constexpr uint8_t max_pseudoknot_depth{structure_alphabet_t::max_pseudoknot_depth};
constexpr std::optional<uint8_t> pseudoknot_id() const noexcept
{
return get<1>(*this).pseudoknot_id();
};
};
template <typename sequence_alphabet_type, typename structure_alphabet_type>
structured_rna(sequence_alphabet_type &&, structure_alphabet_type &&)
-> structured_rna<std::decay_t<sequence_alphabet_type>, std::decay_t<structure_alphabet_type>>;
} // namespace seqan3
concept.hpp
Provides seqan3::nucleotide_alphabet.
concept.hpp
Provides seqan3::rna_structure_alphabet.
alphabet_tuple_base.hpp
Provides seqan3::alphabet_tuple_base.
seqan3::alphabet_tuple_base< structured_rna< sequence_alphabet_t, structure_alphabet_t >, sequence_alphabet_t, structure_alphabet_t >::get
friend constexpr auto get(alphabet_tuple_base &l) noexcept
Definition alphabet_tuple_base.hpp:345
seqan3::structured_rna::is_unpaired
constexpr bool is_unpaired() const noexcept
Check whether the character represents an unpaired position in an RNA structure.
Definition structured_rna.hpp:213
seqan3::structured_rna::is_pair_open
constexpr bool is_pair_open() const noexcept
Check whether the character represents a rightward interaction in an RNA structure.
Definition structured_rna.hpp:193
seqan3::structured_rna::complement
constexpr structured_rna complement() const noexcept
Return a structured_rna where the sequence letter is converted to its complement.
Definition structured_rna.hpp:170
seqan3::structured_rna::assign_char
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
seqan3::structured_rna::operator=
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
seqan3::structured_rna::structured_rna
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
seqan3::structured_rna::to_char
constexpr char_type to_char() const noexcept
Return a character. This reads the internal sequence letter.
Definition structured_rna.hpp:153
seqan3::structured_rna::structured_rna
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.
seqan3::structured_rna::char_is_valid
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
seqan3::structured_rna::structured_rna
constexpr structured_rna() noexcept=default
Defaulted.
seqan3::structured_rna::operator=
constexpr structured_rna & operator=(component_type const alph) noexcept
Assignment via a value of one of the components.
Definition structured_rna.hpp:115
seqan3::structured_rna::sequence_alphabet_type
sequence_alphabet_t sequence_alphabet_type
First template parameter as member type.
Definition structured_rna.hpp:65
seqan3::structured_rna::structured_rna
constexpr structured_rna(component_type const alph) noexcept
Construction via a value of one of the components.
Definition structured_rna.hpp:97
seqan3::structured_rna::char_type
alphabet_char_t< sequence_alphabet_type > char_type
Equals the char_type of sequence_alphabet_type.
Definition structured_rna.hpp:76
seqan3::structured_rna::pseudoknot_id
constexpr std::optional< uint8_t > pseudoknot_id() const noexcept
Get an identifier for a pseudoknotted interaction.
Definition structured_rna.hpp:228
seqan3::structured_rna::is_pair_close
constexpr bool is_pair_close() const noexcept
Check whether the character represents a leftward interaction in an RNA structure.
Definition structured_rna.hpp:203
seqan3::structured_rna< _seq_alphabet, _structure_alphabet >::max_pseudoknot_depth
static constexpr uint8_t max_pseudoknot_depth
Definition structured_rna.hpp:219
seqan3::structured_rna::structure_alphabet_type
structure_alphabet_t structure_alphabet_type
Second template parameter as member type.
Definition structured_rna.hpp:70
std::decay_t
seqan3::assign_char_to
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition alphabet/concept.hpp:517
seqan3::to_char
constexpr auto to_char
Return the char representation of an alphabet object.
Definition alphabet/concept.hpp:381
seqan3::alphabet_char_t
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:393
seqan3::char_is_valid_for
constexpr auto char_is_valid_for
Returns whether a character is in the valid set of a seqan3::alphabet (usually implies a bijective ma...
Definition alphabet/concept.hpp:661
seqan3
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
std::optional
Hide me