Secondary Structure Constraints#

Secondary structure constraints provide an easy control of which structures the prediction algorithms actually include into their solution space and how these structures are evaluated.

General API symbols#

Defines

VRNA_CONSTRAINT_FILE#

Flag for vrna_constraints_add() to indicate that constraints are present in a text file.

#include <ViennaRNA/constraints/basic.h>

Deprecated:

Use 0 instead!

VRNA_CONSTRAINT_SOFT_MFE#

Indicate generation of constraints for MFE folding.

#include <ViennaRNA/constraints/basic.h>

Deprecated:

This flag has no meaning anymore, since constraints are now always stored! (since v2.2.6)

VRNA_CONSTRAINT_SOFT_PF#

Indicate generation of constraints for partition function computation.

#include <ViennaRNA/constraints/basic.h>

Deprecated:

Use VRNA_OPTION_PF instead!

VRNA_DECOMP_PAIR_HP#

Flag passed to generic softt constraints callback to indicate hairpin loop decomposition step.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates a hairpin loop enclosed by the base pair \((i,j)\).

../_images/decomp_hp.svg

VRNA_DECOMP_PAIR_IL#

Indicator for internal loop decomposition step.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates an internal loop enclosed by the base pair \((i,j)\), and enclosing the base pair \((k,l)\).

../_images/decomp_il.svg

VRNA_DECOMP_PAIR_ML#

Indicator for multibranch loop decomposition step.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates a multibranch loop enclosed by the base pair \((i,j)\), and consisting of some enclosed multi loop content from k to l.

../_images/decomp_ml.svg

VRNA_DECOMP_ML_ML_ML#

Indicator for decomposition of multibranch loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates a multibranch loop part in the interval \([i:j]\), which will be decomposed into two multibranch loop parts \([i:k]\), and \([l:j]\).

../_images/decomp_ml_ml_ml.svg

VRNA_DECOMP_ML_STEM#

Indicator for decomposition of multibranch loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates a multibranch loop part in the interval \([i:j]\), which will be considered a single stem branching off with base pair \((k,l)\).

../_images/decomp_ml_stem.svg

VRNA_DECOMP_ML_ML#

Indicator for decomposition of multibranch loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates a multibranch loop part in the interval \([i:j]\), which will be decomposed into a (usually) smaller multibranch loop part \([k:l]\).

../_images/decomp_ml_ml.svg

VRNA_DECOMP_ML_UP#

Indicator for decomposition of multibranch loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates a multibranch loop part in the interval \([i:j]\), which will be considered a multibranch loop part that only consists of unpaired nucleotides.

../_images/decomp_ml_up.svg

VRNA_DECOMP_ML_ML_STEM#

Indicator for decomposition of multibranch loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates a multibranch loop part in the interval \([i:j]\), which will decomposed into a multibranch loop part \([i:k]\), and a stem with enclosing base pair \((l,j)\).

../_images/decomp_ml_ml_stem.svg

VRNA_DECOMP_ML_COAXIAL#

Indicator for decomposition of multibranch loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates a multibranch loop part in the interval \([i:j]\), where two stems with enclosing pairs \((i,k)\) and \((l,j)\) are coaxially stacking onto each other.

../_images/decomp_ml_coaxial.svg

VRNA_DECOMP_ML_COAXIAL_ENC#

Indicator for decomposition of multibranch loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates a multibranch loop part in the interval \([i:j]\), where two stems with enclosing pairs \((i,k)\) and \((l,j)\) are coaxially stacking onto each other.

../_images/decomp_ml_coaxial.svg

VRNA_DECOMP_EXT_EXT#

Indicator for decomposition of exterior loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates an exterior loop part in the interval \([i:j]\), which will be decomposed into a (usually) smaller exterior loop part \([k:l]\).

../_images/decomp_ext_ext.svg

VRNA_DECOMP_EXT_UP#

Indicator for decomposition of exterior loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates an exterior loop part in the interval \([i:j]\), which will be considered as an exterior loop component consisting of only unpaired nucleotides.

../_images/decomp_ext_up.svg

VRNA_DECOMP_EXT_STEM#

Indicator for decomposition of exterior loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates an exterior loop part in the interval \([i:j]\), which will be considered a stem with enclosing pair \((k,l)\).

../_images/decomp_ext_stem.svg

VRNA_DECOMP_EXT_EXT_EXT#

Indicator for decomposition of exterior loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates an exterior loop part in the interval \([i:j]\), which will be decomposed into two exterior loop parts \([i:k]\) and \([l:j]\).

../_images/decomp_ext_ext_ext.svg

VRNA_DECOMP_EXT_STEM_EXT#

Indicator for decomposition of exterior loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates an exterior loop part in the interval \([i:j]\), which will be decomposed into a stem branching off with base pair \((i,k)\), and an exterior loop part \([l:j]\).

../_images/decomp_ext_stem_ext.svg

VRNA_DECOMP_EXT_STEM_OUTSIDE#

Indicator for decomposition of exterior loop part.

#include <ViennaRNA/constraints/basic.h>
VRNA_DECOMP_EXT_EXT_STEM#

Indicator for decomposition of exterior loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates an exterior loop part in the interval \([i:j]\), which will be decomposed into an exterior loop part \([i:k]\), and a stem branching off with base pair \((l,j)\).

../_images/decomp_ext_ext_stem.svg

VRNA_DECOMP_EXT_EXT_STEM1#

Indicator for decomposition of exterior loop part.

#include <ViennaRNA/constraints/basic.h>

This flag notifies the soft or hard constraint callback function that the current decomposition step evaluates an exterior loop part in the interval \([i:j]\), which will be decomposed into an exterior loop part \([i:k]\), and a stem branching off with base pair \((l,j-1)\).

../_images/decomp_ext_ext_stem1.svg

Functions

void vrna_message_constraint_options(unsigned int option)#

Print a help message for pseudo dot-bracket structure constraint characters to stdout. (constraint support is specified by option parameter).

#include <ViennaRNA/constraints/hard.h>

Currently available options are: VRNA_CONSTRAINT_DB_PIPE (paired with another base) VRNA_CONSTRAINT_DB_DOT (no constraint at all) VRNA_CONSTRAINT_DB_X (base must not pair) VRNA_CONSTRAINT_DB_ANG_BRACK (paired downstream/upstream) VRNA_CONSTRAINT_DB_RND_BRACK

(base i pairs base j)

pass a collection of options as one value like this:

vrna_message_constraints(option_1 | option_2 | option_n)

Parameters:
  • option – Option switch that tells which constraint help will be printed

void vrna_message_constraint_options_all(void)#

Print structure constraint characters to stdout (full constraint support).

#include <ViennaRNA/constraints/hard.h>

Hard Constraints API#

Functions and data structures for secondary structure hard constraints

Defines

VRNA_CONSTRAINT_DB#

Flag for vrna_constraints_add() to indicate that constraint is passed in pseudo dot-bracket notation.

#include <ViennaRNA/constraints/hard.h>

