Loading...
Searching...
No Matches
Structure
Alphabet

Provides types to represent single elements of RNA and protein structures. More...

Collaboration diagram for Structure:

## Classes

class | seqan3::dot_bracket3
| The three letter RNA structure alphabet of the characters ".()". More...
class | seqan3::dssp9
| The protein structure alphabet of the characters "HGIEBTSCX". More...
interface | rna_structure_alphabet
| A concept that indicates whether an alphabet represents RNA structure. More...
class | seqan3::structured_aa< sequence_alphabet_t, structure_alphabet_t >
| A seqan3::alphabet_tuple_base that joins an aminoacid alphabet with a protein structure alphabet. More...
class | seqan3::structured_rna< sequence_alphabet_t, structure_alphabet_t >
| A seqan3::alphabet_tuple_base that joins a nucleotide alphabet with an RNA structure alphabet. More...
class | seqan3::wuss< SIZE >
| The WUSS structure alphabet of the characters .<>:,-_~;()[]{}AaBbCcDd... More...

## Variables

constexpr auto | seqan3::is_pair_close = detail::adl_only::is_pair_close_cpo{}
| Check whether the given character represents a leftward interaction in an RNA structure.
constexpr auto | seqan3::is_pair_open = detail::adl_only::is_pair_open_cpo{}
| Check whether the given character represents a rightward interaction in an RNA structure.
constexpr auto | seqan3::is_unpaired = detail::adl_only::is_unpaired_cpo{}
| Check whether the given character represents an unpaired nucleotide in an RNA structure.
template<typename alph_t>
constexpr auto | seqan3::max_pseudoknot_depth = detail::adl_only::max_pseudoknot_depth_cpo<alph_t>{}()
| A type trait that holds the ability of the structure alphabet to represent pseudoknots, i.e. crossing interactions, up to a certain depth.
constexpr auto | seqan3::pseudoknot_id = detail::adl_only::pseudoknot_id_cpo{}
| Retrieve an id for the level of a pseudoknotted interaction (also known as 'page number').

## Detailed Description

Provides types to represent single elements of RNA and protein structures.

See also
  alphabet

The following alphabets are currently supported in SeqAn. Please see the format's page for more details.

Name | Chars | Description
--- | --- | ---
Dot Bracket | (). | Simple annotation that defines base pairs. No pseudoknots allowed.
WUSS | .<>:,-_~;()[]{}AaBb... | Annotation that provides further markups and pseudoknots.
DSSP | HBEGITSCX | Structure encoding for proteins.

## Variable Documentation

## is_pair_close

auto seqan3::is_pair_close = detail::adl_only::is_pair_close_cpo{}

inline constexpr

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

Template Parameters

  your_type | Type of the argument.

Parameters

  chr | The RNA structure character whose property is checked.

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

This is a function object. Invoke it with the parameter(s) specified above.

It acts as a wrapper and looks for three possible implementations (in this order):

1. A static member function is_pair_close(your_type const a) of the class seqan3::custom::alphabet<your_type>.
2. A free function is_pair_close(your_type const a) in the namespace of your type (or as friend).
3. A member function called is_pair_close().

Functions are only considered for one of the above cases if they are marked noexcept (constexpr is not required, but recommended) and if the returned type is bool.

Every RNA structure alphabet type must provide one of the above.

### Example

// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
#include <iostream>
#include <seqan3/alphabet/structure/wuss.hpp>
int main()
{
using namespace seqan3::literals;
bool is_closing_char_member = '}'_wuss51.is_pair_close();
bool is_closing_char_free = seqan3::is_pair_close('.'_wuss51);
std::cout << std::boolalpha << is_closing_char_member << '\n'; // true
std::cout << std::boolalpha << is_closing_char_free << '\n'; // false
}
std::boolalpha
T boolalpha(T... args)
std::cout
seqan3::is_pair_close
constexpr auto is_pair_close
Check whether the given character represents a leftward interaction in an RNA structure.
Definition alphabet/structure/concept.hpp:179
iostream
seqan3::literals
The SeqAn namespace for literals.
wuss.hpp
Provides the WUSS format for RNA structure.

