RNAlib-2.5.1
Dot-Bracket Notation of Secondary Structures

The Dot-Bracket notation as introduced already in the early times of the ViennaRNA Package denotes base pairs by matching pairs of parenthesis () and unpaired nucleotides by dots .. More...

Detailed Description

The Dot-Bracket notation as introduced already in the early times of the ViennaRNA Package denotes base pairs by matching pairs of parenthesis () and unpaired nucleotides by dots ..

As a simple example, consider a helix of size 4 enclosing a hairpin of size 4. In dot-bracket notation, this is annotated as

((((....))))

Extended Dot-Bracket Notation

A more generalized version of the original Dot-Bracket notation may use additional pairs of brackets, such as <>, {}, and [], and matching pairs of uppercase/lowercase letters. This allows for anotating pseudo-knots, since different pairs of brackets are not required to be nested.

The follwing annotations of a simple structure with two crossing helices of size 4 are equivalent:

<<<<[[[[....>>>>]]]]
((((AAAA....))))aaaa
AAAA{{{{....aaaa}}}}

+ Collaboration diagram for Dot-Bracket Notation of Secondary Structures:

Macros

#define VRNA_BRACKETS_ALPHA   4U
 Bitflag to indicate secondary structure notations using uppercase/lowercase letters from the latin alphabet. More...
 
#define VRNA_BRACKETS_RND   8U
 Bitflag to indicate secondary structure notations using round brackets (parenthesis), () More...
 
#define VRNA_BRACKETS_CLY   16U
 Bitflag to indicate secondary structure notations using curly brackets, {} More...
 
#define VRNA_BRACKETS_ANG   32U
 Bitflag to indicate secondary structure notations using angular brackets, <> More...
 
#define VRNA_BRACKETS_SQR   64U
 Bitflag to indicate secondary structure notations using square brackets, [] More...
 
#define VRNA_BRACKETS_DEFAULT
 Default bitmask to indicate secondary structure notation using any pair of brackets. More...
 
#define VRNA_BRACKETS_ANY
 Bitmask to indicate secondary structure notation using any pair of brackets or uppercase/lowercase alphabet letters. More...
 

Functions

char * vrna_db_pack (const char *struc)
 Pack secondary secondary structure, 5:1 compression using base 3 encoding. More...
 
char * vrna_db_unpack (const char *packed)
 Unpack secondary structure previously packed with vrna_db_pack() More...
 
void vrna_db_flatten (char *structure, unsigned int options)
 Substitute pairs of brackets in a string with parenthesis. More...
 
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. More...
 
char * vrna_db_from_ptable (const short *pt)
 Convert a pair table into dot-parenthesis notation. More...
 
char * vrna_db_from_plist (vrna_ep_t *pairs, unsigned int n)
 Convert a list of base pairs into dot-bracket notation. More...
 
char * vrna_db_to_element_string (const char *structure)
 Convert a secondary structure in dot-bracket notation to a nucleotide annotation of loop contexts. More...
 
char * vrna_db_pk_remove (const char *structure, unsigned int options)
 Remove pseudo-knots from an input structure. More...
 

Macro Definition Documentation

◆ VRNA_BRACKETS_ALPHA

#define VRNA_BRACKETS_ALPHA   4U

#include <ViennaRNA/utils/structures.h>

Bitflag to indicate secondary structure notations using uppercase/lowercase letters from the latin alphabet.

See also
vrna_ptable_from_string()

◆ VRNA_BRACKETS_RND

#define VRNA_BRACKETS_RND   8U

#include <ViennaRNA/utils/structures.h>

Bitflag to indicate secondary structure notations using round brackets (parenthesis), ()

See also
vrna_ptable_from_string(), vrna_db_flatten(), vrna_db_flatten_to()

◆ VRNA_BRACKETS_CLY

#define VRNA_BRACKETS_CLY   16U

#include <ViennaRNA/utils/structures.h>

Bitflag to indicate secondary structure notations using curly brackets, {}

See also
vrna_ptable_from_string(), vrna_db_flatten(), vrna_db_flatten_to()

◆ VRNA_BRACKETS_ANG

#define VRNA_BRACKETS_ANG   32U

#include <ViennaRNA/utils/structures.h>

Bitflag to indicate secondary structure notations using angular brackets, <>

See also
vrna_ptable_from_string(), vrna_db_flatten(), vrna_db_flatten_to()

◆ VRNA_BRACKETS_SQR

#define VRNA_BRACKETS_SQR   64U

#include <ViennaRNA/utils/structures.h>

Bitflag to indicate secondary structure notations using square brackets, []

See also
vrna_ptable_from_string(), vrna_db_flatten(), vrna_db_flatten_to()

◆ VRNA_BRACKETS_DEFAULT

#define VRNA_BRACKETS_DEFAULT

#include <ViennaRNA/utils/structures.h>

Value:
VRNA_BRACKETS_CLY | \
VRNA_BRACKETS_ANG | \
VRNA_BRACKETS_SQR)
#define VRNA_BRACKETS_RND
Bitflag to indicate secondary structure notations using round brackets (parenthesis),...
Definition: structures.h:81