VRNA_CONSTRAINT_DB_ENFORCE_BP#

Switch for dot-bracket structure constraint to enforce base pairs.

#include <ViennaRNA/constraints/hard.h>

This flag should be used to really enforce base pairs given in dot-bracket constraint rather than just weakly-enforcing them.

VRNA_CONSTRAINT_DB_PIPE#

Flag that is used to indicate the pipe ‘|’ sign in pseudo dot-bracket notation of hard constraints.

#include <ViennaRNA/constraints/hard.h>

Use this definition to indicate the pipe sign ‘|’ (paired with another base)

VRNA_CONSTRAINT_DB_DOT#

dot ‘.’ switch for structure constraints (no constraint at all)

#include <ViennaRNA/constraints/hard.h>

VRNA_CONSTRAINT_DB_X#

‘x’ switch for structure constraint (base must not pair)

#include <ViennaRNA/constraints/hard.h>

VRNA_CONSTRAINT_DB_RND_BRACK#

round brackets ‘(‘,’)’ switch for structure constraint (base i pairs base j)

#include <ViennaRNA/constraints/hard.h>

VRNA_CONSTRAINT_DB_INTRAMOL#

Flag that is used to indicate the character ‘l’ in pseudo dot-bracket notation of hard constraints.

#include <ViennaRNA/constraints/hard.h>

Use this definition to indicate the usage of ‘l’ character (intramolecular pairs only)

VRNA_CONSTRAINT_DB_INTERMOL#

Flag that is used to indicate the character ‘e’ in pseudo dot-bracket notation of hard constraints.

#include <ViennaRNA/constraints/hard.h>

Use this definition to indicate the usage of ‘e’ character (intermolecular pairs only)

VRNA_CONSTRAINT_DB_GQUAD#

‘+’ switch for structure constraint (base is involved in a gquad)

#include <ViennaRNA/constraints/hard.h>

Warning

This flag is for future purposes only! No implementation recognizes it yet.

VRNA_CONSTRAINT_DB_WUSS#

Flag to indicate Washington University Secondary Structure (WUSS) notation of the hard constraint string.

#include <ViennaRNA/constraints/hard.h>

This secondary structure notation for RNAs is usually used as consensus secondary structure (SS_cons) entry in Stockholm formatted files

VRNA_CONSTRAINT_DB_DEFAULT#

Switch for dot-bracket structure constraint with default symbols.

#include <ViennaRNA/constraints/hard.h>

This flag conveniently combines all possible symbols in dot-bracket notation for hard constraints and VRNA_CONSTRAINT_DB

VRNA_CONSTRAINT_CONTEXT_EXT_LOOP#

Hard constraints flag, base pair in the exterior loop.

#include <ViennaRNA/constraints/hard.h>
VRNA_CONSTRAINT_CONTEXT_HP_LOOP#

Hard constraints flag, base pair encloses hairpin loop.

#include <ViennaRNA/constraints/hard.h>
VRNA_CONSTRAINT_CONTEXT_INT_LOOP#

Hard constraints flag, base pair encloses an internal loop.

#include <ViennaRNA/constraints/hard.h>
VRNA_CONSTRAINT_CONTEXT_INT_LOOP_ENC#

Hard constraints flag, base pair encloses a multi branch loop.

#include <ViennaRNA/constraints/hard.h>
VRNA_CONSTRAINT_CONTEXT_MB_LOOP#

Hard constraints flag, base pair is enclosed in an internal loop.

#include <ViennaRNA/constraints/hard.h>
VRNA_CONSTRAINT_CONTEXT_MB_LOOP_ENC#

Hard constraints flag, base pair is enclosed in a multi branch loop.

#include <ViennaRNA/constraints/hard.h>
VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS#

Constraint context flag indicating any loop context.

#include <ViennaRNA/constraints/hard.h>

Typedefs

typedef struct vrna_hc_s vrna_hc_t#

Typename for the hard constraints data structure vrna_hc_s.

#include <ViennaRNA/constraints/hard.h>
typedef struct vrna_hc_up_s vrna_hc_up_t#

Typename for the single nucleotide hard constraint data structure vrna_hc_up_s.

#include <ViennaRNA/constraints/hard.h>
typedef unsigned char (*vrna_hc_eval_f)(int i, int j, int k, int l, unsigned char d, void *data)#

Callback to evaluate whether or not a particular decomposition step is contributing to the solution space.

#include <ViennaRNA/constraints/hard.h>

This is the prototype for callback functions used by the folding recursions to evaluate generic hard constraints. The first four parameters passed indicate the delimiting nucleotide positions of the decomposition, and the parameter denotes the decomposition step. The last parameter data is the auxiliary data structure associated to the hard constraints via vrna_hc_add_data(), or NULL if no auxiliary data was added.

Notes on Callback Functions:

This callback enables one to over-rule default hard constraints in secondary structure decompositions.

Param i:

Left (5’) delimiter position of substructure

Param j:

Right (3’) delimiter position of substructure

Param k:

Left delimiter of decomposition

Param l:

Right delimiter of decomposition

Param d:

Decomposition step indicator

Param data:

Auxiliary data

Return:

A non-zero value if the decomposition is valid, 0 otherwise

Functions

void vrna_constraints_add(vrna_fold_compound_t *fc, const char *constraint, unsigned int options)#

Add constraints to a vrna_fold_compound_t data structure.

#include <ViennaRNA/constraints/basic.h>

Use this function to add/update the hard/soft constraints The function allows for passing a string ‘constraint’ that can either be a filename that points to a constraints definition file or it may be a pseudo dot-bracket notation indicating hard constraints. For the latter, the user has to pass the VRNA_CONSTRAINT_DB option. Also, the user has to specify, which characters are allowed to be interpreted as constraints by passing the corresponding options via the third parameter.

The following is an example for adding hard constraints given in pseudo dot-bracket notation. Here, fc is the vrna_fold_compound_t object, structure is a char array with the hard constraint in dot-bracket notation, and enforceConstraints is a flag indicating whether or not constraints for base pairs should be enforced instead of just doing a removal of base pair that conflict with the constraint.

unsigned int constraint_options = VRNA_CONSTRAINT_DB_DEFAULT;

if (enforceConstraints)
        constraint_options |= VRNA_CONSTRAINT_DB_ENFORCE_BP;

if (canonicalBPonly)
        constraint_options |= VRNA_CONSTRAINT_DB_CANONICAL_BP;

vrna_constraints_add(fc, (const char *)cstruc, constraint_options);

In constrat to the above, constraints may also be read from file:

vrna_constraints_add(fc, constraints_file, VRNA_OPTION_DEFAULT);

Parameters:
  • fc – The fold compound

  • constraint – A string with either the filename of the constraint definitions or a pseudo dot-bracket notation of the hard constraint. May be NULL.

  • options – The option flags

void vrna_hc_init(vrna_fold_compound_t *fc)#

Initialize/Reset hard constraints to default values.

#include <ViennaRNA/constraints/hard.h>