### Customisation point

This is a customisation point (see Customisation). To specify the behaviour for your own alphabet type, simply provide one of the three functions specified above.

This entity is experimental and subject to change in the future. Experimental since version 3.1.

## is_pair_open

auto seqan3::is_pair_open = detail::adl_only::is_pair_open_cpo{}

inline constexpr

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

Template Parameters

  your_type | Type of the argument.

Parameters

  chr | The RNA structure character whose property is checked.

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

This is a function object. Invoke it with the parameter(s) specified above.

It acts as a wrapper and looks for three possible implementations (in this order):

1. A static member function is_pair_open(your_type const a) of the class seqan3::custom::alphabet<your_type>.
2. A free function is_pair_open(your_type const a) in the namespace of your type (or as friend).
3. A member function called is_pair_open().

Functions are only considered for one of the above cases if they are marked noexcept (constexpr is not required, but recommended) and if the returned type is bool.

Every RNA structure alphabet type must provide one of the above.

### Example

// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
#include <iostream>
#include <seqan3/alphabet/structure/wuss.hpp>
int main()
{
using namespace seqan3::literals;
bool is_opening_char_member = '{'_wuss51.is_pair_open();
bool is_opening_char_free = seqan3::is_pair_open('.'_wuss51);
std::cout << std::boolalpha << is_opening_char_member << '\n'; // true
std::cout << std::boolalpha << is_opening_char_free << '\n'; // false
}
seqan3::is_pair_open
constexpr auto is_pair_open
Check whether the given character represents a rightward interaction in an RNA structure.
Definition alphabet/structure/concept.hpp:97

### Customisation point

This is a customisation point (see Customisation). To specify the behaviour for your own alphabet type, simply provide one of the three functions specified above.

This entity is experimental and subject to change in the future. Experimental since version 3.1.

## is_unpaired

auto seqan3::is_unpaired = detail::adl_only::is_unpaired_cpo{}

inline constexpr

Check whether the given character represents an unpaired nucleotide in an RNA structure.

Template Parameters

  your_type | Type of the argument.

Parameters

  chr | The RNA structure character whose property is checked.

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

This is a function object. Invoke it with the parameter(s) specified above.

It acts as a wrapper and looks for three possible implementations (in this order):

1. A static member function is_unpaired(your_type const a) of the class seqan3::custom::alphabet<your_type>.
2. A free function is_unpaired(your_type const a) in the namespace of your type (or as friend).
3. A member function called is_unpaired().

Functions are only considered for one of the above cases if they are marked noexcept (constexpr is not required, but recommended) and if the returned type is bool.

Every RNA structure alphabet type must provide one of the above.

### Example

// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
#include <iostream>
#include <seqan3/alphabet/structure/wuss.hpp>
int main()
{
using namespace seqan3::literals;
bool is_unpaired_char_member = '.'_wuss51.is_unpaired();
bool is_unpaired_char_free = seqan3::is_unpaired('{'_wuss51);
std::cout << std::boolalpha << is_unpaired_char_member << '\n'; // true
std::cout << std::boolalpha << is_unpaired_char_free << '\n'; // false
}
seqan3::is_unpaired
constexpr auto is_unpaired
Check whether the given character represents an unpaired nucleotide in an RNA structure.
Definition alphabet/structure/concept.hpp:261

### Customisation point

This is a customisation point (see Customisation). To specify the behaviour for your own alphabet type, simply provide one of the three functions specified above.

This entity is experimental and subject to change in the future. Experimental since version 3.1.

## max_pseudoknot_depth

template<typename alph_t>

auto seqan3::max_pseudoknot_depth = detail::adl_only::max_pseudoknot_depth_cpo<alph_t>{}()

inline constexpr

A type trait that holds the ability of the structure alphabet to represent pseudoknots, i.e. crossing interactions, up to a certain depth.

Template Parameters

  your_type | Type of the argument.

Parameters

  chr | The RNA structure character whose property is checked.

