SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
seqan3::dot_bracket3 Class Reference

The three letter RNA structure alphabet of the characters ".()". More...

#include <seqan3/alphabet/structure/dot_bracket3.hpp>

+ Inheritance diagram for seqan3::dot_bracket3:

Public Member Functions

Constructors, destructor and assignment
constexpr dot_bracket3 () noexcept=default
 Defaulted.
 
constexpr dot_bracket3 (dot_bracket3 const &) noexcept=default
 Defaulted.
 
constexpr dot_bracket3 (dot_bracket3 &&) noexcept=default
 Defaulted.
 
constexpr dot_bracket3operator= (dot_bracket3 const &) noexcept=default
 Defaulted.
 
constexpr dot_bracket3operator= (dot_bracket3 &&) noexcept=default
 Defaulted.
 
 ~dot_bracket3 () noexcept=default
 
Read functions
constexpr char_type to_char () const noexcept
 Return the letter as a character of char_type. More...
 
constexpr rank_type to_rank () const noexcept
 Return the letter's numeric value (rank in the alphabet). More...
 
Write functions
constexpr dot_bracket3assign_char (char_type const c) noexcept
 Assign from a character, implicitly converts invalid characters. More...
 
constexpr dot_bracket3assign_rank (rank_type const c) noexcept
 Assign from a numeric value. More...
 

Static Public Attributes

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.
 

Protected Types

Member types
using char_type = std::conditional_t< std::same_as< char, void >, char, char >
 The char representation; conditional needed to make semi alphabet definitions legal.
 
using rank_type = detail::min_viable_uint_t< size - 1 >
 The type of the alphabet when represented as a number (e.g. via to_rank()).
 

Related Functions

(Note that these are not member functions.)

Literals
std::vector< dot_bracket3operator""_db3 (const char *str, std::size_t len)
 The seqan3::db3 string literal. More...
 
constexpr dot_bracket3 operator""_db3 (char const ch) noexcept
 The seqan3::db3 char literal. More...
 
Requirements for std::totally_ordered

You can expect these functions on all types that implement std::totally_ordered.