This function resets the hard constraints to their default values, i.e. all positions may be unpaired in all contexts, and base pairs are allowed in all contexts, if they resemble canonical pairs. Previously set hard constraints will be removed before initialization.

SWIG Wrapper Notes:

This function is attached as method hc_init() to objects of type fold_compound. See, e.g. RNA.fold_compound.hc_init() in the The RNA Python module .

Parameters:
  • fc – The fold compound

void vrna_hc_add_up(vrna_fold_compound_t *fc, unsigned int i, unsigned char option)#

Make a certain nucleotide unpaired.

#include <ViennaRNA/constraints/hard.h>

Parameters:
  • fc – The vrna_fold_compound_t the hard constraints are associated with

  • i – The position that needs to stay unpaired (1-based)

  • option – The options flag indicating how/where to store the hard constraints

int vrna_hc_add_up_strand(vrna_fold_compound_t *fc, unsigned int i, int strand, unsigned char option)#

Make a certain nucleotide unpaired.

#include <ViennaRNA/constraints/hard.h>

This function puts a constraint onto a single nucleotide to limit or enforce its structural context. The position i should be given in local coordinates relative to the strand strand it corresponds to.

Note

A negative value for the strand number strand indicates autodetection of the strand number assuming that coordinate i is given as global coordinates for the (current) concatenation of all strands. In this case, the function behaves exactly as vrna_hc_add_up().

Parameters:
  • fc – The vrna_fold_compound_t the hard constraints are associated with

  • i – The position that needs to stay unpaired (1-based)

  • strand – The strand number of nucleotide i (0-based, negative value for autodetect)

  • option – The options flag indicating how/where to store the hard constraints

int vrna_hc_add_up_batch(vrna_fold_compound_t *fc, vrna_hc_up_t *constraints)#

Apply a list of hard constraints for single nucleotides.

#include <ViennaRNA/constraints/hard.h>
Parameters:
  • fc – The vrna_fold_compound_t the hard constraints are associated with

  • constraints – The list off constraints to apply, last entry must have position attribute set to 0

int vrna_hc_add_bp(vrna_fold_compound_t *fc, unsigned int i, unsigned int j, unsigned char option)#

Favorize/Enforce a certain base pair (i,j).

#include <ViennaRNA/constraints/hard.h>

Parameters:
  • fc – The vrna_fold_compound_t the hard constraints are associated with

  • i – The 5’ located nucleotide position of the base pair (1-based)

  • j – The 3’ located nucleotide position of the base pair (1-based)

  • option – The options flag indicating how/where to store the hard constraints

int vrna_hc_add_bp_strand(vrna_fold_compound_t *fc, unsigned int i, unsigned int j, int strand_i, int strand_j, unsigned char option)#

Favorize/Enforce a certain base pair (i,j) where i and j may point to different strands.

#include <ViennaRNA/constraints/hard.h>

This function adds a base pair constraint for pair (i,j), where the positions i and j are relative to the RNA strands i and j correspond to. For each strand strand_i and strand_j positions are 1-based. For instance, if position 5 of strand 0 must pair with position 10 of strand 1, the function call would be

vrna_hc_add_bp(fc, 5, 10, 0, 1, VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS | VRNA_CONSTRAINT_CONTEXT_ENFORCE);

Negative values for the strand numbers strand_i and strand_j indicate autodetection of the strand number assuming that coordinates i and/or j are given as global coordinates for the (current) concatenation of all strands

Parameters:
  • fc – The vrna_fold_compound_t the hard constraints are associated with

  • i – The 5’ located nucleotide position of the base pair (1-based, relative to strand_i)

  • j – The 3’ located nucleotide position of the base pair (1-based, relative to strand_j)

  • strand_i – The strand number of pairing partner i (0-based, negative value for autodetect)

  • strand_j – The strand number of pairing partner j (0-based, negative value for autodetect)

  • option – The option flag(s) indicating loop types and enforcement of the constraint

void vrna_hc_add_bp_nonspecific(vrna_fold_compound_t *fc, unsigned int i, int d, unsigned char option)#

Enforce a nucleotide to be paired (upstream/downstream).

#include <ViennaRNA/constraints/hard.h>

Parameters:
  • fc – The vrna_fold_compound_t the hard constraints are associated with

  • i – The position that needs to stay unpaired (1-based)

  • d – The direction of base pairing ( \( d < 0 \): pairs upstream, \( d > 0 \): pairs downstream, \( d == 0 \): no direction)

  • option – The options flag indicating in which loop type context the pairs may appear

void vrna_hc_free(vrna_hc_t *hc)#

Free the memory allocated by a vrna_hc_t data structure.

#include <ViennaRNA/constraints/hard.h>

Use this function to free all memory that was allocated for a data structure of type vrna_hc_t .

See also

get_hard_constraints(), vrna_hc_t

void vrna_hc_add_data(vrna_fold_compound_t *fc, void *data, vrna_auxdata_free_f f)#

Add an auxiliary data structure for the generic hard constraints callback function.

#include <ViennaRNA/constraints/hard.h>

See also

vrna_hc_add_f()

Parameters:
  • fc – The fold compound the generic hard constraint function should be bound to

  • data – A pointer to the data structure that holds required data for function ‘f’

  • f – A pointer to a function that free’s the memory occupied by data (Maybe NULL)

int vrna_hc_add_from_db(vrna_fold_compound_t *fc, const char *constraint, unsigned int options)#

Add hard constraints from pseudo dot-bracket notation.

#include <ViennaRNA/constraints/hard.h>

This function allows one to apply hard constraints from a pseudo dot-bracket notation. The options parameter controls, which characters are recognized by the parser. Use the VRNA_CONSTRAINT_DB_DEFAULT convenience macro, if you want to allow all known characters

SWIG Wrapper Notes:

This function is attached as method hc_add_from_db() to objects of type fold_compound. See, e.g. RNA.fold_compound.hc_add_from_db() in the The RNA Python module .

Parameters:
  • fc – The fold compound

  • constraint – A pseudo dot-bracket notation of the hard constraint.

  • options – The option flags

struct vrna_hc_s#
#include <ViennaRNA/constraints/hard.h>

The hard constraints data structure.

The content of this data structure determines the decomposition pattern used in the folding recursions. Attribute ‘matrix’ is used as source for the branching pattern of the decompositions during all folding recursions. Any entry in matrix[i,j] consists of the 6 LSB that allows one to distinguish the following types of base pairs:

The four linear arrays ‘up_xxx’ provide the number of available unpaired nucleotides (including position i) 3’ of each position in the sequence.

Public Members

vrna_hc_type_e type#
#include <ViennaRNA/constraints/hard.h>
unsigned int n#
#include <ViennaRNA/constraints/hard.h>
unsigned int strands#
#include <ViennaRNA/constraints/hard.h>
unsigned int *sn#
#include <ViennaRNA/constraints/hard.h>
unsigned char state#
#include <ViennaRNA/constraints/hard.h>
unsigned char *mx#
#include <ViennaRNA/constraints/hard.h>
unsigned char **matrix_local#
#include <ViennaRNA/constraints/hard.h>
unsigned int *up_ext#

