RNA Secondary Structures#
Functions to create, parse, convert, manipulate, and compare secondary structure representations.
Dot-Bracket Notation#
Defines
-
VRNA_BRACKETS_ALPHA#
Bitflag to indicate secondary structure notations using uppercase/lowercase letters from the latin alphabet.
#include <ViennaRNA/structures/dotbracket.h>
See also
-
VRNA_BRACKETS_RND#
Bitflag to indicate secondary structure notations using round brackets (parenthesis),
().#include <ViennaRNA/structures/dotbracket.h>
-
VRNA_BRACKETS_CLY#
Bitflag to indicate secondary structure notations using curly brackets,
{}.#include <ViennaRNA/structures/dotbracket.h>
-
VRNA_BRACKETS_ANG#
Bitflag to indicate secondary structure notations using angular brackets,
<>.#include <ViennaRNA/structures/dotbracket.h>
-
VRNA_BRACKETS_SQR#
Bitflag to indicate secondary structure notations using square brackets,
[].#include <ViennaRNA/structures/dotbracket.h>
-
VRNA_BRACKETS_DEFAULT#
Default bitmask to indicate secondary structure notation using any pair of brackets.
#include <ViennaRNA/structures/dotbracket.h>
This set of matching brackets/parenthesis is always nested, i.e. pseudo-knot free, in WUSS format. However, in general different kinds of brackets are mostly used for annotating pseudo-knots. Thus special care has to be taken to remove pseudo-knots if this bitmask is used in functions that return secondary structures without pseudo-knots!
-
VRNA_BRACKETS_ANY#
Bitmask to indicate secondary structure notation using any pair of brackets or uppercase/lowercase alphabet letters.
#include <ViennaRNA/structures/dotbracket.h>
-
VRNA_GQUAD_DB_SYMBOL#
#include <ViennaRNA/structures/dotbracket.h>
-
VRNA_GQUAD_DB_SYMBOL_END#
#include <ViennaRNA/structures/dotbracket.h>
Functions
-
char *vrna_db_pack(const char *struc)#
Pack secondary secondary structure, 5:1 compression using base 3 encoding.
#include <ViennaRNA/structures/dotbracket.h>
Returns a binary string encoding of the secondary structure using a 5:1 compression scheme. The string is NULL terminated and can therefore be used with standard string functions such as strcmp(). Useful for programs that need to keep many structures in memory.
See also
- Parameters:
struc – The secondary structure in dot-bracket notation
- Returns:
The binary encoded structure
-
char *vrna_db_unpack(const char *packed)#
Unpack secondary structure previously packed with vrna_db_pack().
#include <ViennaRNA/structures/dotbracket.h>
Translate a compressed binary string produced by vrna_db_pack() back into the familiar dot-bracket notation.
See also
- Parameters:
packed – The binary encoded packed secondary structure
- Returns:
The unpacked secondary structure in dot-bracket notation
-
void vrna_db_flatten(char *structure, unsigned int options)#
Substitute pairs of brackets in a string with parenthesis.
#include <ViennaRNA/structures/dotbracket.h>
This function can be used to replace brackets of unusual types, such as angular brackets
<>, to dot-bracket format. Theoptionsparameter is used tpo specify which types of brackets will be replaced by round parenthesis() .- SWIG Wrapper Notes:
This function flattens an input structure string in-place! The second parameter is optional and defaults to VRNA_BRACKETS_DEFAULT.
An overloaded version of this function exists, where an additional second parameter can be passed to specify the target brackets, i.e. the type of matching pair characters all brackets will be flattened to. Therefore, in the scripting language interface this function is a replacement for vrna_db_flatten_to(). See, e.g.
RNA.db_flatten()in the The RNA Python module.
See also
vrna_db_flatten_to(), VRNA_BRACKETS_RND, VRNA_BRACKETS_ANG, VRNA_BRACKETS_CLY, VRNA_BRACKETS_SQR, VRNA_BRACKETS_DEFAULT
- Parameters:
structure – The structure string where brackets are flattened in-place
options – A bitmask to specify which types of brackets should be flattened out
-
void vrna_db_flatten_to(char *string, const char target[3], unsigned int options)#
Substitute pairs of brackets in a string with another type of pair characters.
#include <ViennaRNA/structures/dotbracket.h>
This function can be used to replace brackets in a structure annotation string, such as square brackets
[] , to another type of pair characters, e.g. angular brackets<>.The
targetarray must contain a character for the ‘pair open’ annotation at position 0, and one for ‘pair close’ at position 1. Toptionsparameter is used to specify which types of brackets will be replaced by the new pairs.- SWIG Wrapper Notes:
This function is available as an overloaded version of vrna_db_flatten(). See, e.g.
RNA.db_flatten()in the The RNA Python module.
See also
vrna_db_flatten(), VRNA_BRACKETS_RND, VRNA_BRACKETS_ANG, VRNA_BRACKETS_CLY, VRNA_BRACKETS_SQR, VRNA_BRACKETS_DEFAULT
- Parameters:
string – The structure string where brackets are flattened in-place
target – The new pair characters the string will be flattened to
options – A bitmask to specify which types of brackets should be flattened out
-
char *vrna_db_from_ptable(const short *pt)#
Convert a pair table into dot-parenthesis notation.
#include <ViennaRNA/structures/dotbracket.h>
This function also converts pair table formatted structures that contain pseudoknots. Non-nested base pairs result in additional pairs of parenthesis and brackets within the resulting dot-parenthesis string. The following pairs are awailable: (), []. {}. <>, as well as pairs of matching upper-/lower-case characters from the alphabet A-Z.
Note
In cases where the level of non-nested base pairs exceeds the maximum number of 30 different base pair indicators (4 parenthesis/brackets, 26 matching characters), a warning is printed and the remaining base pairs are left out from the conversion.
- Parameters:
pt – The pair table to be copied
- Returns:
A char pointer to the dot-bracket string
-
char *vrna_db_from_plist(vrna_ep_t *pairs, unsigned int n)#
Convert a list of base pairs into dot-bracket notation.
#include <ViennaRNA/structures/dotbracket.h>
See also
- Parameters:
pairs – A vrna_ep_t containing the pairs to be included in the dot-bracket string
n – The length of the structure (number of nucleotides)
- Returns:
The dot-bracket string containing the provided base pairs
-
char *vrna_db_to_element_string(const char *structure)#
Convert a secondary structure in dot-bracket notation to a nucleotide annotation of loop contexts.
#include <ViennaRNA/structures/dotbracket.h>
- Parameters:
structure – The secondary structure in dot-bracket notation
- Returns:
A string annotating each nucleotide according to it’s structural context
-
char *vrna_db_pk_remove(const char *structure, unsigned int options)#
Remove pseudo-knots from an input structure.
#include <ViennaRNA/structures/dotbracket.h>
This function removes pseudo-knots from an input structure by determining the minimum number of base pairs that need to be removed to make the structure pseudo-knot free.
To accomplish that, we use a dynamic programming algorithm similar to the Nussinov maxmimum matching approach.
The input structure must be in a dot-bracket string like form where crossing base pairs are denoted by the use of additional types of matching brackets, e.g.
<>,{},[],{}. Furthermore, crossing pairs may be annotated by matching uppercase/lowercase letters from the alphabetA-Z. For the latter, the uppercase letter must be the 5’ and the lowercase letter the 3’ nucleotide of the base pair. The actual type of brackets to be recognized by this function must be specifed through theoptionsparameter.- SWIG Wrapper Notes:
This function is available as an overloaded function
db_pk_remove()where the optional second parameteroptionsdefaults to VRNA_BRACKETS_ANY. See, e.g.RNA.db_pk_remove()in the The RNA Python module.
See also
vrna_pt_pk_remove(), vrna_db_flatten(), VRNA_BRACKETS_RND, VRNA_BRACKETS_ANG, VRNA_BRACKETS_CLY, VRNA_BRACKETS_SQR, VRNA_BRACKETS_ALPHA, VRNA_BRACKETS_DEFAULT, VRNA_BRACKETS_ANY
Note
Brackets in the input structure string that are not covered by the
optionsbitmask will be silently ignored!- Parameters:
structure – Input structure in dot-bracket format that may include pseudo-knots
options – A bitmask to specify which types of brackets should be processed
- Returns:
The input structure devoid of pseudo-knots in dot-bracket notation
-
VRNA_BRACKETS_ALPHA#
WUSS Notation#
Washington University Secondary Structure (WUSS) notation related functions
Functions
-
char *vrna_db_from_WUSS(const char *wuss)#
Convert a WUSS annotation string to dot-bracket format.
#include <ViennaRNA/structures/dotbracket.h>
Note
This function flattens all brackets, and treats pseudo-knots annotated by matching pairs of upper/lowercase letters as unpaired nucleotides
- Parameters:
wuss – The input string in WUSS notation
- Returns:
A dot-bracket notation of the input secondary structure
-
char *vrna_db_from_WUSS(const char *wuss)#
Pair Tables#
Pair Table Representation of Secondary Structures
Functions
-
short *vrna_ptable(const char *structure)#
Create a pair table from a Dot-Bracket Notation of a secondary structure.
#include <ViennaRNA/structures/pairtable.h>
Returns a newly allocated table, such that table[i]=j if (i.j) pair or 0 if i is unpaired, table[0] contains the length of the structure.
- SWIG Wrapper Notes:
This functions is wrapped as overloaded function
ptable()that takes an optional argumentoptionsto specify which type of matching brackets should be considered during conversion. The default set is round brackets, i.e. VRNA_BRACKETS_RND. See, e.g.RNA.ptable()in the The RNA Python module.
- Parameters:
structure – The secondary structure in dot-bracket notation
- Returns:
A pointer to the created pair_table
-
short *vrna_ptable_from_string(const char *structure, unsigned int options)#
Create a pair table for a secondary structure string.
#include <ViennaRNA/structures/pairtable.h>
This function takes an input string of a secondary structure annotation in Dot-Bracket Notation or Extended Dot-Bracket Notation , and converts it into a pair table representation.
- SWIG Wrapper Notes:
This functions is wrapped as overloaded function
ptable()that takes an optional argumentoptionsto specify which type of matching brackets should be considered during conversion. The default set is round brackets, i.e. VRNA_BRACKETS_RND. See, e.g.RNA.ptable()in the The RNA Python module.
See also
vrna_ptable(), vrna_db_from_ptable(), vrna_db_flatten_to(), vrna_pt_pk_remove() VRNA_BRACKETS_RND, VRNA_BRACKETS_ANG, VRNA_BRACKETS_CLY, VRNA_BRACKETS_SQR, VRNA_BRACKETS_ALPHA, VRNA_BRACKETS_DEFAULT, VRNA_BRACKETS_ANY
Note
This function also extracts crossing base pairs, i.e. pseudo-knots if more than a single matching bracket type is allowed through the bitmask
options.- Parameters:
structure – Secondary structure in Extended Dot-Bracket Notation
options – A bitmask to specify which brackets are recognized during conversion to pair table
- Returns:
A pointer to a new pair table of the provided secondary structure
-
short *vrna_pt_pk_get(const char *structure)#
Create a pair table of a secondary structure (pseudo-knot version).
#include <ViennaRNA/structures/pairtable.h>
Returns a newly allocated table, such that table[i]=j if (i.j) pair or 0 if i is unpaired, table[0] contains the length of the structure.
In contrast to vrna_ptable() this function also recognizes the base pairs denoted by ‘[’ and ‘]’ brackets. Thus, this function behaves like
vrna_ptable_from_string(structure, VRNA_BRACKETS_RND | VRNA_BRACKETS_SQR)
See also
- Parameters:
structure – The secondary structure in (extended) dot-bracket notation
- Returns:
A pointer to the created pair_table
-
short *vrna_ptable_copy(const short *pt)#
Get an exact copy of a pair table.
#include <ViennaRNA/structures/pairtable.h>
- Parameters:
pt – The pair table to be copied
- Returns:
A pointer to the copy of ‘pt’
-
short *vrna_pt_ali_get(const char *structure)#
Create a pair table of a secondary structure (snoop align version).
#include <ViennaRNA/structures/pairtable.h>
-
short *vrna_pt_snoop_get(const char *structure)#
Create a pair table of a secondary structure (snoop version).
#include <ViennaRNA/structures/pairtable.h>
returns a newly allocated table, such that: table[i]=j if (i.j) pair or 0 if i is unpaired, table[0] contains the length of the structure. The special pseudoknotted H/ACA-mRNA structure is taken into account.
-
short *vrna_pt_pk_remove(const short *ptable, unsigned int options)#
Remove pseudo-knots from a pair table.
#include <ViennaRNA/structures/pairtable.h>
This function removes pseudo-knots from an input structure by determining the minimum number of base pairs that need to be removed to make the structure pseudo-knot free.
To accomplish that, we use a dynamic programming algorithm similar to the Nussinov maxmimum matching approach.
See also
- Parameters:
ptable – Input structure that may include pseudo-knots
options
- Returns:
The input structure devoid of pseudo-knots
-
unsigned int vrna_ptable_compat_remove(short *pt, const short *pt_ref)#
Remove base pairs compatible with a reference structure.
#include <ViennaRNA/structures/pairtable.h>
This function compares two structures (
ptandpt_ref) of the same length in pair table format and removes all base pairs inptthat are not present in the referencept_refas long as they are compatible withpt_ref.This is useful in cases where one wants to score the difference between two structures but not account for additional compatible base pairs, e.g. during benchmarking.
See also
- Parameters:
pt – The structure in pair table format that might undergo base pair removal
pt_ref – The reference structure in pair table format
- Returns:
The number of base pairs removed from
pt
-
unsigned int vrna_ptable_count_bp(const short *pt)#
#include <ViennaRNA/structures/pairtable.h>
-
unsigned int vrna_ptable_count_up(const short *pt)#
#include <ViennaRNA/structures/pairtable.h>
-
short *vrna_ptable(const char *structure)#
Pair Lists#
Pair List Representation of Secondary Structures
Defines
-
VRNA_PLIST_TYPE_BASEPAIR#
A Base Pair element.
#include <ViennaRNA/structures/problist.h>
-
VRNA_PLIST_TYPE_GQUAD#
A G-Quadruplex element.
#include <ViennaRNA/structures/problist.h>
-
VRNA_PLIST_TYPE_H_MOTIF#
A Hairpin loop motif element.
#include <ViennaRNA/structures/problist.h>
-
VRNA_PLIST_TYPE_I_MOTIF#
An Internal loop motif element.
#include <ViennaRNA/structures/problist.h>
-
VRNA_PLIST_TYPE_UD_MOTIF#
An Unstructured Domain motif element.
#include <ViennaRNA/structures/problist.h>
-
VRNA_PLIST_TYPE_STACK#
A Base Pair stack element.
#include <ViennaRNA/structures/problist.h>
-
VRNA_PLIST_TYPE_UNPAIRED#
An unpaired base or segment.
#include <ViennaRNA/structures/problist.h>
-
VRNA_PLIST_TYPE_TRIPLE#
One pair of a base triplet.
#include <ViennaRNA/structures/problist.h>
-
VRNA_PLIST_TYPE_HELIX#
A Helix element.
#include <ViennaRNA/structures/problist.h>
Typedefs
-
typedef struct vrna_elem_prob_s vrna_ep_t#
Convenience typedef for data structure vrna_elem_prob_s.
#include <ViennaRNA/structures/problist.h>
-
typedef vrna_ep_t *vrna_ep_array_t#
Convenience typedef for vrna_array( vrna_ep_t ).
#include <ViennaRNA/structures/problist.h>
Note
Get the number of elements in the array via vrna_array_size() and append elements via the vrna_array_append() macro
Warning
Use the vrna_array_free() macro to release memory for data of this type!
Functions
-
vrna_ep_t *vrna_plist(const char *struc, float pr)#
Create a vrna_ep_t from a dot-bracket string.
#include <ViennaRNA/structures/problist.h>
The dot-bracket string is parsed and for each base pair an entry in the plist is created. The probability of each pair in the list is set by a function parameter.
The end of the plist is marked by sequence positions i as well as j equal to 0. This condition should be used to stop looping over its entries
- Parameters:
struc – The secondary structure in dot-bracket notation
pr – The probability for each base pair used in the plist
- Returns:
The plist array
-
struct vrna_elem_prob_s#
- #include <ViennaRNA/structures/problist.h>
Data structure representing a single entry of an element probability list (e.g. list of pair probabilities).
VRNA_PLIST_TYPE_BASEPAIR, VRNA_PLIST_TYPE_GQUAD, VRNA_PLIST_TYPE_H_MOTIF, VRNA_PLIST_TYPE_I_MOTIF, VRNA_PLIST_TYPE_UD_MOTIF, VRNA_PLIST_TYPE_STACK
See also
vrna_plist(), vrna_plist_from_probs(), vrna_db_from_plist(),
Public Members
-
int i#
Start position (usually 5’ nucleotide that starts the element, e.g. base pair).
#include <ViennaRNA/structures/problist.h>
-
int j#
End position (usually 3’ nucleotide that ends the element, e.g. base pair).
#include <ViennaRNA/structures/problist.h>
-
unsigned int size#
The size of the element (e.g. number of base pairs that constitute a helix).
#include <ViennaRNA/structures/problist.h>
-
float p#
Probability of the element.
#include <ViennaRNA/structures/problist.h>
-
int type#
Type of the element.
#include <ViennaRNA/structures/problist.h>
-
int i#
-
VRNA_PLIST_TYPE_BASEPAIR#
Abstract Shapes#
Abstract Shapes Representation of Secondary Structures
Functions
-
char *vrna_abstract_shapes(const char *structure, unsigned int level)#
Convert a secondary structure in dot-bracket notation to its abstract shapes representation.
#include <ViennaRNA/structures/shapes.h>
This function converts a secondary structure into its abstract shapes representation as presented by Giegerich et al. [2004] .
- SWIG Wrapper Notes:
This function is available as an overloaded function
abstract_shapes()where the optional second parameterleveldefaults to 5. See, e.g.RNA.abstract_shapes()in the The RNA Python module.
See also
- Parameters:
structure – A secondary structure in dot-bracket notation
level – The abstraction level (integer in the range of 0 to 5)
- Returns:
The secondary structure in abstract shapes notation
-
char *vrna_abstract_shapes_pt(const short *pt, unsigned int level)#
Convert a secondary structure to its abstract shapes representation.
#include <ViennaRNA/structures/shapes.h>
This function converts a secondary structure into its abstract shapes representation as presented by Giegerich et al. [2004] . This function is equivalent to vrna_db_to_shapes(), but requires a pair table input instead of a dot-bracket structure.
- SWIG Wrapper Notes:
This function is available as an overloaded function
abstract_shapes()where the optional second parameterleveldefaults to 5. See, e.g.RNA.abstract_shapes()in the The RNA Python module.
See also
Note
The length of the structure must be present at
pt[0]!- Parameters:
pt – A secondary structure in pair table format
level – The abstraction level (integer in the range of 0 to 5)
- Returns:
The secondary structure in abstract shapes notation
-
char *vrna_abstract_shapes(const char *structure, unsigned int level)#
Helix Lists#
Helix List Representation of Secondary Structures
-
typedef struct vrna_hx_s vrna_hx_t#
Convenience typedef for data structure vrna_hx_s.
#include <ViennaRNA/structures/helix.h>
-
vrna_hx_t *vrna_hx_from_ptable(short *pt)#
Convert a pair table representation of a secondary structure into a helix list.
#include <ViennaRNA/structures/helix.h>
- Parameters:
pt – The secondary structure in pair table representation
- Returns:
The secondary structure represented as a helix list
-
vrna_hx_t *vrna_hx_merge(const vrna_hx_t *list, int maxdist)#
Create a merged helix list from another helix list.
#include <ViennaRNA/structures/helix.h>
-
struct vrna_hx_s#
- #include <ViennaRNA/structures/helix.h>
Data structure representing an entry of a helix list.
Public Members
-
unsigned int start#
#include <ViennaRNA/structures/helix.h>
-
unsigned int end#
#include <ViennaRNA/structures/helix.h>
-
unsigned int length#
#include <ViennaRNA/structures/helix.h>
-
unsigned int up5#
#include <ViennaRNA/structures/helix.h>
-
unsigned int up3#
#include <ViennaRNA/structures/helix.h>
-
unsigned int start#
Tree Representation#
Tree Representation of Secondary Structures
Defines
-
VRNA_STRUCTURE_TREE_HIT#
Homeomorphically Irreducible Tree (HIT) representation of a secondary structure.
#include <ViennaRNA/structures/tree.h>
See also
-
VRNA_STRUCTURE_TREE_SHAPIRO_SHORT#
(short) Coarse Grained representation of a secondary structure
#include <ViennaRNA/structures/tree.h>
See also
-
VRNA_STRUCTURE_TREE_SHAPIRO#
(full) Coarse Grained representation of a secondary structure
#include <ViennaRNA/structures/tree.h>
See also
-
VRNA_STRUCTURE_TREE_SHAPIRO_EXT#
(extended) Coarse Grained representation of a secondary structure
#include <ViennaRNA/structures/tree.h>
See also
-
VRNA_STRUCTURE_TREE_SHAPIRO_WEIGHT#
(weighted) Coarse Grained representation of a secondary structure
#include <ViennaRNA/structures/tree.h>
See also
-
VRNA_STRUCTURE_TREE_EXPANDED#
Expanded Tree representation of a secondary structure.
#include <ViennaRNA/structures/tree.h>
See also
Functions
-
char *vrna_db_to_tree_string(const char *structure, unsigned int type)#
Convert a Dot-Bracket structure string into tree string representation.
#include <ViennaRNA/structures/tree.h>
This function allows one to convert a secondary structure in dot-bracket notation into one of the various tree representations for secondary structures. The resulting tree is then represented as a string of parenthesis and node symbols, similar to to the Newick format.
Currently we support conversion into the following formats, denoted by the value of parameter
type:VRNA_STRUCTURE_TREE_HIT - Homeomorphically Irreducible Tree (HIT) representation of a secondary structure. (See also Fontana et al. [1993] )
VRNA_STRUCTURE_TREE_SHAPIRO_SHORT - (short) Coarse Grained representation of a secondary structure (same as Shapiro [1988] , but with root node
Rand withoutSnodes for the stems)VRNA_STRUCTURE_TREE_SHAPIRO - (full) Coarse Grained representation of a secondary structure (See also Shapiro [1988] )
VRNA_STRUCTURE_TREE_SHAPIRO_EXT - (extended) Coarse Grained representation of a secondary structure (same as Shapiro [1988] , but external nodes denoted as
E)VRNA_STRUCTURE_TREE_SHAPIRO_WEIGHT - (weighted) Coarse Grained representation of a secondary structure (same as VRNA_STRUCTURE_TREE_SHAPIRO_EXT but with additional weights for number of unpaired nucleotides in loop, and number of pairs in stems)
VRNA_STRUCTURE_TREE_EXPANDED - Expanded Tree representation of a secondary structure.
See also
structure-tree-representation
- Parameters:
structure – The null-terminated dot-bracket structure string
type – A switch to determine the type of tree string representation
- Returns:
A tree representation of the input
structure
-
char *vrna_tree_string_unweight(const char *structure)#
Remove weights from a linear string tree representation of a secondary structure.
#include <ViennaRNA/structures/tree.h>
This function strips the weights of a linear string tree representation such as
HIT, or Coarse Grained Tree sensu Shapiro [1988]See also
- Parameters:
structure – A linear string tree representation of a secondary structure with weights
- Returns:
A linear string tree representation of a secondary structure without weights
-
char *vrna_tree_string_to_db(const char *tree)#
Convert a linear tree string representation of a secondary structure back to Dot-Bracket notation.
#include <ViennaRNA/structures/tree.h>
See also
vrna_db_to_tree_string(), VRNA_STRUCTURE_TREE_EXPANDED, VRNA_STRUCTURE_TREE_HIT, structure-tree-representation
Warning
This function only accepts Expanded and HIT tree representations!
- Parameters:
tree – A linear tree string representation of a secondary structure
- Returns:
A dot-bracket notation of the secondary structure provided in
tree
-
VRNA_STRUCTURE_TREE_HIT#
Distance measures#
Distance measures between Secondary Structures
Functions
-
int vrna_bp_distance_pt(const short *pt1, const short *pt2)#
Compute the “base pair” distance between two pair tables pt1 and pt2 of secondary structures.
#include <ViennaRNA/structures/metrics.h>
The pair tables should have the same length. dist = number of base pairs in one structure but not in the other same as edit distance with open-pair close-pair as move-set
- SWIG Wrapper Notes:
This function is available as an overloaded method bp_distance(). See, e.g.
RNA.bp_distance()in the The RNA Python module.
See also
- Parameters:
pt1 – First structure in dot-bracket notation
pt2 – Second structure in dot-bracket notation
- Returns:
The base pair distance between pt1 and pt2
-
int vrna_bp_distance(const char *str1, const char *str2)#
Compute the “base pair” distance between two secondary structures s1 and s2.
#include <ViennaRNA/structures/metrics.h>
This is a wrapper around vrna_bp_distance_pt(). The sequences should have the same length. dist = number of base pairs in one structure but not in the other same as edit distance with open-pair close-pair as move-set
- SWIG Wrapper Notes:
This function is available as an overloaded method bp_distance(). Note that the SWIG wrapper takes two structure in dot-bracket notation and converts them into pair tables using vrna_ptable_from_string(). The resulting pair tables are then internally passed to vrna_bp_distance_pt(). To control which kind of matching brackets will be used during conversion, the optional argument
optionscan be used. See also the description of vrna_ptable_from_string() for available options. (default: VRNA_BRACKETS_RND). See, e.g.RNA.bp_distance()in the The RNA Python module.
See also
- Parameters:
str1 – First structure in dot-bracket notation
str2 – Second structure in dot-bracket notation
- Returns:
The base pair distance between str1 and str2
-
double vrna_dist_mountain(const char *str1, const char *str2, unsigned int p)#
#include <ViennaRNA/structures/metrics.h>
-
int vrna_bp_distance_pt(const short *pt1, const short *pt2)#
Benchmarking#
Benchmarking Secondary Structure Predictions
Typedefs
-
typedef struct vrna_score_s vrna_score_t#
Typename for the score data structure vrna_score_s.
#include <ViennaRNA/structures/benchmark.h>
Functions
-
vrna_score_t vrna_score_from_confusion_matrix(double TP, double TN, double FP, double FN)#
Construct score data structure from given confusion matrix.
#include <ViennaRNA/structures/benchmark.h>
- Parameters:
TP – True positive count
TN – True negative count
FP – False positive count
FN – False negative count
- Returns:
The score data structure to write
-
vrna_score_t vrna_compare_structure_pt(const short *pt_gold, const short *pt_other, int fuzzy)#
Return statistic of two structure (in pair table) comparaison.
#include <ViennaRNA/structures/benchmark.h>
See also
- Parameters:
pt_gold – Gold standard structure in pair table
pt_other – Structure to compare in pair table
fuzzy – Allows for base pair slippage. Hence, for any base pair (i,j) in the gold standard, a base pair (p, q) in the second structure is considered a true positive, if i - fuzzy <= p <= i + fuzzy, and j - fuzzy <= q <= j + fuzzy. Each gold standard base pair may be claimed as a true positive by at most one predicted base pair: once matched (within the fuzzy window) it is consumed and can’t be matched again by another predicted pair. Matching is greedy in the order predicted pairs are encountered, not a globally optimal assignment, but for typical slippage values (fuzzy of a few nucleotides) this does not affect the result.
- Returns:
The vrna_score_s data structure
-
vrna_score_t vrna_compare_structure(const char *structure_gold, const char *structure_other, int fuzzy, unsigned int options)#
Return statistic of two structure (in dbn) comparaison.
#include <ViennaRNA/structures/benchmark.h>
- Parameters:
structure_gold – Gold standard structure
structure_other – Structure to compare
fuzzy – Allows for base pair slippage. Hence, for any base pair (i,j) in the gold standard, a base pair (p, q) in the second structure is considered a true positive, if i - fuzzy <= p <= i + fuzzy, and j - fuzzy <= q <= j + fuzzy. Each gold standard base pair may be claimed as a true positive by at most one predicted base pair: once matched (within the fuzzy window) it is consumed and can’t be matched again by another predicted pair. Matching is greedy in the order predicted pairs are encountered, not a globally optimal assignment, but for typical slippage values (fuzzy of a few nucleotides) this does not affect the result.
options – A bitmask to specify which brackets are recognized during conversion to pair table
- Returns:
The vrna_score_s data structure
-
struct vrna_score_s#
- #include <ViennaRNA/structures/benchmark.h>
The data structure that contains statistic result of two structures comparaison.
Public Members
-
double TP#
True Positive count.
#include <ViennaRNA/structures/benchmark.h>
-
double TN#
True Negative count.
#include <ViennaRNA/structures/benchmark.h>
-
double FP#
False Positive count.
#include <ViennaRNA/structures/benchmark.h>
-
double FN#
False Negative count.
#include <ViennaRNA/structures/benchmark.h>
-
double TPR#
True Positive Rate.
#include <ViennaRNA/structures/benchmark.h>
-
double PPV#
Positive Predictive Value.
#include <ViennaRNA/structures/benchmark.h>
-
double FPR#
False Positive Rate.
#include <ViennaRNA/structures/benchmark.h>
-
double FOR#
False Omission Rate.
#include <ViennaRNA/structures/benchmark.h>
-
double TNR#
True Negative Rate.
#include <ViennaRNA/structures/benchmark.h>
-
double FDR#
False Discovery Rate.
#include <ViennaRNA/structures/benchmark.h>
-
double FNR#
False Negative Rate.
#include <ViennaRNA/structures/benchmark.h>
-
double NPV#
Negative Predictive Value.
#include <ViennaRNA/structures/benchmark.h>
-
double F1#
F1 Score.
#include <ViennaRNA/structures/benchmark.h>
-
double MCC#
Matthews Correlation Coefficient.
#include <ViennaRNA/structures/benchmark.h>
-
double TP#
-
typedef struct vrna_score_s vrna_score_t#
Other Structure Utilities#
Functions
-
char *vrna_db_compat_remove(const char *structure, const char *structure_ref, unsigned int *removed)#
Remove base pairs compatible with a reference structure.
#include <ViennaRNA/structures/dotbracket.h>
This function compares two structures (
structureandstructure_ref) of the same length in dot-bracket format and removes all base pairs instructurethat are not present in the referencestructure_refas long as they are compatible withstructure_ref.This is useful in cases where one wants to score the difference between two structures but not account for additional compatible base pairs, e.g. during benchmarking.
- Parameters:
structure – The structure in dot-bracket format that might undergo base pair removal
structure_ref – The reference structure in dot-bracket format
removed – A pointer to a variable where the the number of removed base pairs is stored to (maybe NULL)
- Returns:
A copy of
structuremissing the compatible base pairs
-
char *vrna_db_from_probs(const FLT_OR_DBL *pr, unsigned int length)#
Create a dot-bracket like structure string from base pair probability matrix.
#include <ViennaRNA/structures/dotbracket.h>
- SWIG Wrapper Notes:
This function is available as parameter-less method db_from_probs() bound to objects of type fold_compound. Parameters
prandlengthare implicitely taken from the fold_compound object the method is bound to. Upon missing base pair probabilities, this method returns an empty string. See, e.g.RNA.db_from_probs()in the The RNA Python module.
-
char *vrna_pairing_tendency(vrna_fold_compound_t *fc)#
#include <ViennaRNA/structures/dotbracket.h>
-
char vrna_bpp_symbol(const float *x)#
Get a pseudo dot bracket notation for a given probability information.
#include <ViennaRNA/structures/dotbracket.h>
-
char *vrna_db_from_bps(vrna_bps_t bp_stack, unsigned int length)#
Create a dot-backet/parenthesis structure from backtracking stack.
#include <ViennaRNA/structures/dotbracket.h>
This function is capable to create dot-bracket structures from base pairs stored within the base pair stack
bp_stack.- Parameters:
bp_stack – Base pair stack containing the traced base pairs
length – The length of the structure
- Returns:
The secondary structure in dot-bracket notation as provided in the input
-
char *vrna_db_from_bp_stack(vrna_bp_stack_t *bp, unsigned int length)#
Create a dot-backet/parenthesis structure from backtracking stack.
#include <ViennaRNA/structures/dotbracket.h>
This function is capable to create dot-bracket structures from suboptimal structure prediction sensu M. Zuker
- Parameters:
bp – Base pair stack containing the traced base pairs
length – The length of the structure
- Returns:
The secondary structure in dot-bracket notation as provided in the input
-
void vrna_letter_structure(char *structure, vrna_bp_stack_t *bp, unsigned int length)#
#include <ViennaRNA/structures/dotbracket.h>
-
int *vrna_loopidx_from_ptable(const short *pt)#
Get a loop index representation of a structure.
#include <ViennaRNA/structures/pairtable.h>
-
unsigned int *vrna_refBPcnt_matrix(const short *reference_pt, unsigned int turn)#
Make a reference base pair count matrix.
#include <ViennaRNA/structures/utils.h>
Get an upper triangular matrix containing the number of basepairs of a reference structure for each interval [i,j] with i<j. Access it via iindx!!!
-
unsigned int *vrna_refBPdist_matrix(const short *pt1, const short *pt2, unsigned int turn)#
Make a reference base pair distance matrix.
#include <ViennaRNA/structures/utils.h>
Get an upper triangular matrix containing the base pair distance of two reference structures for each interval [i,j] with i<j. Access it via iindx!!!
-
char *vrna_db_compat_remove(const char *structure, const char *structure_ref, unsigned int *removed)#