Returns
  The maximum supported nestedness, or 1 if the alphabet cannot support pseudoknots.

The value is the maximum allowed depth of pseudoknots. A value of 1 denotes no pseudoknots ((....)), while higher values denote the maximum allowed complexity of crossing interactions, e.g. depth 2 (({....))} or depth 3 ({[....)}].

This is a function object. Invoke it with the parameter(s) specified above.

It acts as a wrapper and looks for three possible implementations (in this order):

1. A static member variable max_pseudoknot_depth of the class seqan3::custom::alphabet<your_type>.
2. A free function max_pseudoknot_depth(your_type const) in the namespace of your type (or as friend).
3. A static member variable max_pseudoknot_depth of the class your_type.

Functions/variables are only considered for one of the above cases if they are marked noexcept and constexpr and if the returned type is convertible to size_t. For 2. the value of the argument to the function shall be ignored, the argument is only used to select the function via argument-dependent lookup.

Every RNA structure alphabet type must provide one of the above.

### Example

These are the expressions to retrieve the value:

// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
#include <iostream>
#include <seqan3/alphabet/structure/wuss.hpp>
int main()
{
uint8_t max_depth_member = seqan3::wuss51::max_pseudoknot_depth;
uint8_t max_depth_meta = seqan3::max_pseudoknot_depth<seqan3::wuss51>;
std::cout << static_cast<uint16_t>(max_depth_member) << '\n'; // 22
std::cout << static_cast<uint16_t>(max_depth_meta) << '\n'; // 22
}
seqan3::max_pseudoknot_depth
constexpr auto max_pseudoknot_depth
A type trait that holds the ability of the structure alphabet to represent pseudoknots,...
Definition alphabet/structure/concept.hpp:371

### Customisation point

This is a customisation point (see Customisation). To specify the behaviour for your own alphabet type, simply provide one of the three functions specified above.

This entity is experimental and subject to change in the future. Experimental since version 3.1.

## pseudoknot_id

auto seqan3::pseudoknot_id = detail::adl_only::pseudoknot_id_cpo{}

inline constexpr

Retrieve an id for the level of a pseudoknotted interaction (also known as 'page number').

Template Parameters

  your_type | Type of the argument.

Parameters

  chr | The RNA structure character whose property is checked.

Returns
  A std::optional containing the pseudoknot identifier if alph represents an interaction. The returned value is std::nullopt for unpaired sites. For non-nested interactions the identifier is always 0. It is guaranteed to be smaller than seqan3::max_pseudoknot_depth.

This is a function object. Invoke it with the parameter(s) specified above.

It acts as a wrapper and looks for three possible implementations (in this order):

1. A static member function pseudoknot_id(your_type const a) of the class seqan3::custom::alphabet<your_type>.
2. A free function pseudoknot_id(your_type const a) in the namespace of your type (or as friend).
3. A member function of your_type called pseudoknot_id().

Functions are only considered for one of the above cases if they are marked noexcept (constexpr is not required, but recommended) and the return type is convertible to size_t.

Every RNA structure alphabet type must provide one of the above.

### Example

// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
#include <seqan3/alphabet/structure/wuss.hpp>
#include <seqan3/core/debug_stream.hpp>
int main()
{
using namespace seqan3::literals;
auto pk_opt = '.'_wuss51.pseudoknot_id(); // std::optional -> false
pk_opt = seqan3::pseudoknot_id('{'_wuss51); // std::optional -> true: 3
if (pk_opt)
seqan3::debug_stream << *pk_opt << '\n'; // 3
}
debug_stream.hpp
Provides seqan3::debug_stream and related types.
seqan3::pseudoknot_id
constexpr auto pseudoknot_id
Retrieve an id for the level of a pseudoknotted interaction (also known as 'page number').
Definition alphabet/structure/concept.hpp:454
seqan3::debug_stream
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition debug_stream.hpp:38

### Customisation point

This is a customisation point (see Customisation). To specify the behaviour for your own alphabet type, simply provide one of the three functions specified above.

This entity is experimental and subject to change in the future. Experimental since version 3.1.

Hide me