A linear array that holds the number of allowed unpaired nucleotides in an exterior loop.

#include <ViennaRNA/constraints/hard.h>
unsigned int *up_hp#

A linear array that holds the number of allowed unpaired nucleotides in a hairpin loop.

#include <ViennaRNA/constraints/hard.h>
unsigned int *up_int#

A linear array that holds the number of allowed unpaired nucleotides in an internal loop.

#include <ViennaRNA/constraints/hard.h>
unsigned int *up_ml#

A linear array that holds the number of allowed unpaired nucleotides in a multi branched loop.

#include <ViennaRNA/constraints/hard.h>
vrna_hc_eval_f f#

A function pointer that returns whether or not a certain decomposition may be evaluated.

#include <ViennaRNA/constraints/hard.h>
void *data#

A pointer to some structure where the user may store necessary data to evaluate its generic hard constraint function.

#include <ViennaRNA/constraints/hard.h>
vrna_auxdata_free_f free_data#

A pointer to a function to free memory occupied by auxiliary data.

#include <ViennaRNA/constraints/hard.h>

The function this pointer is pointing to will be called upon destruction of the vrna_hc_s, and provided with the vrna_hc_s.data pointer that may hold auxiliary data. Hence, to avoid leaking memory, the user may use this pointer to free memory occupied by auxiliary data.

vrna_hc_depot_t *depot#
#include <ViennaRNA/constraints/hard.h>
vrna_hc_eval_loop_f eval_ext#
#include <ViennaRNA/constraints/hard.h>
vrna_hc_eval_hp_f eval_hp#
#include <ViennaRNA/constraints/hard.h>
vrna_hc_eval_int_f eval_int#
#include <ViennaRNA/constraints/hard.h>
vrna_hc_eval_loop_f eval_mb#
#include <ViennaRNA/constraints/hard.h>
struct vrna_hc_up_s#
#include <ViennaRNA/constraints/hard.h>

A single hard constraint for a single nucleotide.

Public Members

int position#

The sequence position (1-based).

#include <ViennaRNA/constraints/hard.h>
int strand#
#include <ViennaRNA/constraints/hard.h>
unsigned char options#

The hard constraint option.

#include <ViennaRNA/constraints/hard.h>

Soft Constraints API#

Functions and data structures for secondary structure soft constraints.

Common API symbols#

Typedefs

typedef struct vrna_sc_s vrna_sc_t#

Typename for the soft constraints data structure vrna_sc_s.

#include <ViennaRNA/constraints/soft.h>

Enums

enum vrna_sc_type_e#

The type of a soft constraint.

#include <ViennaRNA/constraints/soft.h>

Values:

enumerator VRNA_SC_DEFAULT#

Default Soft Constraints.

enumerator VRNA_SC_WINDOW#

Soft Constraints suitable for local structure prediction using window approach.

Functions

void vrna_sc_init(vrna_fold_compound_t *fc)#

Initialize an empty soft constraints data structure within a vrna_fold_compound_t.

#include <ViennaRNA/constraints/soft.h>

This function adds a proper soft constraints data structure to the vrna_fold_compound_t data structure. If soft constraints already exist within the fold compound, they are removed.

SWIG Wrapper Notes:

This function is attached as method sc_init() to objects of type fold_compound. See, e.g. RNA.fold_compound.sc_init() in the The RNA Python module .

Parameters:
int vrna_sc_prepare(vrna_fold_compound_t *fc, unsigned int options)#

Prepare soft constraints.

#include <ViennaRNA/constraints/soft.h>
int vrna_sc_update(vrna_fold_compound_t *fc, unsigned int i, unsigned int options)#

Update/prepare soft constraints for sliding-window computations.

#include <ViennaRNA/constraints/soft.h>
void vrna_sc_remove(vrna_fold_compound_t *fc)#

Remove soft constraints from vrna_fold_compound_t.

#include <ViennaRNA/constraints/soft.h>

SWIG Wrapper Notes:

This function is attached as method sc_remove() to objects of type fold_compound. See, e.g. RNA.fold_compound.sc_remove() in the The RNA Python module .

Parameters:
void vrna_sc_free(vrna_sc_t *sc)#

Free memory occupied by a vrna_sc_t data structure.

#include <ViennaRNA/constraints/soft.h>
Parameters:
  • sc – The data structure to free from memory

struct vrna_sc_bp_storage_t#
#include <ViennaRNA/constraints/soft.h>

A base pair constraint.

Public Members

unsigned int interval_start#
#include <ViennaRNA/constraints/soft.h>
unsigned int interval_end#
#include <ViennaRNA/constraints/soft.h>
int e#
#include <ViennaRNA/constraints/soft.h>
struct vrna_sc_s#
#include <ViennaRNA/constraints/soft.h>

The soft constraints data structure.

Common data fields

const vrna_sc_type_e type#

Type of the soft constraints data structure.

#include <ViennaRNA/constraints/soft.h>
unsigned int n#

Length of the sequence this soft constraints data structure belongs to.

#include <ViennaRNA/constraints/soft.h>
unsigned char state#

Current state of the soft constraints data structure.

#include <ViennaRNA/constraints/soft.h>
int **energy_up#

Energy contribution for stretches of unpaired nucleotides.

#include <ViennaRNA/constraints/soft.h>
FLT_OR_DBL **exp_energy_up#

Boltzmann Factors of the energy contributions for unpaired sequence stretches.

#include <ViennaRNA/constraints/soft.h>
int *up_storage#

Storage container for energy contributions per unpaired nucleotide.

#include <ViennaRNA/constraints/soft.h>
vrna_sc_bp_storage_t **bp_storage#

Storage container for energy contributions per base pair.

#include <ViennaRNA/constraints/soft.h>
int *energy_stack#

Pseudo Energy contribution per base pair involved in a stack.

#include <ViennaRNA/constraints/soft.h>
FLT_OR_DBL *exp_energy_stack#

Boltzmann weighted pseudo energy contribution per nucleotide involved in a stack.

#include <ViennaRNA/constraints/soft.h>

User-defined data fields

vrna_sc_f f#

A function pointer used for pseudo energy contribution in MFE calculations.

#include <ViennaRNA/constraints/soft.h>

See also

vrna_sc_add_f()

vrna_sc_bt_f bt#

A function pointer used to obtain backtraced base pairs in loop regions that were altered by soft constrained pseudo energy contributions.

#include <ViennaRNA/constraints/soft.h>

See also

vrna_sc_add_bt()

vrna_sc_exp_f exp_f#

A function pointer used for pseudo energy contribution boltzmann factors in PF calculations.

#include <ViennaRNA/constraints/soft.h>

void *data#

A pointer to the data object provided for for pseudo energy contribution functions of the generic soft constraints feature.

#include <ViennaRNA/constraints/soft.h>
vrna_auxdata_prepare_f prepare_data#
#include <ViennaRNA/constraints/soft.h>
vrna_auxdata_free_f free_data#
#include <ViennaRNA/constraints/soft.h>

Public Members

union vrna_sc_s.[anonymous] [anonymous]#
#include <ViennaRNA/constraints/soft.h>
[union].__unnamed0__