Default bitmask to indicate secondary structure notation using any pair of brackets.

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!

See also
vrna_ptable_from_string(), vrna_db_flatten(), vrna_db_flatten_to(), vrna_db_pk_remove() vrna_pt_pk_remove()

◆ VRNA_BRACKETS_ANY

#define VRNA_BRACKETS_ANY

#include <ViennaRNA/utils/structures.h>

Value:
VRNA_BRACKETS_CLY | \
VRNA_BRACKETS_ANG | \
VRNA_BRACKETS_SQR | \
VRNA_BRACKETS_ALPHA)

Bitmask to indicate secondary structure notation using any pair of brackets or uppercase/lowercase alphabet letters.

See also
vrna_ptable_from_string(), vrna_db_pk_remove(), vrna_db_flatten(), vrna_db_flatten_to()

Function Documentation

◆ vrna_db_pack()

char * vrna_db_pack ( const char *  struc)

#include <ViennaRNA/utils/structures.h>

Pack secondary secondary structure, 5:1 compression using base 3 encoding.

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
vrna_db_unpack()
Parameters
strucThe secondary structure in dot-bracket notation
Returns
The binary encoded structure

◆ vrna_db_unpack()

char * vrna_db_unpack ( const char *  packed)

#include <ViennaRNA/utils/structures.h>

Unpack secondary structure previously packed with vrna_db_pack()

Translate a compressed binary string produced by vrna_db_pack() back into the familiar dot-bracket notation.

See also
vrna_db_pack()
Parameters
packedThe binary encoded packed secondary structure
Returns
The unpacked secondary structure in dot-bracket notation

◆ vrna_db_flatten()

void vrna_db_flatten ( char *  structure,
unsigned int  options 
)

#include <ViennaRNA/utils/structures.h>

Substitute pairs of brackets in a string with parenthesis.

This function can be used to replace brackets of unusual types, such as angular brackets <> , to dot-bracket format. The options parameter is used tpo specify which types of brackets will be replaced by round parenthesis () .

See also
vrna_db_flatten_to(), VRNA_BRACKETS_RND, VRNA_BRACKETS_ANG, VRNA_BRACKETS_CLY, VRNA_BRACKETS_SQR, VRNA_BRACKETS_DEFAULT
Parameters
structureThe structure string where brackets are flattened in-place
optionsA bitmask to specify which types of brackets should be flattened out
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().

◆ vrna_db_flatten_to()

void vrna_db_flatten_to ( char *  string,
const char  target[3],
unsigned int  options 
)

#include <ViennaRNA/utils/structures.h>

Substitute pairs of brackets in a string with another type of pair characters.

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 target array must contain a character for the 'pair open' annotation at position 0, and one for 'pair close' at position 1. Toptions parameter is used to specify which types of brackets will be replaced by the new pairs.

See also
vrna_db_flatten(), VRNA_BRACKETS_RND, VRNA_BRACKETS_ANG, VRNA_BRACKETS_CLY, VRNA_BRACKETS_SQR, VRNA_BRACKETS_DEFAULT
Parameters
stringThe structure string where brackets are flattened in-place
targetThe new pair characters the string will be flattened to
optionsA bitmask to specify which types of brackets should be flattened out
SWIG Wrapper Notes:
This function is available as an overloaded version of vrna_db_flatten()

◆ vrna_db_from_ptable()

char * vrna_db_from_ptable ( const short *  pt)

#include <ViennaRNA/utils/structures.h>

Convert a pair table into dot-parenthesis notation.

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
ptThe pair table to be copied
Returns
A char pointer to the dot-bracket string

◆ vrna_db_from_plist()

char * vrna_db_from_plist ( vrna_ep_t pairs,
unsigned int  n 
)

#include <ViennaRNA/utils/structures.h>

Convert a list of base pairs into dot-bracket notation.

See also
vrna_plist()
Parameters
pairsA vrna_ep_t containing the pairs to be included in the dot-bracket string
nThe length of the structure (number of nucleotides)
Returns
The dot-bracket string containing the provided base pairs

◆ vrna_db_to_element_string()

char * vrna_db_to_element_string ( const char *  structure)

#include <ViennaRNA/utils/structures.h>

Convert a secondary structure in dot-bracket notation to a nucleotide annotation of loop contexts.

Parameters
structureThe secondary structure in dot-bracket notation
Returns
A string annotating each nucleotide according to it's structural context

◆ vrna_db_pk_remove()

char * vrna_db_pk_remove ( const char *  structure,
unsigned int  options 
)

#include <ViennaRNA/utils/structures.h>

Remove pseudo-knots from an input structure.

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 alphabet A-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 the options parameter.

Note
Brackets in the input structure string that are not covered by the options bitmask will be silently ignored!
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
Parameters
structureInput structure in dot-bracket format that may include pseudo-knots
optionsA bitmask to specify which types of brackets should be processed
Returns
The input structure devoid of pseudo-knots in dot-bracket notation
SWIG Wrapper Notes:
This function is available as an overloaded function db_pk_remove() where the optional second parameter options defaults to VRNA_BRACKETS_ANY.