19namespace seqan3::detail
32template <
typename structure_alph_type,
typename bpp_type, std::ranges::range structure_type>
33inline void bpp_from_rna_structure(bpp_type &
bpp, structure_type
const &
structure,
double weight = 1.)
35 if constexpr (!rna_structure_alphabet<structure_alph_type>)
36 throw parse_error{
"Cannot create base pair probabilities from a structure that is not RNA structure."};
39 if constexpr (std::ranges::sized_range<structure_type>)
44 for (structure_alph_type symbol :
structure)
49 if (symbol.is_pair_open())
53 else if (symbol.is_pair_close())
55 if (!brackets[
id].
empty())
57 bpp[pos].emplace(weight, brackets[
id].top());
58 bpp[brackets[
id].
top()].emplace(weight, pos);
63 throw parse_error{std::string{
"Invalid bracket notation: Unpaired closing bracket at position "}
72 if (!brackets[
id].
empty())
74 throw parse_error{std::string{
"Invalid bracket notation: Unpaired opening bracket at position "}
Provides seqan3::rna_structure_alphabet.
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
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
@ structure
Fixed interactions, usually a string of structure alphabet characters.
Definition record.hpp:70
@ bpp
Base pair probability matrix of interactions, usually a matrix of float numbers.
Definition record.hpp:69
@ id
The identifier, usually a string.
Definition record.hpp:63
constexpr size_t size
The size of a type pack.
Definition type_pack/traits.hpp:143
Provides exceptions used in the I/O module.