Public Members

struct vrna_sc_s.[anonymous].[anonymous] [anonymous]#
#include <ViennaRNA/constraints/soft.h>
struct vrna_sc_s.[anonymous].[anonymous] [anonymous]#
#include <ViennaRNA/constraints/soft.h>
[struct].__unnamed0__.__unnamed0__

Global structure prediction data fields

int *energy_bp#

Energy contribution for base pairs.

#include <ViennaRNA/constraints/soft.h>
FLT_OR_DBL *exp_energy_bp#

Boltzmann Factors of the energy contribution for base pairs.

#include <ViennaRNA/constraints/soft.h>
[struct].__unnamed0__.__unnamed1__

Local structure prediction data fields

int **energy_bp_local#

Energy contribution for base pairs (sliding window approach).

#include <ViennaRNA/constraints/soft.h>
FLT_OR_DBL **exp_energy_bp_local#

Boltzmann Factors of the energy contribution for base pairs (sliding window approach).

#include <ViennaRNA/constraints/soft.h>
vrna_sc_s.[union].__unnamed0__

Public Members

struct vrna_sc_s.[anonymous].[anonymous] [anonymous]#
#include <ViennaRNA/constraints/soft.h>
struct vrna_sc_s.[anonymous].[anonymous] [anonymous]#
#include <ViennaRNA/constraints/soft.h>
[struct].__unnamed0__.__unnamed0__

Global structure prediction data fields

int *energy_bp#

Energy contribution for base pairs.

#include <ViennaRNA/constraints/soft.h>
FLT_OR_DBL *exp_energy_bp#

Boltzmann Factors of the energy contribution for base pairs.

#include <ViennaRNA/constraints/soft.h>
[struct].__unnamed0__.__unnamed1__

Local structure prediction data fields

int **energy_bp_local#

Energy contribution for base pairs (sliding window approach).

#include <ViennaRNA/constraints/soft.h>
FLT_OR_DBL **exp_energy_bp_local#

Boltzmann Factors of the energy contribution for base pairs (sliding window approach).

#include <ViennaRNA/constraints/soft.h>
vrna_sc_s.[struct].__unnamed0__.__unnamed0__

Global structure prediction data fields

int *energy_bp#

Energy contribution for base pairs.

#include <ViennaRNA/constraints/soft.h>
FLT_OR_DBL *exp_energy_bp#

Boltzmann Factors of the energy contribution for base pairs.

#include <ViennaRNA/constraints/soft.h>
vrna_sc_s.[struct].__unnamed0__.__unnamed1__

Local structure prediction data fields

int **energy_bp_local#

Energy contribution for base pairs (sliding window approach).

#include <ViennaRNA/constraints/soft.h>
FLT_OR_DBL **exp_energy_bp_local#

Boltzmann Factors of the energy contribution for base pairs (sliding window approach).

#include <ViennaRNA/constraints/soft.h>

Constraints for Unpaired Positions#

Functions

int vrna_sc_set_up(vrna_fold_compound_t *fc, const FLT_OR_DBL *constraints, unsigned int options)#

Set soft constraints for unpaired nucleotides.

#include <ViennaRNA/constraints/soft.h>

SWIG Wrapper Notes:

This function is attached as method sc_set_up() to objects of type fold_compound. See, e.g. RNA.fold_compound.sc_set_up() in the The RNA Python module .

Note

This function replaces any pre-exisitng soft constraints with the ones supplied in constraints.

Parameters:
  • fc – The vrna_fold_compound_t the soft constraints are associated with

  • constraints – A vector of pseudo free energies in \( kcal / mol \)

  • options – The options flag indicating how/where to store the soft constraints

Returns:

Non-zero on successful application of the constraint, 0 otherwise.

int vrna_sc_set_up_comparative(vrna_fold_compound_t *fc, const FLT_OR_DBL **constraints, unsigned int options)#

Set soft constraints for unpaired nucleotides in comparative structure predictions.

#include <ViennaRNA/constraints/soft.h>

Use this function to set soft constraints for unpaired nucleotides for each sequence in the multiple sequence alignment (MSA). The constraints are provided as 0-based array of 1-based array with the actual pseudo energies, where the first dimension corresponds to the number (0-based) of the respective sequence in the alignment. If no constraints are provided for a particular sequence \( s \) in the MSA, the corresponding entry must be set to NULL.

See also

vrna_sc_set_up_comparative_seq(), vrna_sc_add_up_comparative(), vrna_sc_set_bp_comparative(), vrna_sc_add_stack_comparative(), vrna_sc_set_stack_comparative(), vrna_sc_set_up()

Note

This function replaces any pre-exisitng soft constraints with the ones supplied in constraints.

Warning

Pseudo energies for all sequences must be provided in sequence coordinates rather than alignment coordinates!

Parameters:
  • fc – The vrna_fold_compound_t the soft constraints are associated with

  • constraints – A 0-based array of 1-based arrays with pseudo free energies in \( kcal / mol \)

  • options – The options flag indicating how/where to store the soft constraints

Returns:

The number of sequences in the MSA constraints have been applied to

int vrna_sc_set_up_comparative_seq(vrna_fold_compound_t *fc, unsigned int s, const FLT_OR_DBL *constraints, unsigned int options)#

Set soft constraints for unpaired nucleotides in comparative structure predictions.

#include <ViennaRNA/constraints/soft.h>

This is a convenience wrapper for vrna_sc_set_up_comparative() where only one particular sequence s is provided with constraints.

See also

vrna_sc_set_up_comparative(), vrna_sc_add_up_comparative_seq(), vrna_sc_set_bp_comparative_seq(), vrna_sc_add_stack_comparative_seq(), vrna_sc_set_stack_comparative_seq(), vrna_sc_set_up()

Note

This function replaces any pre-exisitng soft constraints with the ones supplied in constraints.

Warning

Pseudo energies for all sequences must be provided in sequence coordinates rather than alignment coordinates!

Parameters:
  • fc – The vrna_fold_compound_t the soft constraints are associated with

  • s – The 0-based number of the sequence in the alignment the constraints are provided for

  • constraints – A 1-based arrays with pseudo free energies in \( kcal / mol \)

  • options – The options flag indicating how/where to store the soft constraints

Returns:

The number of sequences in the MSA constraints have been applied to

int vrna_sc_add_up(vrna_fold_compound_t *fc, unsigned int i, FLT_OR_DBL energy, unsigned int options)#

Add soft constraints for unpaired nucleotides.

#include <ViennaRNA/constraints/soft.h>

SWIG Wrapper Notes:

This function is attached as an overloaded method sc_add_up() to objects of type fold_compound. The method either takes arguments for a single nucleotide \(i \) with the corresponding energy value:

fold_compound.sc_add_up(i, energy, options)
or an entire vector that stores free energy contributions for each nucleotide \(i \) with \( 1 \leq i \leq n \):
fold_compound.sc_add_bp(vector, options)
In both variants, the optional argument options defaults to VRNA_OPTION_DEFAULT. See, e.g. RNA.fold_compound.sc_add_up() in the The RNA Python module .