bool operator< (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
bool operator<= (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
bool operator> (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
bool operator>= (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
Requirements for std::equality_comparable

You can expect these functions on all types that implement std::Equality_comparable.

bool operator== (type const &lhs, type const &rhs)
 (In-)Equality comparison. More...
 
bool operator!= (type const &lhs, type const &rhs)
 (In-)Equality comparison. More...
 
Requirements for std::swappable

You can expect these functions on all types that implement std::swappable.

void swap (t &lhs, t &rhs)
 Swaps the contents of two objects. More...
 

RNA structure properties

static constexpr uint8_t max_pseudoknot_depth {1u}
 The ability of this alphabet to represent pseudoknots, i.e. crossing interactions, up to a certain depth. More...
 
constexpr bool is_pair_open () const noexcept
 Check whether the character represents a rightward interaction in an RNA structure. More...
 
constexpr bool is_pair_close () const noexcept
 Check whether the character represents a leftward interaction in an RNA structure. More...
 
constexpr bool is_unpaired () const noexcept
 Check whether the character represents an unpaired position in an RNA structure. More...
 
constexpr std::optional< uint8_t > pseudoknot_id () const noexcept
 Get an identifier for a pseudoknotted interaction, where opening and closing brackets of the same type have the same id. More...
 

Detailed Description

The three letter RNA structure alphabet of the characters ".()".

The brackets denote RNA base pair interactions. Every left bracket must have a corresponding right bracket. Pseudoknots cannot be expressed in this format. A dot (.) represents a character that is not paired.

GCGGAUUUAGCUCAGUUGGGAGAGCGCCAGACUGAAGAUUUGGAGGUCCUGUGUUCGAUCCACAGAAUUCGCA
(((((((..((((........)))).((((.........)))).....(((((.......)))))))))))).

Usage

The following code example creates a dot_bracket3 vector, modifies it, and prints the result to stderr.

#include <vector>
int main()
{
using seqan3::operator""_db3;
// create vector
std::vector<seqan3::dot_bracket3> vec{'.'_db3, ')'_db3, ')'_db3};
// modify and print
vec[1] = '('_db3;
for (seqan3::dot_bracket3 chr : vec)
}

Constructor & Destructor Documentation

◆ ~dot_bracket3()

seqan3::dot_bracket3::~dot_bracket3 ( )
defaultnoexcept

Defaulted.

Member Function Documentation

◆ assign_char()

constexpr dot_bracket3 & seqan3::alphabet_base< dot_bracket3 , size, char >::assign_char ( char_type const  c)
inlineconstexprnoexceptinherited

Assign from a character, implicitly converts invalid characters.

Parameters
cThe character to be assigned.

Provides an implementation for seqan3::assign_char_to, required to model seqan3::alphabet.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ assign_rank()

constexpr dot_bracket3 & seqan3::alphabet_base< dot_bracket3 , size, char >::assign_rank ( rank_type const  c)
inlineconstexprnoexceptinherited

Assign from a numeric value.

Parameters
cThe rank to be assigned.

Provides an implementation for seqan3::assign_rank_to, required to model seqan3::semialphabet.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ is_pair_close()

constexpr bool seqan3::dot_bracket3::is_pair_close ( ) const
inlineconstexprnoexcept

Check whether the character represents a leftward interaction in an RNA structure.

Returns
True if the letter represents a leftward interaction, False otherwise.

◆ is_pair_open()

constexpr bool seqan3::dot_bracket3::is_pair_open ( ) const
inlineconstexprnoexcept

Check whether the character represents a rightward interaction in an RNA structure.

Returns
True if the letter represents a rightward interaction, False otherwise.

◆ is_unpaired()

constexpr bool seqan3::dot_bracket3::is_unpaired ( ) const
inlineconstexprnoexcept

Check whether the character represents an unpaired position in an RNA structure.

Returns
True if the letter represents an unpaired site, False otherwise.

◆ pseudoknot_id()

constexpr std::optional<uint8_t> seqan3::dot_bracket3::pseudoknot_id ( ) const
inlineconstexprnoexcept

Get an identifier for a pseudoknotted interaction, where opening and closing brackets of the same type have the same id.

Returns
The pseudoknot id (always 0) if alph denotes an interaction, and no value otherwise.

◆ to_char()

constexpr char_type seqan3::alphabet_base< dot_bracket3 , size, char >::to_char ( ) const
inlineconstexprnoexceptinherited

Return the letter as a character of char_type.

Provides an implementation for seqan3::to_char, required to model seqan3::alphabet.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ to_rank()

constexpr rank_type seqan3::alphabet_base< dot_bracket3 , size, char >::to_rank ( ) const
inlineconstexprnoexceptinherited

Return the letter's numeric value (rank in the alphabet).

Provides an implementation for seqan3::to_rank, required to model seqan3::semialphabet.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

Friends And Related Function Documentation

◆ operator""_db3() [1/2]

constexpr dot_bracket3 operator""_db3 ( char const  ch)
related

The seqan3::db3 char literal.

Parameters
[in]chThe character to represent as dot bracket.
Returns
seqan3::dot_bracket3

You can use this string literal to assign a seqan3::dot_bracket3 character:

int main()
{
using seqan3::operator""_db3;
// Using the char literal to assign a single dot bracket:
seqan3::dot_bracket3 my_letter{'('_db3};
my_letter.assign_char(')'); // <- assigns the char explicitly
}

◆ operator""_db3() [2/2]

std::vector< dot_bracket3 > operator""_db3 ( const char *  str,
std::size_t  len 
)
related

The seqan3::db3 string literal.

Parameters
[in]strA pointer to the character string to assign.
[in]lenThe size of the character string to assign.
Returns
std::vector<seqan3::dot_bracket3>

You can use this string literal to easily assign to a vector of seqan3::dot_bracket3 characters:

#include <vector>
int main()
{
using seqan3::operator""_db3;
// Using the string literal to assign a vector of dot brackets:
auto bax = ".(..)."_db3;
}

Member Data Documentation

◆ max_pseudoknot_depth

constexpr uint8_t seqan3::dot_bracket3::max_pseudoknot_depth {1u}
staticconstexpr

The ability of this alphabet to represent pseudoknots, i.e. crossing interactions, up to a certain depth.

It is the number of distinct pairs of interaction symbols the format supports. The value 1 denotes no pseudoknot support.


The documentation for this class was generated from the following file:
debug_stream.hpp
Provides seqan3::debug_stream and related types.
vector
seqan3::to_char
constexpr auto to_char
Return the char representation of an alphabet object.
Definition: concept.hpp:320
seqan3::alphabet_base::assign_char
constexpr derived_type & assign_char(char_type const c) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:140
dot_bracket3.hpp
Provides the dot bracket format for RNA structure.
seqan3::dot_bracket3
The three letter RNA structure alphabet of the characters ".()".
Definition: dot_bracket3.hpp:51
seqan3::debug_stream
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition: debug_stream.hpp:39