Parameters:
  • fc – The vrna_fold_compound_t the soft constraints are associated with

  • i – The nucleotide position the soft constraint is added for

  • energy – The free energy (soft-constraint) in \( kcal / mol \)

  • options – The options flag indicating how/where to store the soft constraints

Returns:

Non-zero on successful application of the constraint, 0 otherwise.

int vrna_sc_add_up_comparative(vrna_fold_compound_t *fc, unsigned int *is, const FLT_OR_DBL *energies, unsigned int options)#

Add soft constraints for unpaired nucleotides in comparative structure predictions.

#include <ViennaRNA/constraints/soft.h>

Use this function to add soft constraints for unpaired nucleotides for each sequence in the multiple sequence alignment (MSA). The constraints are provided as 0-based array of pseudo energies, one for each sequence in the MSA. If no constraints are provided for a particular sequence, the corrsponding is value must be 0.

See also

vrna_sc_set_up_comparative_seq(), vrna_sc_add_up_comparative(), vrna_sc_set_bp_comparative(), vrna_sc_add_stack_comparative(), vrna_sc_set_stack_comparative(), vrna_sc_add_up()

Warning

Pseudo energies for all sequences must be provided in sequence coordinates rather than alignment coordinates!

Parameters:
  • fc – The vrna_fold_compound_t the soft constraints are associated with

  • is – A 0-based array of nucleotide positions the soft constraint is added for

  • energies – A 0-based array of free energies (soft-constraint) in \( kcal / mol \)

  • options – The options flag indicating how/where to store the soft constraints

Returns:

Non-zero on successful application of the constraint, 0 otherwise.

int vrna_sc_add_up_comparative_seq(vrna_fold_compound_t *fc, unsigned int s, unsigned int i, const FLT_OR_DBL energy, unsigned int options)#

Add soft constraints for unpaired nucleotides in comparative structure predictions.

#include <ViennaRNA/constraints/soft.h>

This is a convenience wrapper for vrna_sc_add_up_comparative() where only one particular sequence s is provided with constraints.

See also

vrna_sc_set_up_comparative_seq(), vrna_sc_add_up_comparative(), vrna_sc_set_bp_comparative(), vrna_sc_add_stack_comparative(), vrna_sc_set_stack_comparative(), vrna_sc_add_up()

Warning

Pseudo energies for all sequences must be provided in sequence coordinates rather than alignment coordinates!

Parameters:
  • fc – The vrna_fold_compound_t the soft constraints are associated with

  • s – The 0-based number of the sequence in the alignment the constraints are provided for

  • i – The 1-based nucleotide position the soft constraint is added for

  • energy – The free energies (soft-constraint) in \( kcal / mol \)

  • options – The options flag indicating how/where to store the soft constraints

Returns:

Non-zero on successful application of the constraint, 0 otherwise.

Constraints for Base Pairs#

Functions

int vrna_sc_set_bp(vrna_fold_compound_t *fc, const FLT_OR_DBL **constraints, unsigned int options)#

Set soft constraints for paired nucleotides.

#include <ViennaRNA/constraints/soft.h>

SWIG Wrapper Notes:

This function is attached as method sc_set_bp() to objects of type fold_compound. See, e.g. RNA.fold_compound.sc_set_bp() in the The RNA Python module .

Note

This function replaces any pre-exisitng soft constraints with the ones supplied in constraints.

Parameters:
  • fc – The vrna_fold_compound_t the soft constraints are associated with

  • constraints – A two-dimensional array of pseudo free energies in \( kcal / mol \)

  • options – The options flag indicating how/where to store the soft constraints

Returns:

Non-zero on successful application of the constraint, 0 otherwise.

int vrna_sc_set_bp_comparative(vrna_fold_compound_t *fc, const FLT_OR_DBL ***constraints, unsigned int options)#

Set soft constraints for paired nucleotides in comparative structure predictions.

#include <ViennaRNA/constraints/soft.h>

Similar to vrna_sc_set_bp() this function allows to set soft constraints \( e_{i,j}^\mathrm{BP} \) for all base pairs \( (i, j) \) at once using a 1-based upper-triangular matrix \( E_\mathrm{BP} \). Since this function is supposed to be used for comparative structure predictions over a multiple sequence alignment (MSA), a 0-based array of matrices must be supplied as parameter constraints. If no constraints are to be used for sequence \( s \) in the MSA, the corresponding entry may be set to NULL.

Note

This function replaces any pre-exisitng soft constraints with the ones supplied in constraints.

Warning

Currently, base pair constraints must be provided in alignment coordinates rather than sequence coordinates! This may change in the future!

Parameters:
  • fc – The vrna_fold_compound_t the soft constraints are associated with

  • constraints – A 0-based array of 1-based two-dimensional arrays with pseudo free energies in \( kcal / mol \)

  • options – The options flag indicating how/where to store the soft constraints

Returns:

The number of sequences in the MSA constraints have been applied to

int vrna_sc_set_bp_comparative_seq(vrna_fold_compound_t *fc, unsigned int s, const FLT_OR_DBL **constraints, unsigned int options)#

Set soft constraints for paired nucleotides in comparative structure predictions.

#include <ViennaRNA/constraints/soft.h>

This is a convenience wrapper for vrna_sc_set_bp_comparative() where only one particular sequence s is provided with constraints.

See also

vrna_sc_set_bp_comparative(), vrna_sc_add_bp_comparative(), vrna_sc_set_up_comparative_seq(), vrna_sc_add_up_comparative_seq(), vrna_sc_set_stack_comparative_seq(), vrna_sc_add_stack_comparative_seq(), vrna_sc_set_bp()

Note

This function replaces any pre-exisitng soft constraints with the ones supplied in constraints.

Warning

This function not only re-sets the constraints for sequence s in the MSA but will also remove all constraints for all other sequences!

Warning

Currently, base pair constraints must be provided in alignment coordinates rather than sequence coordinates! This may change in the future!

Parameters:
  • fc – The vrna_fold_compound_t the soft constraints are associated with

  • s – The 0-based number of the sequence in the alignment the constraints are provided for

  • constraints – A 1-based two-dimensional array of pseudo free energies in \( kcal / mol \)

  • options – The options flag indicating how/where to store the soft constraints

Returns:

The number of sequences in the MSA constraints have been applied to

int vrna_sc_add_bp(vrna_fold_compound_t *fc, unsigned int i, unsigned int j, FLT_OR_DBL energy, unsigned int options)#

Add soft constraints for paired nucleotides.

#include <ViennaRNA/constraints/soft.h>

SWIG Wrapper Notes:

This function is attached as an overloaded method sc_add_bp() to objects of type fold_compound. The method either takes arguments for a single base pair (i,j) with the corresponding energy value:

fold_compound.sc_add_bp(i, j, energy, options)
or an entire 2-dimensional matrix with dimensions n x n that stores free energy contributions for any base pair (i,j) with \( 1 \leq i < j \leq n \):
fold_compound.sc_add_bp(matrix, options)
In both variants, the optional argument options defaults to VRNA_OPTION_DEFAULT. See, e.g. RNA.fold_compound.sc_add_bp() in the The RNA Python module .

Parameters:
  • fc – The vrna_fold_compound_t the soft constraints are associated with

  • i – The 5’ position of the base pair the soft constraint is added for

  • j – The 3’ position of the base pair the soft constraint is added for

  • energy – The free energy (soft-constraint) in \( kcal / mol \)

  • options – The options flag indicating how/where to store the soft constraints

Returns:

Non-zero on successful application of the constraint, 0 otherwise.

int vrna_sc_add_bp_comparative(vrna_fold_compound_t *fc, unsigned int *is, unsigned int *js, const FLT_OR_DBL *energies, unsigned int options)#

Add soft constraints for paired nucleotides in comparative structure predictions.

#include <ViennaRNA/constraints/soft.h>

Similar to vrna_sc_add_bp(), this function allows to add soft constraints \( e_{i,j}^\mathrm{BP} \) for all base pairs \( (i, j) \) in the multiple sequence alignment (MSA). The actual pairing partners \( i \) and \( j \) for each sequence in the MSA are provided in the form of 0-based arrays as parameters is and js. The corresponding energy contributions are provided as 0-based array in parameter energies. If no constraint is provided for sequence \( s \) in the MSA, the corresponding is value must be set to 0.

Note

Consecutive calls of this function with the same is and js accumulate to corresponding energies values, i.e. energies are added up onto each other.

Warning

Currently, base pair constraints must be provided in alignment coordinates rather than sequence coordinates! This may change in the future!

Parameters:
  • fc – The vrna_fold_compound_t the soft constraints are associated with

  • is – A 0-based array of 5’ position of the base pairs the soft constraint is added for

  • js – A 0-based array of 3’ position of the base pairs the soft constraint is added for

  • energies – A 0-based array of free energies (soft-constraint) in \( kcal / mol \)

  • options – The options flag indicating how/where to store the soft constraints

Returns:

The number of sequences in the MSA constraints have been applied to

int vrna_sc_add_bp_comparative_seq(vrna_fold_compound_t *fc, unsigned int s, unsigned int i, unsigned int j, FLT_OR_DBL energy, unsigned int options)#

Add soft constraints for paired nucleotides in comparative structure predictions.

#include <ViennaRNA/constraints/soft.h>

This is a convenience wrapper for vrna_sc_add_bp_comparative() where only one particular sequence s is provided with constraints.

Note

Consecutive calls of this function with the same i and j accumulate to corresponding energies values, i.e. energies are added up onto each other.

Warning

Currently, base pair constraints must be provided in alignment coordinates rather than sequence coordinates! This may change in the future!

Parameters:
  • fc – The vrna_fold_compound_t the soft constraints are associated with

  • s – The 0-based number of the sequence in the alignment the constraints are provided for

  • i – 5’ position of the base pairs the soft constraint is added for

  • j – 3’ position of the base pairs the soft constraint is added for

  • energy – Free energy (soft-constraint) in \( kcal / mol \)

  • options – The options flag indicating how/where to store the soft constraints

Returns:

The number of sequences in the MSA constraints have been applied to

Constraints for Stacked Base Pairs#

Functions

int vrna_sc_set_stack(vrna_fold_compound_t *fc, const FLT_OR_DBL *constraints, unsigned int options)#
#include <ViennaRNA/constraints/soft.h>
int vrna_sc_set_stack_comparative(vrna_fold_compound_t *fc, const FLT_OR_DBL **constraints, unsigned int options)#
#include <ViennaRNA/constraints/soft.h>
int vrna_sc_set_stack_comparative_seq(vrna_fold_compound_t *fc, unsigned int s, const FLT_OR_DBL *constraints, unsigned int options)#
#include <ViennaRNA/constraints/soft.h>
int vrna_sc_add_stack(vrna_fold_compound_t *fc, unsigned int i, FLT_OR_DBL energy, unsigned int options)#
#include <ViennaRNA/constraints/soft.h>
int vrna_sc_add_stack_comparative(vrna_fold_compound_t *fc, unsigned int *is, const FLT_OR_DBL *energies, unsigned int options)#
#include <ViennaRNA/constraints/soft.h>
int vrna_sc_add_stack_comparative_seq(vrna_fold_compound_t *fc, unsigned int s, unsigned int i, FLT_OR_DBL energy, unsigned int options)#
#include <ViennaRNA/constraints/soft.h>

Generic implementation#

Typedefs

typedef int (*vrna_sc_f)(int i, int j, int k, int l, unsigned char d, void *data)#

Callback to retrieve pseudo energy contribution for soft constraint feature.

#include <ViennaRNA/constraints/soft.h>

This is the prototype for callback functions used by the folding recursions to evaluate generic soft constraints. The first four parameters passed indicate the delimiting nucleotide positions of the decomposition, and the parameter denotes the decomposition step. The last parameter data is the auxiliary data structure associated to the hard constraints via vrna_sc_add_data(), or NULL if no auxiliary data was added.

Notes on Callback Functions:

This callback enables one to add (pseudo-)energy contributions to individual decompositions of the secondary structure.

Param i:

Left (5’) delimiter position of substructure

Param j:

Right (3’) delimiter position of substructure

Param k:

Left delimiter of decomposition

Param l:

Right delimiter of decomposition

Param d:

Decomposition step indicator

Param data:

Auxiliary data

Return:

Pseudo energy contribution in deka-kalories per mol

typedef int vrna_callback_sc_energy(int i, int j, int k, int l, unsigned char d, void *data)#
#include <ViennaRNA/constraints/soft.h>
typedef int (*vrna_sc_direct_f)(vrna_fold_compound_t *fc, int i, int j, int k, int l, void *data)#
#include <ViennaRNA/constraints/soft.h>
typedef FLT_OR_DBL (*vrna_sc_exp_f)(int i, int j, int k, int l, unsigned char d, void *data)#

Callback to retrieve pseudo energy contribution as Boltzmann Factors for soft constraint feature.

#include <ViennaRNA/constraints/soft.h>

This is the prototype for callback functions used by the partition function recursions to evaluate generic soft constraints. The first four parameters passed indicate the delimiting nucleotide positions of the decomposition, and the parameter denotes the decomposition step. The last parameter data is the auxiliary data structure associated to the hard constraints via vrna_sc_add_data(), or NULL if no auxiliary data was added.

Notes on Callback Functions:

This callback enables one to add (pseudo-)energy contributions to individual decompositions of the secondary structure (Partition function variant, i.e. contributions must be returned as Boltzmann factors).

Param i:

Left (5’) delimiter position of substructure

Param j:

Right (3’) delimiter position of substructure

Param k:

Left delimiter of decomposition

Param l:

Right delimiter of decomposition

Param d:

Decomposition step indicator

Param data:

Auxiliary data

Return:

Pseudo energy contribution in deka-kalories per mol

typedef FLT_OR_DBL vrna_callback_sc_exp_energy(int i, int j, int k, int l, unsigned char d, void *data)#
#include <ViennaRNA/constraints/soft.h>
typedef FLT_OR_DBL (*vrna_sc_exp_direct_f)(vrna_fold_compound_t *fc, int i, int j, int k, int l, void *data)#
#include <ViennaRNA/constraints/soft.h>
typedef vrna_basepair_t *(*vrna_sc_bt_f)(int i, int j, int k, int l, unsigned char d, void *data)#

Callback to retrieve auxiliary base pairs for soft constraint feature.

#include <ViennaRNA/constraints/soft.h>

Notes on Callback Functions:

This callback enables one to add auxiliary base pairs in the backtracking steps of hairpin- and internal loops.

Param i:

Left (5’) delimiter position of substructure

Param j:

Right (3’) delimiter position of substructure

Param k:

Left delimiter of decomposition

Param l:

Right delimiter of decomposition

Param d:

Decomposition step indicator

Param data:

Auxiliary data

Return:

List of additional base pairs

typedef vrna_basepair_t *vrna_callback_sc_backtrack(int i, int j, int k, int l, unsigned char d, void *data)#
#include <ViennaRNA/constraints/soft.h>

Functions

int vrna_sc_add_data(vrna_fold_compound_t *fc, void *data, vrna_auxdata_free_f free_data)#

Add an auxiliary data structure for the generic soft constraints callback function.

#include <ViennaRNA/constraints/soft.h>

SWIG Wrapper Notes:

This function is attached as method sc_add_data() to objects of type fold_compound. See, e.g. RNA.fold_compound.sc_add_data() in the The RNA Python module .

Parameters:
  • fc – The fold compound the generic soft constraint function should be bound to

  • data – A pointer to the data structure that holds required data for function ‘f’

  • free_data – A pointer to a function that free’s the memory occupied by data (Maybe NULL)

Returns:

Non-zero on successful binding the data (and free-function), 0 otherwise

int vrna_sc_add_auxdata(vrna_fold_compound_t *fc, void *data, vrna_auxdata_prepare_f prepare_cb, vrna_auxdata_free_f free_cb)#
#include <ViennaRNA/constraints/soft.h>
int vrna_sc_set_data_comparative(vrna_fold_compound_t *fc, void **data, vrna_auxdata_free_f *free_data, unsigned int options)#
#include <ViennaRNA/constraints/soft.h>
int vrna_sc_set_data_comparative_seq(vrna_fold_compound_t *fc, unsigned int s, void *data, vrna_auxdata_free_f free_data, unsigned int options)#
#include <ViennaRNA/constraints/soft.h>
int vrna_sc_set_auxdata_comparative(vrna_fold_compound_t *fc, void **data, vrna_auxdata_prepare_f *prepare_cbs, vrna_auxdata_free_f *free_data, unsigned int options)#
#include <ViennaRNA/constraints/soft.h>
int vrna_sc_set_auxdata_comparative_seq(vrna_fold_compound_t *fc, unsigned int s, void *data, vrna_auxdata_prepare_f prepare_cb, vrna_auxdata_free_f free_data, unsigned int options)#
#include <ViennaRNA/constraints/soft.h>
int vrna_sc_add_f(vrna_fold_compound_t *fc, vrna_sc_f f)#

Bind a function pointer for generic soft constraint feature (MFE version).

#include <ViennaRNA/constraints/soft.h>

This function allows one to easily bind a function pointer and corresponding data structure to the soft constraint part vrna_sc_t of the vrna_fold_compound_t. The function for evaluating the generic soft constraint feature has to return a pseudo free energy \( \hat{E} \) in \( dacal/mol \), where \( 1 dacal/mol = 10 cal/mol \).

SWIG Wrapper Notes:

This function is attached as method sc_add_f() to objects of type fold_compound. See, e.g. RNA.fold_compound.sc_add_f() in the The RNA Python module .

Parameters:
  • fc – The fold compound the generic soft constraint function should be bound to

  • f – A pointer to the function that evaluates the generic soft constraint feature

Returns:

Non-zero on successful binding the callback function, 0 otherwise

size_t vrna_sc_multi_cb_add(vrna_fold_compound_t *fc, vrna_sc_direct_f cb, vrna_sc_exp_direct_f cb_exp, void *data, vrna_auxdata_prepare_f prepare_cb, vrna_auxdata_free_f free_cb, unsigned int decomp_type)#
#include <ViennaRNA/constraints/soft.h>
size_t vrna_sc_multi_cb_add_comparative(vrna_fold_compound_t *fc, vrna_sc_direct_f *cbs, vrna_sc_exp_direct_f *cbs_exp, void **datas, vrna_auxdata_prepare_f *prepare_cbs, vrna_auxdata_free_f *free_cbs, unsigned int *ds, unsigned int multi_params)#
#include <ViennaRNA/constraints/soft.h>
int vrna_sc_set_f_comparative(vrna_fold_compound_t *fc, vrna_sc_f *f, unsigned int options)#
#include <ViennaRNA/constraints/soft.h>
int vrna_sc_add_bt(vrna_fold_compound_t *fc, vrna_sc_bt_f f)#

Bind a backtracking function pointer for generic soft constraint feature.

#include <ViennaRNA/constraints/soft.h>

This function allows one to easily bind a function pointer to the soft constraint part vrna_sc_t of the vrna_fold_compound_t. The provided function should be used for backtracking purposes in loop regions that were altered via the generic soft constraint feature. It has to return an array of vrna_basepair_t data structures, were the last element in the list is indicated by a value of -1 in it’s i position.

SWIG Wrapper Notes:

This function is attached as method sc_add_bt() to objects of type fold_compound. See, e.g. RNA.fold_compound.sc_add_bt() in the The RNA Python module .

Parameters:
  • fc – The fold compound the generic soft constraint function should be bound to

  • f – A pointer to the function that returns additional base pairs

Returns:

Non-zero on successful binding the callback function, 0 otherwise

int vrna_sc_add_exp_f(vrna_fold_compound_t *fc, vrna_sc_exp_f exp_f)#

Bind a function pointer for generic soft constraint feature (PF version).

#include <ViennaRNA/constraints/soft.h>

This function allows one to easily bind a function pointer and corresponding data structure to the soft constraint part vrna_sc_t of the vrna_fold_compound_t. The function for evaluating the generic soft constraint feature has to return a pseudo free energy \( \hat{E} \) as Boltzmann factor, i.e. \( exp(- \hat{E} / kT) \). The required unit for \( E \) is \( cal/mol \).

SWIG Wrapper Notes:

This function is attached as method sc_add_exp_f() to objects of type fold_compound. See, e.g. RNA.fold_compound.sc_add_exp_f() in the The RNA Python module .

Parameters:
  • fc – The fold compound the generic soft constraint function should be bound to

  • exp_f – A pointer to the function that evaluates the generic soft constraint feature

Returns:

Non-zero on successful binding the callback function, 0 otherwise

int vrna_sc_set_exp_f_comparative(vrna_fold_compound_t *fc, vrna_sc_exp_f *exp_f, unsigned int options)#
#include <ViennaRNA/constraints/soft.h>