Python API
Almost all symbols of the API available in our RNAlib C-library is wrapped for
use in Python using swig
. That makes our fast and efficient algorithms and
tools available for third-party Python programs and scripting languages.
Note
Our Python API is automatically generated and translated from our C-library documentation. If you find anything problematic or want to to help us improve the documentation, do not hesitate to contact us or make a PR at our official github repository.
Installation
The Python interface is usually part of the installation of the ViennaRNA Package, see also Installation and Scripting Language Interfaces.
If for any reason your installation does not provide our Python interface or
in cases where you don’t want to install the full ViennaRNA Package but only
the Python bindings to RNAlib, you may also install them via Pythons pip
:
python -m pip install viennarna
Usage
To use our Python bindings simply import
the RNA
or ViennaRNA
package
like
import RNA
or
import ViennaRNA
The RNA
module that provides access to our RNAlib C-library can also be imported
directly using
from RNA import RNA
or
from ViennaRNA import RNA
Note
In previous release of the ViennaRNA Packge, only the RNA
package/module has
been available.
Since version 2.6.2 we maintain the ViennaRNA
project at https://pypi.org. The former maintainer additionally introduced the
ViennaRNA
package which we intend to keep and extend in future releases.
Global Variables
For the Python interface(s) SWIG places global variables of the C-library
into an additional namespace cvar
. For instance, changing the global temperature
variable thus becomes
RNA.cvar.temperature = 25
Pythonic interface
Since our library is written in C
the functions we provide in our API might
seem awkward for users more familiar with Pythons object oriented fashion. Therefore,
we spend some effort on creating a more pythonic interface here. In particular, we
tried to group together particular data structures and functions operating on them to
derive classes and objects with corresponding methods attached.
If you browse through our reference manual, many C-functions have additional
SWIG Wrapper Notes in their description. These descriptions should give an idea how
the function is available in the Python interface. Usually, our C
functions,
data structures, typedefs, and enumerations use the vrna_
prefixes and _s
,
_t
, _e
suffixes. Those decorators are useful in C
but of less use in the
context of Python packages or modules. Therefore, these prefixes and suffixes are
dropped from the Python interface.
Object orientation
Consider the C-function vrna_fold_compound()
. This creates a
vrna_fold_compound_t
data structure that is then passed around to various
functions, e.g. to vrna_mfe()
to compute the MFE structure.
A corresponding C-code may look like this:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ViennaRNA/utils/basic.h>
#include <ViennaRNA/fold_compound.h>
#include <ViennaRNA/mfe.h>
int
main(int argc,
char *argv[])
{
char *seq, *ss;
float mfe;
vrna_fold_compound_t *fc;
seq = "AGACGACAAGGUUGAAUCGCACCCACAGUCUAUGAGUCGGUG";
ss = vrna_alloc(sizeof(char) * (strlen(seq) + 1));
fc = vrna_fold_compound(seq, NULL, VRNA_OPTION_DEFAULT);
mfe = vrna_mfe(fc, ss);
printf("%s\n%s (%6.2f)\n", seq, ss, mfe);
return EXIT_SUCCESS;
}
In our Python interface, the vrna_fold_compound_t
data structure becomes the
RNA.fold_compound
class, the vrna_fold_compound()
becomes one of
its constructors and the vrna_mfe()
function becomes the method
RNA.fold_compound.mfe()
. So, the Python code would probably translate
to something like
import RNA
seq = "AGACGACAAGGUUGAAUCGCACCCACAGUCUAUGAGUCGGUG"
fc = RNA.fold_compound(seq)
(ss, mfe) = fc.mfe()
print(f"{seq}\n{ss} ({mfe:6.2f})")
Note
The C-function vrna_mfe()
actually returns two values, the MFE in units
of \(\text{kcal} \cdot \text{mol}^{-1}\) and the corresponding MFE structure.
The latter is written to the ss
pointer. This is necessary since C
functions
can at most return one single value. In Python, function and methods may return
arbitrarily many values instead, and in addition, passing parameters to a function
or method such that it changes its content is generally discouraged. Therefore,
our functions that return values through function parameters usually return them
regularly in the Python interface.
Lists and Tuples
C-functions in our API that return or receive list-like data usually utilize pointers.
Since there are no such things in Python, they would be wrapped as particular kind of
objects that would then be tedious to work with. For the Python interface, we therefore
tried to wrap the majority of these instances to native Python types, such as list
or tuple
. Therefore, one can usually pass a list
to a function that uses pointers
to array in C
, and expect to receive a list
or tuple
from functions that return
pointers to arrays.
Energy Parameters
Energy parameters are compiled into our library, so there is usually no necessity to load them from a file. All parameter files shipped with the ViennaRNA Package can be loaded by simply calling any of the dedicated functions:
RNA.params_load_RNA_Turner2004()
(default RNA parameters)RNA.params_load_DNA_Mathews2004()
(default DNA parameters)RNA.params_load_DNA_Mathews1999()
(old DNA parameters)RNA.params_load_RNA_Turner1999()
(old RNA parameters)RNA.params_load_RNA_Andronescu2007()
(trained RNA parameters)RNA.params_load_RNA_Langdon2018()
(trained RNA parameters)RNA.params_load_RNA_misc_special_hairpins()
(special hairpin loop parameters)
Examples
A few more Python code examples can be found here.
The RNA
Python module
A library for the prediction and comparison of RNA secondary structures.
Amongst other things, our implementations allow you to:
predict minimum free energy secondary structures
calculate the partition function for the ensemble of structures
compute various equilibrium probabilities
calculate suboptimal structures in a given energy range
compute local structures in long sequences
predict consensus secondary structures from a multiple sequence alignment
predict melting curves
search for sequences folding into a given structure
compare two secondary structures
predict interactions between multiple RNA molecules
- class RNA.COORDINATE
Bases:
object
this is a workarround for the SWIG Perl Wrapper RNA plot function that returns an array of type COORDINATE
- X
- Type:
float
- Y
- Type:
float
this is a workarround for the SWIG Perl Wrapper RNA plot function that returns an array of type COORDINATE
- X
- Type:
float
- Y
- Type:
float
- property X
- property Y
- get(i)
- property thisown
The membership flag
- class RNA.ConstCharVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- class RNA.CoordinateVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- class RNA.DoubleDoubleVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- class RNA.DoublePair(*args)
Bases:
object
- property first
- property second
- property thisown
The membership flag
- class RNA.DoubleVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- class RNA.DuplexVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- RNA.E_ExtLoop(type, si1, sj1, P)
- RNA.E_GQuad_IntLoop_L(i, j, type, S, ggg, maxdist, P)
- RNA.E_GQuad_IntLoop_L_comparative(i, j, tt, S_cons, S5, S3, a2s, ggg, n_seq, P)
- RNA.E_Hairpin(size, type, si1, sj1, string, P)
Compute the Energy of a hairpin-loop.
To evaluate the free energy of a hairpin-loop, several parameters have to be known. A general hairpin-loop has this structure:
a3 a4
a2 a5 a1 a6
X - Y | | 5’ 3’
where X-Y marks the closing pair [e.g. a (G,C) pair]. The length of this loop is 6 as there are six unpaired nucleotides (a1-a6) enclosed by (X,Y). The 5’ mismatching nucleotide is a1 while the 3’ mismatch is a6. The nucleotide sequence of this loop is “a1.a2.a3.a4.a5.a6”
- Parameters:
size (
int
) – The size of the loop (number of unpaired nucleotides)type (
int
) – The pair type of the base pair closing the hairpinsi1 (
int
) – The 5’-mismatching nucleotidesj1 (
int
) – The 3’-mismatching nucleotidestring (
string
) – The sequence of the loop (May be NULL, otherwise mst be at least \(size + 2\) long)P (
RNA.param() *
) – The datastructure containing scaled energy parameters
- Returns:
The Free energy of the Hairpin-loop in dcal/mol
- Return type:
int
Warning
Not (really) thread safe! A threadsafe implementation will replace this function in a future release!
Energy evaluation may change due to updates in global variable “tetra_loop”
See also
scale_parameters
,RNA.param
Note
The parameter sequence should contain the sequence of the loop in capital letters of the nucleic acid alphabet if the loop size is below 7. This is useful for unusually stable tri-, tetra- and hexa-loops which are treated differently (based on experimental data) if they are tabulated.
- RNA.E_IntLoop(n1, n2, type, type_2, si1, sj1, sp1, sq1, P)
Compute the Energy of an internal-loop
This function computes the free energy \(\Delta G\) of an internal-loop with the following structure:
3’ 5’ | | U - V
- a_n b_1
. . . . . .
- a_1 b_m
X - Y | | 5’ 3’
This general structure depicts an internal-loop that is closed by the base pair (X,Y). The enclosed base pair is (V,U) which leaves the unpaired bases a_1-a_n and b_1-b_n that constitute the loop. In this example, the length of the internal-loop is \((n+m)\) where n or m may be 0 resulting in a bulge-loop or base pair stack. The mismatching nucleotides for the closing pair (X,Y) are: 5’-mismatch: a_1 3’-mismatch: b_m and for the enclosed base pair (V,U): 5’-mismatch: b_1 3’-mismatch: a_n
- param n1:
The size of the ‘left’-loop (number of unpaired nucleotides)
- type n1:
int
- param n2:
The size of the ‘right’-loop (number of unpaired nucleotides)
- type n2:
int
- param type:
The pair type of the base pair closing the internal loop
- type type:
int
- param type_2:
The pair type of the enclosed base pair
- type type_2:
int
- param si1:
The 5’-mismatching nucleotide of the closing pair
- type si1:
int
- param sj1:
The 3’-mismatching nucleotide of the closing pair
- type sj1:
int
- param sp1:
The 3’-mismatching nucleotide of the enclosed pair
- type sp1:
int
- param sq1:
The 5’-mismatching nucleotide of the enclosed pair
- type sq1:
int
- param P:
The datastructure containing scaled energy parameters
- type P:
RNA.param() *
- returns:
The Free energy of the Interior-loop in dcal/mol
- rtype:
int
See also
scale_parameters
,RNA.param
Note
Base pairs are always denoted in 5’->3’ direction. Thus the enclosed base pair must be ‘turned arround’ when evaluating the free energy of the internal-loop
This function is threadsafe
- RNA.E_IntLoop_Co(type, type_2, i, j, p, q, cutpoint, si1, sj1, sp1, sq1, dangles, P)
- RNA.E_MLstem(type, si1, sj1, P)
- RNA.E_Stem(type, si1, sj1, extLoop, P)
Compute the energy contribution of a stem branching off a loop-region.
This function computes the energy contribution of a stem that branches off a loop region. This can be the case in multiloops, when a stem branching off increases the degree of the loop but also immediately interior base pairs of an exterior loop contribute free energy. To switch the behavior of the function according to the evaluation of a multiloop- or exterior-loop-stem, you pass the flag ‘extLoop’. The returned energy contribution consists of a TerminalAU penalty if the pair type is greater than 2, dangling end contributions of mismatching nucleotides adjacent to the stem if only one of the si1, sj1 parameters is greater than 0 and mismatch energies if both mismatching nucleotides are positive values. Thus, to avoid incorporating dangling end or mismatch energies just pass a negative number, e.g. -1 to the mismatch argument.
- This is an illustration of how the energy contribution is assembled:
3’ 5’ | | X - Y
5’-si1 sj1-3’
Here, (X,Y) is the base pair that closes the stem that branches off a loop region. The nucleotides si1 and sj1 are the 5’- and 3’- mismatches, respectively. If the base pair type of (X,Y) is greater than 2 (i.e. an A-U or G-U pair, the TerminalAU penalty will be included in the energy contribution returned. If si1 and sj1 are both nonnegative numbers, mismatch energies will also be included. If one of si1 or sj1 is a negative value, only 5’ or 3’ dangling end contributions are taken into account. To prohibit any of these mismatch contributions to be incorporated, just pass a negative number to both, si1 and sj1. In case the argument extLoop is 0, the returned energy contribution also includes the internal-loop-penalty of a multiloop stem with closing pair type.
Deprecated since version 2.7.0: Please use one of the functions RNA.E_exterior_stem() and RNA.E_multibranch_stem() instead! Use the former for cases where extLoop != 0 and the latter otherwise.
See also
RNA.E_multibranch_stem
,_ExtLoop
Note
This function is threadsafe
- Parameters:
type (
int
) – The pair type of the first base pair un the stemsi1 (
int
) – The 5’-mismatching nucleotidesj1 (
int
) – The 3’-mismatching nucleotideextLoop (
int
) – A flag that indicates whether the contribution reflects the one of an exterior loop or notP (
RNA.param() *
) – The data structure containing scaled energy parameters
- Returns:
The Free energy of the branch off the loop in dcal/mol
- Return type:
int
- RNA.E_gquad(L, l, P)
- RNA.E_gquad_ali_en(i, L, l, S, a2s, n_seq, P, en)
- RNA.E_ml_rightmost_stem(i, j, fc)
- class RNA.ElemProbVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- class RNA.HeatCapacityVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- class RNA.HelixVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- class RNA.IntIntVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- class RNA.IntVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- RNA.Lfold(sequence, window_size, nullfile=None)
Local MFE prediction using a sliding window approach (simplified interface)
This simplified interface to RNA.fold_compound.mfe_window() computes the MFE and locally optimal secondary structure using default options. Structures are predicted using a sliding window approach, where base pairs may not span outside the window. Memory required for dynamic programming (DP) matrices will be allocated and free’d on-the-fly. Hence, after return of this function, the recursively filled matrices are not available any more for any post-processing.
SWIG Wrapper Notes
This function is available as overloaded function Lfold() in the global namespace. The parameter file defaults to NULL and may be omitted. See e.g.
RNA.Lfold()
in the Python API.- Parameters:
string (
string
) – The nucleic acid sequencewindow_size (
int
) – The window size for locally optimal structuresfile (
FILE *
) – The output file handle where predictions are written to (if NULL, output is written to stdout)
Note
In case you want to use the filled DP matrices for any subsequent post-processing step, or you require other conditions than specified by the default model details, use RNA.fold_compound.mfe_window(), and the data structure RNA.fold_compound() instead.
- RNA.Lfold_cb(char * string, int window_size, PyObject * PyFunc, PyObject * data) float
- RNA.Lfoldz(sequence, window_size, min_z, nullfile=None)
Local MFE prediction using a sliding window approach with z-score cut-off (simplified interface)
This simplified interface to RNA.fold_compound.mfe_window_zscore() computes the MFE and locally optimal secondary structure using default options. Structures are predicted using a sliding window approach, where base pairs may not span outside the window. Memory required for dynamic programming (DP) matrices will be allocated and free’d on-the-fly. Hence, after return of this function, the recursively filled matrices are not available any more for any post-processing. This function is the z-score version of RNA.Lfold(), i.e. only predictions above a certain z-score cut-off value are printed.
- Parameters:
string (
string
) – The nucleic acid sequencewindow_size (
int
) – The window size for locally optimal structuresmin_z (
double
) – The minimal z-score for a predicted structure to appear in the outputfile (
FILE *
) – The output file handle where predictions are written to (if NULL, output is written to stdout)
Note
In case you want to use the filled DP matrices for any subsequent post-processing step, or you require other conditions than specified by the default model details, use RNA.fold_compound.mfe_window(), and the data structure RNA.fold_compound() instead.
- RNA.Lfoldz_cb(char * string, int window_size, double min_z, PyObject * PyFunc, PyObject * data) float
- RNA.MEA_from_plist(*args)
Compute a MEA (maximum expected accuracy) structure from a list of probabilities.
The algorithm maximizes the expected accuracy
\[A(S) = \sum_{(i,j) \in S} 2 \gamma p_{ij} + \sum_{i \notin S} p^u_{i}\]Higher values of \(\gamma\) result in more base pairs of lower probability and thus higher sensitivity. Low values of \(\gamma\) result in structures containing only highly likely pairs (high specificity). The code of the MEA function also demonstrates the use of sparse dynamic programming scheme to reduce the time and memory complexity of folding.
SWIG Wrapper Notes
This function is available as overloaded function MEA_from_plist`(gamma = 1., md = NULL). Note, that it returns the MEA structure and MEA value as a tuple (MEA_structure, MEA). See, e.g. :py:func:`RNA.MEA_from_plist() in the Python API.
- Parameters:
plist (
RNA.ep() *
) – A list of base pair probabilities the MEA structure is computed fromsequence (
string
) – The RNA sequence that corresponds to the list of probability valuesgamma (
double
) – The weighting factor for base pairs vs. unpaired nucleotidesmd (
RNA.md() *
) – A model details data structure (maybe NULL)mea (
list-like(double)
) – A pointer to a variable where the MEA value will be written to
- Returns:
An MEA structure (or NULL on any error)
- Return type:
string
Note
The unpaired probabilities \(p^u_{i} = 1 - \sum_{j \neq i} p_{ij}\) are usually computed from the supplied pairing probabilities \(p_{ij}\) as stored in plist entries of type RNA.PLIST_TYPE_BASEPAIR. To overwrite individual \(p^u_{o}\) values simply add entries with type RNA.PLIST_TYPE_UNPAIRED
To include G-Quadruplex support, the corresponding field in md must be set.
- RNA.Make_bp_profile(length)
Deprecated since version 2.7.0: This function is deprecated and will be removed soon! See Make_bp_profile_bppm() for a replacement
See also
Note
This function is NOT threadsafe
- RNA.Make_bp_profile_bppm(bppm, length)
condense pair probability matrix into a vector containing probabilities for unpaired, upstream paired and downstream paired.
This resulting probability profile is used as input for profile_edit_distance
- Parameters:
bppm (
list-like(double)
) – A pointer to the base pair probability matrixlength (
int
) – The length of the sequence
- Returns:
The bp profile
- Return type:
list-like(double)
- RNA.Make_swString(string)
Convert a structure into a format suitable for string_edit_distance().
- Parameters:
string (
string
) –- Return type:
swString *
- class RNA.MoveVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- RNA.PS_color_dot_plot(string, pi, filename)
- RNA.PS_color_dot_plot_turn(seq, pi, filename, winSize)
- RNA.PS_dot_plot(string, file)
Produce postscript dot-plot.
Wrapper to PS_dot_plot_list
Reads base pair probabilities produced by pf_fold() from the global array pr and the pair list base_pair produced by fold() and produces a postscript “dot plot” that is written to ‘filename’. The “dot plot” represents each base pairing probability by a square of corresponding area in a upper triangle matrix. The lower part of the matrix contains the minimum free energy
Deprecated since version 2.7.0: This function is deprecated and will be removed soon! Use PS_dot_plot_list() instead!
Note
DO NOT USE THIS FUNCTION ANYMORE SINCE IT IS NOT THREADSAFE
- RNA.PS_dot_plot_list(seq, filename, pl, mf, comment)
Produce a postscript dot-plot from two pair lists.
This function reads two plist structures (e.g. base pair probabilities and a secondary structure) as produced by assign_plist_from_pr() and assign_plist_from_db() and produces a postscript “dot plot” that is written to ‘filename’. Using base pair probabilities in the first and mfe structure in the second plist, the resulting “dot plot” represents each base pairing probability by a square of corresponding area in a upper triangle matrix. The lower part of the matrix contains the minimum free energy structure.
- Parameters:
seq (
string
) – The RNA sequencefilename (
string
) – A filename for the postscript outputpl (
RNA.ep() *
) – The base pair probability pairlistmf (
RNA.ep() *
) – The mfe secondary structure pairlistcomment (
string
) – A comment
- Returns:
1 if postscript was successfully written, 0 otherwise
- Return type:
int
See also
assign_plist_from_pr
,assign_plist_from_db
- RNA.PS_dot_plot_turn(seq, pl, filename, winSize)
- RNA.PS_rna_plot(string, structure, file)
Produce a secondary structure graph in PostScript and write it to ‘filename’.
Deprecated since version 2.7.0: Use RNA.file_PS_rnaplot() instead!
- RNA.PS_rna_plot_a(string, structure, file, pre, post)
Produce a secondary structure graph in PostScript including additional annotation macros and write it to ‘filename’.
Deprecated since version 2.7.0: Use RNA.file_PS_rnaplot_a() instead!
- RNA.PS_rna_plot_a_gquad(string, structure, ssfile, pre, post)
Produce a secondary structure graph in PostScript including additional annotation macros and write it to ‘filename’ (detect and draw g-quadruplexes)
Deprecated since version 2.7.0: Use RNA.file_PS_rnaplot_a() instead!
- class RNA.PathVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- class RNA.SOLUTION
Bases:
object
- property energy
- get(i)
- size()
- property structure
- property thisown
The membership flag
- class RNA.SOLUTIONVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- class RNA.StringVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- class RNA.SuboptVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- class RNA.SwigPyIterator(*args, **kwargs)
Bases:
object
- advance(n)
- copy()
- decr(n=1)
- distance(x)
- equal(x)
- incr(n=1)
- next()
- previous()
- property thisown
The membership flag
- value()
- class RNA.UIntUIntVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- class RNA.UIntVector(*args)
Bases:
object
- append(x)
- assign(n, x)
- back()
- begin()
- capacity()
- clear()
- empty()
- end()
- erase(*args)
- front()
- get_allocator()
- insert(*args)
- iterator()
- pop()
- pop_back()
- push_back(x)
- rbegin()
- rend()
- reserve(n)
- resize(*args)
- size()
- swap(v)
- property thisown
The membership flag
- RNA.abstract_shapes(std::string structure, unsigned int level=5) std::string
- RNA.abstract_shapes(IntVector pt, unsigned int level=5) std::string
- RNA.abstract_shapes(varArrayShort pt, unsigned int level=5) std::string
Convert a secondary structure in dot-bracket notation to its abstract shapes representation.
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 parameter level defaults to 5. See, e.g.
RNA.abstract_shapes()
in the Python API.- Parameters:
structure (
string
) – A secondary structure in dot-bracket notationlevel (
unsigned int
) – The abstraction level (integer in the range of 0 to 5)
- Returns:
The secondary structure in abstract shapes notation
- Return type:
string
See also
RNA.abstract_shapes_pt
- RNA.add_root(arg1)
Adds a root to an un-rooted tree in any except bracket notation.
- Parameters:
structure (
string
) –- Return type:
string
- RNA.aliLfold(alignment, window_size, nullfile=None)
SWIG Wrapper Notes
This function is available as overloaded function aliLfold() in the global namespace. The parameter fp defaults to NULL and may be omitted. See e.g.
RNA.aliLfold()
in the Python API.
- RNA.aliLfold_cb(StringVector alignment, int window_size, PyObject * PyFunc, PyObject * data) float
- RNA.aliduplex_subopt(StringVector alignment1, StringVector alignment2, int delta, int w) DuplexVector
- RNA.aliduplexfold(StringVector alignment1, StringVector alignment2) duplex_list_t
- RNA.alifold(*args)
Compute Minimum Free Energy (MFE), and a corresponding consensus secondary structure for an RNA sequence alignment using a comparative method.
This simplified interface to RNA.fold_compound.mfe() computes the MFE and, if required, a consensus secondary structure for an RNA sequence alignment using default options. Memory required for dynamic programming (DP) matrices will be allocated and free’d on-the-fly. Hence, after return of this function, the recursively filled matrices are not available any more for any post-processing, e.g. suboptimal backtracking, etc.
SWIG Wrapper Notes
This function is available as function alifold() in the global namespace. The parameter structure is returned along with the MFE und must not be provided. See e.g.
RNA.alifold()
in the Python API.- Parameters:
sequences (
const char **
) – RNA sequence alignmentstructure (
string
) – A pointer to the character array where the secondary structure in dot-bracket notation will be written to
- Returns:
the minimum free energy (MFE) in kcal/mol
- Return type:
float
See also
Note
In case you want to use the filled DP matrices for any subsequent post-processing step, or you require other conditions than specified by the default model details, use RNA.fold_compound.mfe(), and the data structure RNA.fold_compound() instead.
- RNA.aln_consensus_mis(StringVector alignment, md md_p=None) std::string
Compute the Most Informative Sequence (MIS) for a given multiple sequence alignment.
The most informative sequence (MIS) [Freyhult et al., 2005] displays for each alignment column the nucleotides with frequency greater than the background frequency, projected into IUPAC notation. Columns where gaps are over-represented are in lower case.
SWIG Wrapper Notes
This function is available as overloaded function aln_consensus_mis() where the last parameter may be omitted, indicating md = NULL. See e.g.
RNA.aln_consensus_mis()
in the Python API.- Parameters:
alignment (
const char **
) – The input sequence alignment (last entry must be NULL terminated)md_p (
const RNA.md() *
) – Model details that specify known nucleotides (Maybe NULL)
- Returns:
The most informative sequence for the alignment
- Return type:
string
- RNA.aln_consensus_sequence(StringVector alignment, md md_p=None) std::string
Compute the consensus sequence for a given multiple sequence alignment.
SWIG Wrapper Notes
This function is available as overloaded function aln_consensus_sequence() where the last parameter may be omitted, indicating md = NULL. See e.g.
RNA.aln_consensus_sequence()
in the Python API.- Parameters:
alignment (
const char **
) – The input sequence alignment (last entry must be NULL terminated)md_p (
const RNA.md() *
) – Model details that specify known nucleotides (Maybe NULL)
- Returns:
The consensus sequence of the alignment, i.e. the most frequent nucleotide for each alignment column
- Return type:
string
- RNA.aln_conservation_col(StringVector alignment, md md=None, unsigned int options=) DoubleVector
Compute nucleotide conservation in an alignment.
This function computes the conservation of nucleotides in alignment columns. The simples measure is Shannon Entropy and can be selected by passing the RNA.MEASURE_SHANNON_ENTROPY flag in the options parameter.
SWIG Wrapper Notes
This function is available as overloaded function aln_conservation_col() where the last two parameters may be omitted, indicating md = NULL, and options = RNA.MEASURE_SHANNON_ENTROPY, respectively. See e.g.
RNA.aln_conservation_col()
in the Python API.- Parameters:
alignment (
const char **
) – The input sequence alignment (last entry must be NULL terminated)md – Model details that specify known nucleotides (Maybe NULL)
options (
unsigned int
) – A flag indicating which measure of conservation should be applied
- Returns:
A 1-based vector of column conservations
- Return type:
list-like(double)
See also
RNA.MEASURE_SHANNON_ENTROPY
Note
Currently, only RNA.MEASURE_SHANNON_ENTROPY is supported as conservation measure.
- RNA.aln_conservation_struct(StringVector alignment, std::string structure, md md=None) DoubleVector
Compute base pair conservation of a consensus structure.
This function computes the base pair conservation (fraction of canonical base pairs) of a consensus structure given a multiple sequence alignment. The base pair types that are considered canonical may be specified using the RNA.md().pair array. Passing NULL as parameter md results in default pairing rules, i.e. canonical Watson-Crick and GU Wobble pairs.
SWIG Wrapper Notes
This function is available as overloaded function aln_conservation_struct() where the last parameter md may be omitted, indicating md = NULL. See, e.g.
RNA.aln_conservation_struct()
in the Python API.- Parameters:
alignment (
const char **
) – The input sequence alignment (last entry must be NULL terminated)structure (
string
) – The consensus structure in dot-bracket notationmd (
const RNA.md() *
) – Model details that specify compatible base pairs (Maybe NULL)
- Returns:
A 1-based vector of base pair conservations
- Return type:
list-like(double)
- RNA.aln_mpi(StringVector alignment) int
Get the mean pairwise identity in steps from ?to?(ident)
SWIG Wrapper Notes
This function is available as function aln_mpi(). See e.g.
RNA.aln_mpi()
in the Python API.- Parameters:
alignment (
const char **
) – Aligned sequences- Returns:
The mean pairwise identity
- Return type:
int
- RNA.aln_pscore(StringVector alignment, md md=None) IntIntVector
SWIG Wrapper Notes
This function is available as overloaded function aln_pscore() where the last parameter may be omitted, indicating md = NULL. See e.g.
RNA.aln_pscore()
in the Python API.
- RNA.b2C(structure)
Converts the full structure from bracket notation to the a coarse grained notation using the ‘H’ ‘B’ ‘I’ ‘M’ and ‘R’ identifiers.
Deprecated since version 2.7.0: See RNA.db_to_tree_string() and RNA.STRUCTURE_TREE_SHAPIRO_SHORT for a replacement
- Parameters:
structure (
string
) –- Return type:
string
- RNA.b2HIT(structure)
Converts the full structure from bracket notation to the HIT notation including root.
Deprecated since version 2.7.0: See RNA.db_to_tree_string() and RNA.STRUCTURE_TREE_HIT for a replacement
- Parameters:
structure (
string
) –- Return type:
string
- RNA.b2Shapiro(structure)
Converts the full structure from bracket notation to the weighted coarse grained notation using the ‘H’ ‘B’ ‘I’ ‘M’ ‘S’ ‘E’ and ‘R’ identifiers.
Deprecated since version 2.7.0: See RNA.db_to_tree_string() and RNA.STRUCTURE_TREE_SHAPIRO_WEIGHT for a replacement
- Parameters:
structure (
string
) –- Return type:
string
- RNA.backtrack_GQuad_IntLoop_L(c, i, j, type, S, ggg, maxdist, p, q, P)
backtrack an internal loop like enclosed g-quadruplex with closing pair (i,j) with underlying Lfold matrix
- Parameters:
c (
int
) – The total contribution the loop should resemblei (
int
) – position i of enclosing pairj (
int
) – position j of enclosing pairtype (
int
) – base pair type of enclosing pair (must be reverse type)S (
list-like(int)
) – integer encoded sequenceggg (
int **
) – triangular matrix containing g-quadruplex contributionsp (
int *
) – here the 5’ position of the gquad is storedq (
int *
) – here the 3’ position of the gquad is storedP (
RNA.param() *
) – the datastructure containing the precalculated contibutions
- Returns:
1 on success, 0 if no gquad found
- Return type:
int
- RNA.backtrack_GQuad_IntLoop_L_comparative(c, i, j, type, S_cons, S5, S3, a2s, ggg, p, q, n_seq, P)
- class RNA.basepair
Bases:
object
Typename for base pair element.
Deprecated since version 2.7.0: Use RNA.bp() instead!
- i
- Type:
int
- j
- Type:
int
Typename for base pair element.
Deprecated since version 2.7.0: Use RNA.bp() instead!
- i
- Type:
int
- j
- Type:
int
- property i
- property j
- property thisown
The membership flag
- RNA.boustrophedon(*args)
Generate a sequence of Boustrophedon distributed numbers.
This function generates a sequence of positive natural numbers within the interval \([start, end]\) in a Boustrophedon fashion. That is, the numbers \(start, \ldots, end\) in the resulting list are alternating between left and right ends of the interval while progressing to the inside, i.e. the list consists of a sequence of natural numbers of the form:
\[start, end, start + 1, end - 1, start + 2, end - 2, \ldots\]The resulting list is 1-based and contains the length of the sequence of numbers at it’s 0-th position.
Upon failure, the function returns NULL
SWIG Wrapper Notes
This function is available as overloaded global function boustrophedon(). See, e.g.
RNA.boustrophedon()
in the Python API .- Parameters:
start (
size()
) – The first number of the list (left side of the interval)end (
size()
) – The last number of the list (right side of the interval)
- Returns:
A list of alternating numbers from the interval \([start, end]\) (or NULL on error)
- Return type:
list-like(unsigned int)
See also
RNA.boustrophedon_pos
- RNA.bp_distance(std::string str1, std::string str2, unsigned int options=) int
- RNA.bp_distance(IntVector pt1, IntVector pt2) int
- RNA.bp_distance(varArrayShort pt1, varArrayShort pt2) int
Compute the “base pair” distance between two secondary structures s1 and s2.
This is a wrapper around RNA.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 RNA.ptable_from_string(). The resulting pair tables are then internally passed to RNA.bp_distance_pt(). To control which kind of matching brackets will be used during conversion, the optional argument options can be used. See also the description of RNA.ptable_from_string() for available options. (default: RNA.BRACKETS_RND). See, e.g.
RNA.bp_distance()
in the Python API.- Parameters:
str1 (
string
) – First structure in dot-bracket notationstr2 (
string
) – Second structure in dot-bracket notation
- Returns:
The base pair distance between str1 and str2
- Return type:
int
See also
RNA.bp_distance_pt
- RNA.cdata(ptr, nelements=1)
- RNA.centroid(length, dist)
Deprecated since version 2.7.0: This function is deprecated and should not be used anymore as it is not threadsafe!
See also
- RNA.circalifold(*args)
Compute MFE and according structure of an alignment of sequences assuming the sequences are circular instead of linear.
Deprecated since version 2.7.0: Usage of this function is discouraged! Use RNA.alicircfold(), and RNA.fold_compound.mfe() instead!
- Parameters:
strings (
const char **
) – A pointer to a NULL terminated array of character arraysstructure (
string
) – A pointer to a character array that may contain a constraining consensus structure (will be overwritten by a consensus structure that exhibits the MFE)
- Returns:
The free energy score in kcal/mol
- Return type:
float
See also
RNA.alicircfold
,RNA.alifold
,RNA.fold_compound.mfe
- RNA.circfold(*args)
Compute Minimum Free Energy (MFE), and a corresponding secondary structure for a circular RNA sequence.
This simplified interface to RNA.fold_compound.mfe() computes the MFE and, if required, a secondary structure for a circular RNA sequence using default options. Memory required for dynamic programming (DP) matrices will be allocated and free’d on-the-fly. Hence, after return of this function, the recursively filled matrices are not available any more for any post-processing, e.g. suboptimal backtracking, etc.
Folding of circular RNA sequences is handled as a post-processing step of the forward recursions. See Hofacker and Stadler [2006] for further details.
SWIG Wrapper Notes
This function is available as function circfold() in the global namespace. The parameter structure is returned along with the MFE und must not be provided. See e.g.
RNA.circfold()
in the Python API.- Parameters:
sequence (
string
) – RNA sequencestructure (
string
) – A pointer to the character array where the secondary structure in dot-bracket notation will be written to
- Returns:
the minimum free energy (MFE) in kcal/mol
- Return type:
float
See also
Note
In case you want to use the filled DP matrices for any subsequent post-processing step, or you require other conditions than specified by the default model details, use RNA.fold_compound.mfe(), and the data structure RNA.fold_compound() instead.
- RNA.co_pf_fold(*args)
- RNA.cofold(*args)
Compute Minimum Free Energy (MFE), and a corresponding secondary structure for two dimerized RNA sequences.
This simplified interface to RNA.fold_compound.mfe() computes the MFE and, if required, a secondary structure for two RNA sequences upon dimerization using default options. Memory required for dynamic programming (DP) matrices will be allocated and free’d on-the-fly. Hence, after return of this function, the recursively filled matrices are not available any more for any post-processing, e.g. suboptimal backtracking, etc.
Deprecated since version 2.7.0: This function is obsolete since RNA.mfe()/RNA.fold() can handle complexes multiple sequences since v2.5.0. Use RNA.mfe()/RNA.fold() for connected component MFE instead and compute MFEs of unconnected states separately.
Note
In case you want to use the filled DP matrices for any subsequent post-processing step, or you require other conditions than specified by the default model details, use RNA.fold_compound.mfe(), and the data structure RNA.fold_compound() instead.
SWIG Wrapper Notes
This function is available as function cofold() in the global namespace. The parameter structure is returned along with the MFE und must not be provided. See e.g.
RNA.cofold()
in the Python API.- Parameters:
sequence (
string
) – two RNA sequences separated by the ‘&’ characterstructure (
string
) – A pointer to the character array where the secondary structure in dot-bracket notation will be written to
- Returns:
the minimum free energy (MFE) in kcal/mol
- Return type:
float
See also
RNA.fold
,RNA.fold_compound.mfe
,RNA.fold_compound
,RNA.fold_compound
,RNA.cut_point_insert
- RNA.compare_structure(std::string str1, std::string str2, int fuzzy=0, unsigned int options=) score
- RNA.compare_structure(IntVector pt1, IntVector pt2, int fuzzy=0) score
- RNA.compare_structure(varArrayShort pt1, varArrayShort pt2, int fuzzy=0) score
- RNA.consens_mis(alignment, md_p=None)
- RNA.db_flatten(*args)
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 ``() .
SWIG Wrapper Notes
This function flattens an input structure string in-place! The second parameter is optional and defaults to RNA.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 RNA.db_flatten_to(). See, e.g.
RNA.db_flatten()
in the Python API.- Parameters:
structure (
string
) – The structure string where brackets are flattened in-placeoptions (
unsigned int
) – A bitmask to specify which types of brackets should be flattened out
See also
RNA.db_flatten_to
,RNA.BRACKETS_RND
,RNA.BRACKETS_ANG
,RNA.BRACKETS_CLY
,RNA.BRACKETS_SQR
,RNA.BRACKETS_DEFAULT
- RNA.db_from_WUSS(wuss)
Convert a WUSS annotation string to dot-bracket format.
- Parameters:
wuss (
string
) – The input string in WUSS notation- Returns:
A dot-bracket notation of the input secondary structure
- Return type:
string
Note
This function flattens all brackets, and treats pseudo-knots annotated by matching pairs of upper/lowercase letters as unpaired nucleotides
- RNA.db_from_plist(ElemProbVector elem_probs, unsigned int length) std::string
Convert a list of base pairs into dot-bracket notation.
- Parameters:
pairs (
RNA.ep() *
) – A RNA.ep() containing the pairs to be included in the dot-bracket stringn (
unsigned int
) – The length of the structure (number of nucleotides)
- Returns:
The dot-bracket string containing the provided base pairs
- Return type:
string
See also
- RNA.db_from_ptable(IntVector pt) char
- RNA.db_from_ptable(varArrayShort pt) char *
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.
- Parameters:
pt (
const short *
) – The pair table to be copied- Returns:
A char pointer to the dot-bracket string
- Return type:
string
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.
- RNA.db_pack(struc)
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.
- Parameters:
struc (
string
) – The secondary structure in dot-bracket notation- Returns:
The binary encoded structure
- Return type:
string
See also
- RNA.db_pk_remove(std::string structure, unsigned int options=) std::string
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.
SWIG Wrapper Notes
This function is available as an overloaded function db_pk_remove() where the optional second parameter options defaults to RNA.BRACKETS_ANY. See, e.g.
RNA.db_pk_remove()
in the Python API.- Parameters:
structure (
string
) – Input structure in dot-bracket format that may include pseudo-knotsoptions (
unsigned int
) – A bitmask to specify which types of brackets should be processed
- Returns:
The input structure devoid of pseudo-knots in dot-bracket notation
- Return type:
string
See also
RNA.pt_pk_remove
,RNA.db_flatten
,RNA.BRACKETS_RND
,RNA.BRACKETS_ANG
,RNA.BRACKETS_CLY
,RNA.BRACKETS_SQR
,RNA.BRACKETS_ALPHA
,RNA.BRACKETS_DEFAULT
,RNA.BRACKETS_ANY
Note
Brackets in the input structure string that are not covered by the options bitmask will be silently ignored!
- RNA.db_to_element_string(structure)
Convert a secondary structure in dot-bracket notation to a nucleotide annotation of loop contexts.
- Parameters:
structure (
string
) – The secondary structure in dot-bracket notation- Returns:
A string annotating each nucleotide according to it’s structural context
- Return type:
string
- RNA.db_to_tree_string(std::string structure, unsigned int type) std::string
Convert a Dot-Bracket structure string into tree string representation.
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:
RNA.STRUCTURE_TREE_HIT - Homeomorphically Irreducible Tree (HIT) representation of a secondary structure. (See also Fontana et al. [1993] )
RNA.STRUCTURE_TREE_SHAPIRO_SHORT - (short) Coarse Grained representation of a secondary structure (same as Shapiro [1988] , but with root node R and without S nodes for the stems)
RNA.STRUCTURE_TREE_SHAPIRO - (full) Coarse Grained representation of a secondary structure (See also Shapiro [1988] )
RNA.STRUCTURE_TREE_SHAPIRO_EXT - (extended) Coarse Grained representation of a secondary structure (same as Shapiro [1988] , but external nodes denoted as E )
RNA.STRUCTURE_TREE_SHAPIRO_WEIGHT - (weighted) Coarse Grained representation of a secondary structure (same as RNA.STRUCTURE_TREE_SHAPIRO_EXT but with additional weights for number of unpaired nucleotides in loop, and number of pairs in stems)
RNA.STRUCTURE_TREE_EXPANDED - Expanded Tree representation of a secondary structure.
- Parameters:
structure (
string
) – The null-terminated dot-bracket structure stringtype (
unsigned int
) – A switch to determine the type of tree string representation
- Returns:
A tree representation of the input structure
- Return type:
string
See also
sec_structure_representations_tree
- RNA.db_unpack(packed)
Unpack secondary structure previously packed with RNA.db_pack()
Translate a compressed binary string produced by RNA.db_pack() back into the familiar dot-bracket notation.
- Parameters:
packed (
string
) – The binary encoded packed secondary structure- Returns:
The unpacked secondary structure in dot-bracket notation
- Return type:
string
See also
- RNA.delete_doubleP(ary)
- RNA.delete_floatP(ary)
- RNA.delete_intP(ary)
- RNA.delete_shortP(ary)
- RNA.delete_ushortP(ary)
- RNA.deref_any(ptr, index)
- RNA.dist_mountain(str1, str2, p=1)
- class RNA.doubleArray(nelements)
Bases:
object
- cast()
- static frompointer(t)
- property thisown
The membership flag
- RNA.doubleArray_frompointer(t)
- RNA.doubleP_getitem(ary, index)
- RNA.doubleP_setitem(ary, index, value)
- class RNA.duplexT(*args, **kwargs)
Bases:
object
Data structure for RNAduplex.
- i
- Type:
int
- j
- Type:
int
- end
- Type:
int
- structure
- Type:
string
- energy
- Type:
double
- energy_backtrack
- Type:
double
- opening_backtrack_x
- Type:
double
- opening_backtrack_y
- Type:
double
- offset
- Type:
int
- dG1
- Type:
double
- dG2
- Type:
double
- ddG
- Type:
double
- tb
- Type:
int
- te
- Type:
int
- qb
- Type:
int
- qe
- Type:
int
- property dG1
- property dG2
- property ddG
- property end
- property energy
- property energy_backtrack
- property i
- property j
- property offset
- property opening_backtrack_x
- property opening_backtrack_y
- property qb
- property qe
- property structure
- property tb
- property te
- property thisown
The membership flag
- class RNA.duplex_list_t
Bases:
object
- property energy
- property i
- property j
- property structure
- property thisown
The membership flag
- RNA.duplex_subopt(std::string s1, std::string s2, int delta, int w) DuplexVector
- RNA.duplexfold(std::string s1, std::string s2) duplex_list_t
- RNA.encode_seq(sequence)
- RNA.energy_of_circ_struct(string, structure)
Calculate the free energy of an already folded circular RNA
Deprecated since version 2.7.0: This function is deprecated and should not be used in future programs Use energy_of_circ_structure() instead!
Note
This function is not entirely threadsafe! Depending on the state of the global variable eos_debug it prints energy information to stdout or not…
- Parameters:
string (
string
) – RNA sequencestructure (
string
) – secondary structure in dot-bracket notation
- Returns:
the free energy of the input structure given the input sequence in kcal/mol
- Return type:
float
- RNA.energy_of_circ_structure(string, structure, verbosity_level)
Calculate the free energy of an already folded circular RNA.
If verbosity level is set to a value >0, energies of structure elements are printed to stdout
Note
OpenMP: This function relies on several global model settings variables and thus is not to be considered threadsafe. See energy_of_circ_struct_par() for a completely threadsafe implementation.
Deprecated since version 2.7.0: Use RNA.fold_compound.eval_structure() or RNA.fold_compound.eval_structure_verbose() instead!
- Parameters:
string (
string
) – RNA sequencestructure (
string
) – Secondary structure in dot-bracket notationverbosity_level (
int
) – A flag to turn verbose output on/off
- Returns:
The free energy of the input structure given the input sequence in kcal/mol
- Return type:
float
See also
- RNA.energy_of_gquad_structure(string, structure, verbosity_level)
- RNA.energy_of_move(string, structure, m1, m2)
Calculate energy of a move (closing or opening of a base pair)
If the parameters m1 and m2 are negative, it is deletion (opening) of a base pair, otherwise it is insertion (opening).
Deprecated since version 2.7.0: Use RNA.fold_compound.eval_move() instead!
- Parameters:
string (
string
) – RNA sequencestructure (
string
) – secondary structure in dot-bracket notationm1 (
int
) – first coordinate of base pairm2 (
int
) – second coordinate of base pair
- Returns:
energy change of the move in kcal/mol
- Return type:
float
See also
- RNA.energy_of_move_pt(pt, s, s1, m1, m2)
Calculate energy of a move (closing or opening of a base pair)
If the parameters m1 and m2 are negative, it is deletion (opening) of a base pair, otherwise it is insertion (opening).
Deprecated since version 2.7.0: Use RNA.fold_compound.eval_move_pt() instead!
- Parameters:
pt (
list-like(int)
) – the pair table of the secondary structures (
list-like(int)
) – encoded RNA sequences1 (
list-like(int)
) – encoded RNA sequencem1 (
int
) – first coordinate of base pairm2 (
int
) – second coordinate of base pair
- Returns:
energy change of the move in 10cal/mol
- Return type:
int
See also
- RNA.energy_of_struct(string, structure)
Calculate the free energy of an already folded RNA
Deprecated since version 2.7.0: This function is deprecated and should not be used in future programs! Use energy_of_structure() instead!
Note
This function is not entirely threadsafe! Depending on the state of the global variable eos_debug it prints energy information to stdout or not…
- Parameters:
string (
string
) – RNA sequencestructure (
string
) – secondary structure in dot-bracket notation
- Returns:
the free energy of the input structure given the input sequence in kcal/mol
- Return type:
float
- RNA.energy_of_struct_pt(string, ptable, s, s1)
Calculate the free energy of an already folded RNA
Deprecated since version 2.7.0: This function is deprecated and should not be used in future programs! Use energy_of_structure_pt() instead!
Note
This function is not entirely threadsafe! Depending on the state of the global variable eos_debug it prints energy information to stdout or not…
- Parameters:
string (
string
) – RNA sequenceptable (
list-like(int)
) – the pair table of the secondary structures (
list-like(int)
) – encoded RNA sequences1 (
list-like(int)
) – encoded RNA sequence
- Returns:
the free energy of the input structure given the input sequence in 10kcal/mol
- Return type:
int
See also
make_pair_table
,energy_of_structure
- RNA.energy_of_structure(string, structure, verbosity_level)
Calculate the free energy of an already folded RNA using global model detail settings.
If verbosity level is set to a value >0, energies of structure elements are printed to stdout
Deprecated since version 2.7.0: Use RNA.fold_compound.eval_structure() or RNA.fold_compound.eval_structure_verbose() instead!
Note
OpenMP: This function relies on several global model settings variables and thus is not to be considered threadsafe. See energy_of_struct_par() for a completely threadsafe implementation.
- Parameters:
string (
string
) – RNA sequencestructure (
string
) – secondary structure in dot-bracket notationverbosity_level (
int
) – a flag to turn verbose output on/off
- Returns:
the free energy of the input structure given the input sequence in kcal/mol
- Return type:
float
See also
- RNA.energy_of_structure_pt(string, ptable, s, s1, verbosity_level)
Calculate the free energy of an already folded RNA.
If verbosity level is set to a value >0, energies of structure elements are printed to stdout
Deprecated since version 2.7.0: Use RNA.fold_compound.eval_structure_pt() or RNA.fold_compound.eval_structure_pt_verbose() instead!
Note
OpenMP: This function relies on several global model settings variables and thus is not to be considered threadsafe. See energy_of_struct_pt_par() for a completely threadsafe implementation.
- Parameters:
string (
string
) – RNA sequenceptable (
list-like(int)
) – the pair table of the secondary structures (
list-like(int)
) – encoded RNA sequences1 (
list-like(int)
) – encoded RNA sequenceverbosity_level (
int
) – a flag to turn verbose output on/off
- Returns:
the free energy of the input structure given the input sequence in 10kcal/mol
- Return type:
int
See also
- RNA.enumerate_necklaces(entity_counts)
Enumerate all necklaces with fixed content.
This function implements A fast algorithm to generate necklaces with fixed content as published by Sawada [2003] .
The function receives a list of counts (the elements on the necklace) for each type of object within a necklace. The list starts at index 0 and ends with an entry that has a count of 0. The algorithm then enumerates all non-cyclic permutations of the content, returned as a list of necklaces. This list, again, is zero-terminated, i.e. the last entry of the list is a NULL pointer.
SWIG Wrapper Notes
This function is available as global function enumerate_necklaces() which accepts lists input, an produces list of lists output. See, e.g.
RNA.enumerate_necklaces()
in the Python API .- Parameters:
type_counts (
const unsigned int *
) – A 0-terminated list of entity counts- Returns:
A list of all non-cyclic permutations of the entities
- Return type:
list-like(list-like(unsigned int))
- class RNA.ep(*args, **kwargs)
Bases:
object
Data structure representing a single entry of an element probability list (e.g. list of pair probabilities)
See also
RNA.plist
,RNA.fold_compound.plist_from_probs
,RNA.db_from_plist
,RNA.PLIST_TYPE_BASEPAIR
,RNA.PLIST_TYPE_GQUAD
,RNA.PLIST_TYPE_H_MOTIF
,RNA.PLIST_TYPE_I_MOTIF
,RNA.PLIST_TYPE_UD_MOTIF
,RNA.PLIST_TYPE_STACK
- i
Start position (usually 5’ nucleotide that starts the element, e.g. base pair)
- Type:
int
- j
End position (usually 3’ nucleotide that ends the element, e.g. base pair)
- Type:
int
- p
Probability of the element.
- Type:
float
- type
Type of the element.
- Type:
int
Data structure representing a single entry of an element probability list (e.g. list of pair probabilities)
See also
RNA.plist
,RNA.fold_compound.plist_from_probs
,RNA.db_from_plist
,RNA.PLIST_TYPE_BASEPAIR
,RNA.PLIST_TYPE_GQUAD
,RNA.PLIST_TYPE_H_MOTIF
,RNA.PLIST_TYPE_I_MOTIF
,RNA.PLIST_TYPE_UD_MOTIF
,RNA.PLIST_TYPE_STACK
- i
Start position (usually 5’ nucleotide that starts the element, e.g. base pair)
- Type:
int
- j
End position (usually 3’ nucleotide that ends the element, e.g. base pair)
- Type:
int
- p
Probability of the element.
- Type:
float
- type
Type of the element.
- Type:
int
- property i
- property j
- property p
- property thisown
The membership flag
- property type
- RNA.eval_circ_gquad_structure(*args)
Evaluate free energy of a sequence/structure pair, assume sequence to be circular, allow for G-Quadruplexes in the structure, and print contributions per loop.
This function is the same as RNA.eval_structure_simple_v() but assumes the input sequence to be circular and allows for annotated G-Quadruplexes in the dot-bracket structure input.
G-Quadruplexes are annotated as plus signs (‘+’) for each G involved in the motif. Linker sequences must be denoted by dots (‘.’) as they are considered unpaired. Below is an example of a 2-layer G-quadruplex:
SWIG Wrapper Notes
This function is available through an overloaded version of RNA.eval_circ_gquad_structure(). The last two arguments for this function are optional and default to RNA.VERBOSITY_QUIET and NULL, respectively. See, e.g.
RNA.eval_circ_gquad_structure()
in the Python API .- Parameters:
string (
string
) – RNA sequence in uppercase lettersstructure (
string
) – Secondary structure in dot-bracket notationverbosity_level (
int
) – The level of verbosity of this functionfile (
FILE *
) – A file handle where this function should print to (may be NULL).
- Returns:
The free energy of the input structure given the input sequence in kcal/mol
- Return type:
float
- RNA.eval_circ_structure(*args)
Evaluate free energy of a sequence/structure pair, assume sequence to be circular and print contributions per loop.
This function is the same as RNA.eval_structure_simple_v() but assumes the input sequence to be circularized.
SWIG Wrapper Notes
This function is available through an overloaded version of RNA.eval_circ_structure(). The last two arguments for this function are optional and default to RNA.VERBOSITY_QUIET and NULL, respectively. See, e.g.
RNA.eval_circ_structure()
in the Python API .- Parameters:
string (
string
) – RNA sequence in uppercase lettersstructure (
string
) – Secondary structure in dot-bracket notationverbosity_level (
int
) – The level of verbosity of this functionfile (
FILE *
) – A file handle where this function should print to (may be NULL).
- Returns:
The free energy of the input structure given the input sequence in kcal/mol
- Return type:
float
See also
RNA.eval_structure_simple_v
,RNA.eval_circ_structure
,RNA.fold_compound.eval_structure_verbose
- RNA.eval_gquad_structure(*args)
Evaluate free energy of a sequence/structure pair, allow for G-Quadruplexes in the structure and print contributions per loop.
This function is the same as RNA.eval_structure_simple_v() but allows for annotated G-Quadruplexes in the dot-bracket structure input.
G-Quadruplexes are annotated as plus signs (‘+’) for each G involved in the motif. Linker sequences must be denoted by dots (‘.’) as they are considered unpaired. Below is an example of a 2-layer G-quadruplex:
SWIG Wrapper Notes
This function is available through an overloaded version of RNA.eval_gquad_structure(). The last two arguments for this function are optional and default to RNA.VERBOSITY_QUIET and NULL, respectively. See, e.g.
RNA.eval_gquad_structure()
in the Python API .- Parameters:
string (
string
) – RNA sequence in uppercase lettersstructure (
string
) – Secondary structure in dot-bracket notationverbosity_level (
int
) – The level of verbosity of this functionfile (
FILE *
) – A file handle where this function should print to (may be NULL).
- Returns:
The free energy of the input structure given the input sequence in kcal/mol
- Return type:
float
See also
RNA.eval_structure_simple_v
,RNA.eval_gquad_structure
,RNA.fold_compound.eval_structure_verbose
- RNA.eval_structure_pt_simple(*args)
Calculate the free energy of an already folded RNA.
This function allows for energy evaluation of a given sequence/structure pair where the structure is provided in pair_table format as obtained from RNA.ptable(). Model details, energy parameters, and possibly soft constraints are used as provided via the parameter ‘fc’. The fold_compound does not need to contain any DP matrices, but all the most basic init values as one would get from a call like this: In contrast to RNA.fold_compound.eval_structure_pt_verbose() this function assumes default model details and default energy parameters in order to evaluate the free energy of the secondary structure. Threefore, it serves as a simple interface function for energy evaluation for situations where no changes on the energy model are required.
- Parameters:
string (
string
) – RNA sequence in uppercase letterspt (
const short *
) – Secondary structure as pair_tableverbosity_level (
int
) – The level of verbosity of this functionfile (
FILE *
) – A file handle where this function should print to (may be NULL).
- Returns:
The free energy of the input structure given the input sequence in 10cal/mol
- Return type:
int
See also
RNA.ptable
,RNA.eval_structure_pt_v
,RNA.eval_structure_simple
- RNA.eval_structure_simple(*args)
Calculate the free energy of an already folded RNA and print contributions per loop.
This function allows for detailed energy evaluation of a given sequence/structure pair. In contrast to RNA.fold_compound.eval_structure() this function prints detailed energy contributions based on individual loops to a file handle. If NULL is passed as file handle, this function defaults to print to stdout. Any positive verbosity_level activates potential warning message of the energy evaluting functions, while values \(\ge 1\) allow for detailed control of what data is printed. A negative parameter verbosity_level turns off printing all together.
In contrast to RNA.fold_compound.eval_structure_verbose() this function assumes default model details and default energy parameters in order to evaluate the free energy of the secondary structure. Threefore, it serves as a simple interface function for energy evaluation for situations where no changes on the energy model are required.
SWIG Wrapper Notes
This function is available through an overloaded version of RNA.eval_structure_simple(). The last two arguments for this function are optional and default to RNA.VERBOSITY_QUIET and NULL, respectively. See, e.g.
RNA.eval_structure_simple()
in the Python API .- Parameters:
string (
string
) – RNA sequence in uppercase lettersstructure (
string
) – Secondary structure in dot-bracket notationverbosity_level (
int
) – The level of verbosity of this functionfile (
FILE *
) – A file handle where this function should print to (may be NULL).
- Returns:
The free energy of the input structure given the input sequence in kcal/mol
- Return type:
float
- RNA.exp_E_ExtLoop(type, si1, sj1, P)
This is the partition function variant of E_ExtLoop()
Deprecated since version 2.7.0: Use RNA.fold_compound.exp_E_ext_stem() instead!
- Returns:
The Boltzmann weighted energy contribution of the introduced exterior-loop stem
- Return type:
double
See also
- RNA.exp_E_Hairpin(u, type, si1, sj1, string, P)
Compute Boltzmann weight \(e^{-\Delta G/kT}\) of a hairpin loop.
- Parameters:
u (
int
) – The size of the loop (number of unpaired nucleotides)type (
int
) – The pair type of the base pair closing the hairpinsi1 (
short
) – The 5’-mismatching nucleotidesj1 (
short
) – The 3’-mismatching nucleotidestring (
string
) – The sequence of the loop (May be NULL, otherwise mst be at least \(size + 2\) long)P (
RNA.exp_param() *
) – The datastructure containing scaled Boltzmann weights of the energy parameters
- Returns:
The Boltzmann weight of the Hairpin-loop
- Return type:
double
Warning
Not (really) thread safe! A threadsafe implementation will replace this function in a future release!
Energy evaluation may change due to updates in global variable “tetra_loop”
See also
get_scaled_pf_parameters
,RNA.exp_param
,E_Hairpin
Note
multiply by scale[u+2]
- RNA.exp_E_IntLoop(u1, u2, type, type2, si1, sj1, sp1, sq1, P)
Compute Boltzmann weight \(e^{-\Delta G/kT}\) of internal loop
multiply by scale[u1+u2+2] for scaling
- param u1:
The size of the ‘left’-loop (number of unpaired nucleotides)
- type u1:
int
- param u2:
The size of the ‘right’-loop (number of unpaired nucleotides)
- type u2:
int
- param type:
The pair type of the base pair closing the internal loop
- type type:
int
- param type2:
The pair type of the enclosed base pair
- type type2:
int
- param si1:
The 5’-mismatching nucleotide of the closing pair
- type si1:
short
- param sj1:
The 3’-mismatching nucleotide of the closing pair
- type sj1:
short
- param sp1:
The 3’-mismatching nucleotide of the enclosed pair
- type sp1:
short
- param sq1:
The 5’-mismatching nucleotide of the enclosed pair
- type sq1:
short
- param P:
The datastructure containing scaled Boltzmann weights of the energy parameters
- type P:
RNA.exp_param() *
- returns:
The Boltzmann weight of the Interior-loop
- rtype:
double
See also
get_scaled_pf_parameters
,RNA.exp_param
,E_IntLoop
Note
This function is threadsafe
- RNA.exp_E_MLstem(type, si1, sj1, P)
- RNA.exp_E_Stem(type, si1, sj1, extLoop, P)
Compute the Boltzmann weighted energy contribution of a stem branching off a loop-region
This is the partition function variant of E_Stem()
- returns:
The Boltzmann weighted energy contribution of the branch off the loop
- rtype:
double
See also
Note
This function is threadsafe
- RNA.exp_E_gquad(L, l, pf)
- RNA.exp_E_gquad_ali(i, L, l, S, a2s, n_seq, pf)
- class RNA.exp_param(model_details=None)
Bases:
object
The data structure that contains temperature scaled Boltzmann weights of the energy parameters.
- id
An identifier for the data structure.
Deprecated since version 2.7.0: This attribute will be removed in version 3
- Type:
int
- expstack
- Type:
double
- exphairpin
- Type:
double
- expbulge
- Type:
double
- expinternal
- Type:
double
- expmismatchExt
- Type:
double
- expmismatchI
- Type:
double
- expmismatch23I
- Type:
double
- expmismatch1nI
- Type:
double
- expmismatchH
- Type:
double
- expmismatchM
- Type:
double
- expdangle5
- Type:
double
- expdangle3
- Type:
double
- expint11
- Type:
double
- expint21
- Type:
double
- expint22
- Type:
double
- expninio
- Type:
double
- lxc
- Type:
double
- expMLbase
- Type:
double
- expMLintern
- Type:
double
- expMLclosing
- Type:
double
- expTermAU
- Type:
double
- expDuplexInit
- Type:
double
- exptetra
- Type:
double
- exptri
- Type:
double
- exphex
- Type:
double
- Tetraloops
- Type:
char
- expTriloop
- Type:
double
- Triloops
- Type:
char
- Hexaloops
- Type:
char
- expTripleC
- Type:
double
- expMultipleCA
- Type:
double
- expMultipleCB
- Type:
double
- expgquad
- Type:
double
- expgquadLayerMismatch
- Type:
double
- gquadLayerMismatchMax
- Type:
unsigned int
- kT
- Type:
double
- pf_scale
Scaling factor to avoid over-/underflows.
- Type:
double
- temperature
Temperature used for loop contribution scaling.
- Type:
double
- alpha
Scaling factor for the thermodynamic temperature.
This allows for temperature scaling in Boltzmann factors independently from the energy contributions. The resulting Boltzmann factors are then computed by \(e^{-E/(\alpha \cdot K \cdot T)}\)
- Type:
double
- model_details
Model details to be used in the recursions.
- Type:
vrna_md_t
- param_file
The filename the parameters were derived from, or empty string if they represent the default.
- Type:
char
- expSaltStack
- Type:
double
- expSaltLoop
- Type:
double
- SaltLoopDbl
- Type:
double
- SaltMLbase
- Type:
int
- SaltMLintern
- Type:
int
- SaltMLclosing
- Type:
int
- SaltDPXInit
- Type:
int
The data structure that contains temperature scaled Boltzmann weights of the energy parameters.
- id
An identifier for the data structure.
Deprecated since version 2.7.0: This attribute will be removed in version 3
- Type:
int
- expstack
- Type:
double
- exphairpin
- Type:
double
- expbulge
- Type:
double
- expinternal
- Type:
double
- expmismatchExt
- Type:
double
- expmismatchI
- Type:
double
- expmismatch23I
- Type:
double
- expmismatch1nI
- Type:
double
- expmismatchH
- Type:
double
- expmismatchM
- Type:
double
- expdangle5
- Type:
double
- expdangle3
- Type:
double
- expint11
- Type:
double
- expint21
- Type:
double
- expint22
- Type:
double
- expninio
- Type:
double
- lxc
- Type:
double
- expMLbase
- Type:
double
- expMLintern
- Type:
double
- expMLclosing
- Type:
double
- expTermAU
- Type:
double
- expDuplexInit
- Type:
double
- exptetra
- Type:
double
- exptri
- Type:
double
- exphex
- Type:
double
- Tetraloops
- Type:
char
- expTriloop
- Type:
double
- Triloops
- Type:
char
- Hexaloops
- Type:
char
- expTripleC
- Type:
double
- expMultipleCA
- Type:
double
- expMultipleCB
- Type:
double
- expgquad
- Type:
double
- expgquadLayerMismatch
- Type:
double
- gquadLayerMismatchMax
- Type:
unsigned int
- kT
- Type:
double
- pf_scale
Scaling factor to avoid over-/underflows.
- Type:
double
- temperature
Temperature used for loop contribution scaling.
- Type:
double
- alpha
Scaling factor for the thermodynamic temperature.
This allows for temperature scaling in Boltzmann factors independently from the energy contributions. The resulting Boltzmann factors are then computed by \(e^{-E/(\alpha \cdot K \cdot T)}\)
- Type:
double
- model_details
Model details to be used in the recursions.
- Type:
vrna_md_t
- param_file
The filename the parameters were derived from, or empty string if they represent the default.
- Type:
char
- expSaltStack
- Type:
double
- expSaltLoop
- Type:
double
- SaltLoopDbl
- Type:
double
- SaltMLbase
- Type:
int
- SaltMLintern
- Type:
int
- SaltMLclosing
- Type:
int
- SaltDPXInit
- Type:
int
- property Hexaloops
- property SaltDPXInit
- property SaltLoopDbl
- property SaltMLbase
- property SaltMLclosing
- property SaltMLintern
- property Tetraloops
- property Triloops
- property alpha
- property expDuplexInit
- property expMLbase
- property expMLclosing
- property expMLintern
- property expMultipleCA
- property expMultipleCB
- property expSaltLoop
- property expSaltStack
- property expTermAU
- property expTriloop
- property expTripleC
- property expbulge
- property expdangle3
- property expdangle5
- property expgquad
- property expgquadLayerMismatch
- property exphairpin
- property exphex
- property expint11
- property expint21
- property expint22
- property expinternal
- property expmismatch1nI
- property expmismatch23I
- property expmismatchExt
- property expmismatchH
- property expmismatchI
- property expmismatchM
- property expninio
- property expstack
- property exptetra
- property exptri
- property gquadLayerMismatchMax
- property id
- property kT
- property lxc
- property model_details
- property param_file
- property pf_scale
- property temperature
- property thisown
The membership flag
- RNA.expand_Full(structure)
Convert the full structure from bracket notation to the expanded notation including root.
- Parameters:
structure (
string
) –- Return type:
string
- RNA.expand_Shapiro(coarse)
Inserts missing ‘S’ identifiers in unweighted coarse grained structures as obtained from b2C().
- Parameters:
coarse (
string
) –- Return type:
string
- RNA.extract_record_rest_structure(lines, length, option)
- RNA.fc_add_pycallback(vc, PyFunc)
- RNA.fc_add_pydata(vc, data, PyFuncOrNone)
- RNA.file_PS_aln(std::string filename, StringVector alignment, StringVector identifiers, std::string structure, unsigned int start=0, unsigned int end=0, int offset=0, unsigned int columns=60) int
Create an annotated PostScript alignment plot.
Similar to RNA.file_PS_aln() but allows the user to print a particular slice of the alignment by specifying a start and end position. The additional offset parameter allows for adjusting the alignment position ruler value.
SWIG Wrapper Notes
This function is available as overloaded function file_PS_aln() where the last four parameter may be omitted, indicating start = 0, end = 0, offset = 0, and columns = 60. See, e.g.
RNA.file_PS_aln()
in the Python API.- Parameters:
filename (
string
) – The output file nameseqs (
const char **
) – The aligned sequencesnames (
const char **
) – The names of the sequencesstructure (
string
) – The consensus structure in dot-bracket notationstart (
unsigned int
) – The start of the alignment slice (a value of 0 indicates the first position of the alignment, i.e. no slicing at 5’ side)end (
unsigned int
) – The end of the alignment slice (a value of 0 indicates the last position of the alignment, i.e. no slicing at 3’ side)offset (
int
) – The alignment coordinate offset for the position ruler.columns (
unsigned int
) – The number of columns before the alignment is wrapped as a new block (a value of 0 indicates no wrapping)
See also
RNA.file_PS_aln_slice
- RNA.file_PS_rnaplot(*args)
- RNA.file_PS_rnaplot_a(*args)
- RNA.file_RNAstrand_db_read_record(fp, options=0)
- RNA.file_SHAPE_read(file_name, length, default_value)
Read data from a given SHAPE reactivity input file.
This function parses the informations from a given file and stores the result in the preallocated string sequence and the double array values.
- Parameters:
file_name (
string
) – Path to the constraints filelength (
int
) – Length of the sequence (file entries exceeding this limit will cause an error)default_value (
double
) – Value for missing indicessequence (
string
) – Pointer to an array used for storing the sequence obtained from the SHAPE reactivity filevalues (
list-like(double)
) – Pointer to an array used for storing the values obtained from the SHAPE reactivity file
- RNA.file_commands_read(std::string filename, unsigned int options=) cmd
Extract a list of commands from a command file.
Read a list of commands specified in the input file and return them as list of abstract commands
SWIG Wrapper Notes
This function is available as global function file_commands_read(). See, e.g.
RNA.file_commands_read()
in the Python API .- Parameters:
filename (
string
) – The filenameoptions (
unsigned int
) – Options to limit the type of commands read from the file
- Returns:
A list of abstract commands
- Return type:
See also
RNA.fold_compound.commands_apply
,RNA.file_commands_apply
,RNA.commands_free
- RNA.file_connect_read_record(fp, remainder, options=0)
- RNA.file_fasta_read(FILE * file, unsigned int options=0) int
Get a (fasta) data set from a file or stdin.
This function may be used to obtain complete datasets from a filehandle or stdin. A dataset is always defined to contain at least a sequence. If data starts with a fasta header, i.e. a line like
>some header info then RNA.file_fasta_read_record() will assume that the sequence that follows the header may span over several lines. To disable this behavior and to assign a single line to the argument ‘sequence’ one can pass RNA.INPUT_NO_SPAN in the ‘options’ argument. If no fasta header is read in the beginning of a data block, a sequence must not span over multiple lines!
Unless the options RNA.INPUT_NOSKIP_COMMENTS or RNA.INPUT_NOSKIP_BLANK_LINES are passed, a sequence may be interrupted by lines starting with a comment character or empty lines.
A sequence is regarded as completely read if it was either assumed to not span over multiple lines, a secondary structure or structure constraint follows the sequence on the next line, or a new header marks the beginning of a new sequence…
All lines following the sequence (this includes comments) that do not initiate a new dataset according to the above definition are available through the line-array ‘rest’. Here one can usually find the structure constraint or other information belonging to the current dataset. Filling of ‘rest’ may be prevented by passing RNA.INPUT_NO_REST to the options argument.
The main purpose of this function is to be able to easily parse blocks of data in the header of a loop where all calculations for the appropriate data is done inside the loop. The loop may be then left on certain return values, e.g.:
In the example above, the while loop will be terminated when RNA.file_fasta_read_record() returns either an error, EOF, or a user initiated quit request.
As long as data is read from stdin (we are passing NULL as the file pointer), the id is printed if it is available for the current block of data. The sequence will be printed in any case and if some more lines belong to the current block of data each line will be printed as well.
- Parameters:
header (
char **
) – A pointer which will be set such that it points to the header of the recordsequence (
char **
) – A pointer which will be set such that it points to the sequence of the recordrest (
char ***
) – A pointer which will be set such that it points to an array of lines which also belong to the recordfile (
FILE *
) – A file handle to read from (if NULL, this function reads from stdin)options (
unsigned int
) – Some options which may be passed to alter the behavior of the function, use 0 for no options
- Returns:
A flag with information about what the function actually did read
- Return type:
unsigned int
Note
- This function will exit any program with an error message if no sequence could be read!
This function is NOT threadsafe! It uses a global variable to store information about the next data block. Do not forget to free the memory occupied by header, sequence and rest!
- RNA.file_msa_detect_format(std::string filename, unsigned int options=) unsigned int
Detect the format of a multiple sequence alignment file.
This function attempts to determine the format of a file that supposedly contains a multiple sequence alignment (MSA). This is useful in cases where a MSA file contains more than a single record and therefore RNA.file_msa_read() can not be applied, since it only retrieves the first. Here, one can try to guess the correct file format using this function and then loop over the file, record by record using one of the low-level record retrieval functions for the corresponding MSA file format.
SWIG Wrapper Notes
This function exists as an overloaded version where the options parameter may be omitted! In that case, the options parameter defaults to RNA.FILE_FORMAT_MSA_DEFAULT. See, e.g.
RNA.file_msa_detect_format()
in the Python API .- Parameters:
filename (
string
) – The name of input file that contains the alignmentoptions (
unsigned int
) – Options to manipulate the behavior of this function
- Returns:
The MSA file format, or RNA.FILE_FORMAT_MSA_UNKNOWN
- Return type:
unsigned int
See also
RNA.file_msa_read
,RNA.file_stockholm_read_record
,RNA.file_clustal_read_record
,RNA.file_fasta_read_record
Note
This function parses the entire first record within the specified file. As a result, it returns RNA.FILE_FORMAT_MSA_UNKNOWN not only if it can’t detect the file’s format, but also in cases where the file doesn’t contain sequences!
- RNA.file_msa_read(std::string filename, unsigned int options=) int
Read a multiple sequence alignment from file.
This function reads the (first) multiple sequence alignment from an input file. The read alignment is split into the sequence id/name part and the actual sequence information and stored in memory as arrays of ids/names and sequences. If the alignment file format allows for additional information, such as an ID of the entire alignment or consensus structure information, this data is retrieved as well and made available. The options parameter allows to specify the set of alignment file formats that should be used to retrieve the data. If 0 is passed as option, the list of alignment file formats defaults to RNA.FILE_FORMAT_MSA_DEFAULT.
Currently, the list of parsable multiple sequence alignment file formats consists of:
msa-formats-clustal
msa-formats-stockholm
msa-formats-fasta
msa-formats-maf
SWIG Wrapper Notes
In the target scripting language, only the first and last argument, filename and options, are passed to the corresponding function. The other arguments, which serve as output in the C-library, are available as additional return values. This function exists as an overloaded version where the options parameter may be omitted! In that case, the options parameter defaults to RNA.FILE_FORMAT_MSA_STOCKHOLM. See, e.g.
RNA.file_msa_read()
in the Python API and Parsing Alignments in the Python examples.- Parameters:
filename (
string
) – The name of input file that contains the alignmentnames (
char ***
) – An address to the pointer where sequence identifiers should be written toaln (
char ***
) – An address to the pointer where aligned sequences should be written toid (
char **
) – An address to the pointer where the alignment ID should be written to (Maybe NULL)structure (
char **
) – An address to the pointer where consensus structure information should be written to (Maybe NULL)options (
unsigned int
) – Options to manipulate the behavior of this function
- Returns:
The number of sequences in the alignment, or -1 if no alignment record could be found
- Return type:
int
See also
RNA.file_msa_read_record
,RNA.FILE_FORMAT_MSA_CLUSTAL
,RNA.FILE_FORMAT_MSA_STOCKHOLM
,RNA.FILE_FORMAT_MSA_FASTA
,RNA.FILE_FORMAT_MSA_MAF
,RNA.FILE_FORMAT_MSA_DEFAULT
,RNA.FILE_FORMAT_MSA_NOCHECK
Note
After successfully reading an alignment, this function performs a validation of the data that includes uniqueness of the sequence identifiers, and equal sequence lengths. This check can be deactivated by passing RNA.FILE_FORMAT_MSA_NOCHECK in the options parameter.
It is the users responsibility to free any memory occupied by the output arguments names, aln, id, and structure after calling this function. The function automatically sets the latter two arguments to NULL in case no corresponding data could be retrieved from the input alignment.
- RNA.file_msa_read_record(FILE * filehandle, unsigned int options=) int
Read a multiple sequence alignment from file handle.
Similar to RNA.file_msa_read(), this function reads a multiple sequence alignment from an input file handle. Since using a file handle, this function is not limited to the first alignment record, but allows for looping over all alignments within the input.
The read alignment is split into the sequence id/name part and the actual sequence information and stored in memory as arrays of ids/names and sequences. If the alignment file format allows for additional information, such as an ID of the entire alignment or consensus structure information, this data is retrieved as well and made available. The options parameter allows to specify the alignment file format used to retrieve the data. A single format must be specified here, see RNA.file_msa_detect_format() for helping to determine the correct MSA file format.
Currently, the list of parsable multiple sequence alignment file formats consists of:
msa-formats-clustal
msa-formats-stockholm
msa-formats-fasta
msa-formats-maf
SWIG Wrapper Notes
In the target scripting language, only the first and last argument, fp and options, are passed to the corresponding function. The other arguments, which serve as output in the C-library, are available as additional return values. This function exists as an overloaded version where the options parameter may be omitted! In that case, the options parameter defaults to RNA.FILE_FORMAT_MSA_STOCKHOLM. See, e.g.
RNA.file_msa_read_record()
in the Python API and Parsing Alignments in the Python examples.- Parameters:
fp (
FILE *
) – The file pointer the data will be retrieved fromnames (
char ***
) – An address to the pointer where sequence identifiers should be written toaln (
char ***
) – An address to the pointer where aligned sequences should be written toid (
char **
) – An address to the pointer where the alignment ID should be written to (Maybe NULL)structure (
char **
) – An address to the pointer where consensus structure information should be written to (Maybe NULL)options (
unsigned int
) – Options to manipulate the behavior of this function
- Returns:
The number of sequences in the alignment, or -1 if no alignment record could be found
- Return type:
int
See also
RNA.file_msa_read
,RNA.file_msa_detect_format
,RNA.FILE_FORMAT_MSA_CLUSTAL
,RNA.FILE_FORMAT_MSA_STOCKHOLM
,RNA.FILE_FORMAT_MSA_FASTA
,RNA.FILE_FORMAT_MSA_MAF
,RNA.FILE_FORMAT_MSA_DEFAULT
,RNA.FILE_FORMAT_MSA_NOCHECK
Note
After successfully reading an alignment, this function performs a validation of the data that includes uniqueness of the sequence identifiers, and equal sequence lengths. This check can be deactivated by passing RNA.FILE_FORMAT_MSA_NOCHECK in the options parameter.
It is the users responsibility to free any memory occupied by the output arguments names, aln, id, and structure after calling this function. The function automatically sets the latter two arguments to NULL in case no corresponding data could be retrieved from the input alignment.
- RNA.file_msa_write(std::string filename, StringVector names, StringVector alignment, std::string id="", std::string structure="", std::string source="", unsigned int options=VRNA_FILE_FORMAT_MSA_STOCKHOLM|VRNA_FILE_FORMAT_MSA_APPEND) int
Write multiple sequence alignment file.
SWIG Wrapper Notes
In the target scripting language, this function exists as a set of overloaded versions, where the last four parameters may be omitted. If the options parameter is missing the options default to (RNA.FILE_FORMAT_MSA_STOCKHOLM | RNA.FILE_FORMAT_MSA_APPEND). See, e.g.
RNA.file_msa_write()
in the Python API .- Parameters:
filename (
string
) – The output filenamenames (
const char **
) – The array of sequence names / identifiesaln (
const char **
) – The array of aligned sequencesid (
string
) – An optional ID for the alignmentstructure (
string
) – An optional consensus structuresource (
string
) – A string describing the source of the alignmentoptions (
unsigned int
) – Options to manipulate the behavior of this function
- Returns:
Non-null upon successfully writing the alignment to file
- Return type:
int
See also
RNA.FILE_FORMAT_MSA_STOCKHOLM
,RNA.FILE_FORMAT_MSA_APPEND
,RNA.FILE_FORMAT_MSA_MIS
Note
Currently, we only support msa-formats-stockholm output
- RNA.filename_sanitize(*args)
Sanitize a file name.
Returns a new file name where all invalid characters are substituted by a replacement character. If no replacement character is supplied, invalid characters are simply removed from the filename. File names may also never exceed a length of 255 characters. Longer file names will undergo a ‘smart’ truncation process, where the filenames suffix, i.e. everything after the last dot .’, is attempted to be kept intact. Hence, only the filename part before the suffix is reduced in such a way that the total filename complies to the length restriction of 255 characters. If no suffix is present or the suffix itself already exceeds the maximum length, the filename is simply truncated from the back of the string.
For now we consider the following characters invalid:
backslash ‘'
slash ‘/’
question mark ‘?’
percent sign ‘’
asterisk ‘*’
colon ‘:’
pipe symbol ‘|’
double quote ‘”’
triangular brackets ‘<’ and ‘>’
Furthermore, the (resulting) file name must not be a reserved file name, such as:
‘.’
‘..’
- Parameters:
name (
string
) – The input file namereplacement (
string
) – The replacement character, or NULL
- Returns:
The sanitized file name, or NULL
- Return type:
string
Note
This function allocates a new block of memory for the sanitized string. It also may return (a) NULL if the input is pointing to NULL, or (b) an empty string if the input only consists of invalid characters which are simply removed!
- RNA.find_saddle(seq, s1, s2, width)
Find energy of a saddle point between 2 structures (search only direct path)
Deprecated since version 2.7.0: Use RNA.path_findpath_saddle() instead!
- Parameters:
seq (
string
) – RNA sequences1 (
string
) – A pointer to the character array where the first secondary structure in dot-bracket notation will be written tos2 (
string
) – A pointer to the character array where the second secondary structure in dot-bracket notation will be written towidth (
int
) – integer how many strutures are being kept during the search
- Returns:
the saddle energy in 10cal/mol
- Return type:
int
- class RNA.floatArray(nelements)
Bases:
object
- cast()
- static frompointer(t)
- property thisown
The membership flag
- RNA.floatArray_frompointer(t)
- RNA.floatP_getitem(ary, index)
- RNA.floatP_setitem(ary, index, value)
- RNA.fold(string) -> (structure, mfe)fold(string) -> (structure, mfe)
Compute Minimum Free Energy (MFE), and a corresponding secondary structure for an RNA sequence.
This simplified interface to RNA.fold_compound.mfe() computes the MFE and, if required, a secondary structure for an RNA sequence using default options. Memory required for dynamic programming (DP) matrices will be allocated and free’d on-the-fly. Hence, after return of this function, the recursively filled matrices are not available any more for any post-processing, e.g. suboptimal backtracking, etc.
SWIG Wrapper Notes
This function is available as function fold() in the global namespace. The parameter structure is returned along with the MFE und must not be provided. See e.g.
RNA.fold()
in the Python API.- Parameters:
sequence (
string
) – RNA sequencestructure (
string
) – A pointer to the character array where the secondary structure in dot-bracket notation will be written to
- Returns:
the minimum free energy (MFE) in kcal/mol
- Return type:
float
See also
Note
In case you want to use the filled DP matrices for any subsequent post-processing step, or you require other conditions than specified by the default model details, use RNA.fold_compound.mfe(), and the data structure RNA.fold_compound() instead.
- class RNA.fold_compound(fold_compound self, char const * sequence, md md=None, unsigned int options=)
- class RNA.fold_compound(fold_compound self, StringVector alignment, md md=None, unsigned int options=) fold_compound
- class RNA.fold_compound(fold_compound self, char const * sequence, char * s1, char * s2, md md=None, unsigned int options=) fold_compound
Bases:
object
The most basic data structure required by many functions throughout the RNAlib.
Note
Please read the documentation of this data structure carefully! Some attributes are only available for specific types this data structure can adopt.
Warning
Reading/Writing from/to attributes that are not within the scope of the current type usually result in undefined behavior!
See also
RNA.fold_compound
,RNA.fold_compound
,RNA.fold_compound_comparative
,RNA.fold_compound_free
,RNA.FC_TYPE_SINGLE
,RNA.FC_TYPE_COMPARATIVE
,This data structure is wrapped as class fold_compound with several related functions attached as methods.
A new fold_compound can be obtained by calling one of its constructors:
fold_compound(seq) - Initialize with a single sequence, or two concatenated sequences separated by an ampersand character & (for cofolding)
fold_compound(aln) - Initialize with a sequence alignment aln stored as a list of sequences (with gap characters).
The resulting object has a list of attached methods which in most cases directly correspond to functions that mainly operate on the corresponding C data structure:
type() - Get the type of the fold_compound (See RNA.fc_type)
length() - Get the length of the sequence(s) or alignment stored within the fold_compound.
See, e.g.
RNA.fold_compound
in the Python API.- type
The type of the RNA.fold_compound().
Currently possible values are RNA.FC_TYPE_SINGLE, and RNA.FC_TYPE_COMPARATIVE
Warning
Do not edit this attribute, it will be automagically set by the corresponding get() methods for the RNA.fold_compound(). The value specified in this attribute dictates the set of other attributes to use within this data structure.
- Type:
const vrna_fc_type_e
- length
The length of the sequence (or sequence alignment)
- Type:
unsigned int
- cutpoint
The position of the (cofold) cutpoint within the provided sequence. If there is no cutpoint, this field will be set to -1.
- Type:
int
- strand_number
The strand number a particular nucleotide is associated with.
- Type:
list-like(unsigned int)
- strand_order
The strand order, i.e. permutation of current concatenated sequence.
- Type:
list-like(unsigned int)
- strand_order_uniq
The strand order array where identical sequences have the same ID.
- Type:
list-like(unsigned int)
- strand_start
The start position of a particular strand within the current concatenated sequence.
- Type:
list-like(unsigned int)
- strand_end
The end (last) position of a particular strand within the current concatenated sequence.
- Type:
list-like(unsigned int)
- strands
Number of interacting strands.
- Type:
unsigned int
- nucleotides
Set of nucleotide sequences.
- Type:
vrna_seq_t *
- alignment
Set of alignments.
- Type:
vrna_msa_t *
- hc
The hard constraints data structure used for structure prediction.
- Type:
vrna_hc_t *
- matrices
The MFE DP matrices.
- Type:
vrna_mx_mfe_t *
- exp_matrices
The PF DP matrices
- Type:
vrna_mx_pf_t *
- iindx
DP matrix accessor
- Type:
int *
- jindx
DP matrix accessor
- Type:
int *
- stat_cb
Recursion status callback (usually called just before, and after recursive computations in the library.
See also
RNA.recursion_status
,RNA.fold_compound.add_callback
- Type:
vrna_recursion_status_f
- auxdata
A pointer to auxiliary, user-defined data.
- Type:
void *
- free_auxdata
A callback to free auxiliary user data whenever the fold_compound itself is free’d.
See also
RNA.fold_compound
,RNA.auxdata_free
- Type:
vrna_auxdata_free_f
- domains_struc
Additional structured domains.
- Type:
vrna_sd_t *
- domains_up
Additional unstructured domains.
- Type:
vrna_ud_t *
- aux_grammar
Additional decomposition grammar rules.
- Type:
vrna_gr_aux_t
- sequence
The input sequence string.
Warning
Only available if
type==RNA.FC_TYPE_SINGLE
- Type:
string
- sequence_encoding
Numerical encoding of the input sequence.
See also
RNA.sequence_encode
Warning
Only available if
type==RNA.FC_TYPE_SINGLE
- Type:
list-like(int)
- encoding5
- Type:
list-like(int)
- encoding3
- Type:
list-like(int)
- sequence_encoding2
- Type:
list-like(int)
- ptype
Pair type array.
Contains the numerical encoding of the pair type for each pair (i,j) used in MFE, Partition function and Evaluation computations.
Note
This array is always indexed via jindx, in contrast to previously different indexing between mfe and pf variants!
Warning
Only available if
type==RNA.FC_TYPE_SINGLE
See also
RNA.idx_col_wise
,RNA.ptypes
- Type:
string
- ptype_pf_compat
ptype array indexed via iindx
Deprecated since version 2.7.0: This attribute will vanish in the future! It’s meant for backward compatibility only!
Warning
Only available if
type==RNA.FC_TYPE_SINGLE
- Type:
string
- sc
The soft constraints for usage in structure prediction and evaluation.
Warning
Only available if
type==RNA.FC_TYPE_SINGLE
- Type:
vrna_sc_t *
- sequences
The aligned sequences.
Note
The end of the alignment is indicated by a NULL pointer in the second dimension
Warning
Only available if
type==RNA.FC_TYPE_COMPARATIVE
- Type:
char **
- n_seq
The number of sequences in the alignment.
Warning
Only available if
type==RNA.FC_TYPE_COMPARATIVE
- Type:
unsigned int
- cons_seq
The consensus sequence of the aligned sequences.
Warning
Only available if
type==RNA.FC_TYPE_COMPARATIVE
- Type:
string
- S_cons
Numerical encoding of the consensus sequence.
Warning
Only available if
type==RNA.FC_TYPE_COMPARATIVE
- Type:
list-like(int)
- S
Numerical encoding of the sequences in the alignment.
Warning
Only available if
type==RNA.FC_TYPE_COMPARATIVE
- Type:
short **
- S5
S5[s][i] holds next base 5’ of i in sequence s.
Warning
Only available if
type==RNA.FC_TYPE_COMPARATIVE
- Type:
short **
- S3
Sl[s][i] holds next base 3’ of i in sequence s.
Warning
Only available if
type==RNA.FC_TYPE_COMPARATIVE
- Type:
short **
- Ss
- Type:
char **
- a2s
- Type:
list-like(list-like(unsigned int))
- pscore
Precomputed array of pair types expressed as pairing scores.
Warning
Only available if
type==RNA.FC_TYPE_COMPARATIVE
- Type:
int *
- pscore_local
Precomputed array of pair types expressed as pairing scores.
Warning
Only available if
type==RNA.FC_TYPE_COMPARATIVE
- Type:
int **
- pscore_pf_compat
Precomputed array of pair types expressed as pairing scores indexed via iindx.
Deprecated since version 2.7.0: This attribute will vanish in the future!
Warning
Only available if
type==RNA.FC_TYPE_COMPARATIVE
- Type:
list-like(int)
- scs
A set of soft constraints (for each sequence in the alignment)
Warning
Only available if
type==RNA.FC_TYPE_COMPARATIVE
- Type:
vrna_sc_t **
- oldAliEn
- Type:
int
- maxD1
Maximum allowed base pair distance to first reference.
- Type:
unsigned int
- maxD2
Maximum allowed base pair distance to second reference.
- Type:
unsigned int
- reference_pt1
A pairtable of the first reference structure.
- Type:
list-like(int)
- reference_pt2
A pairtable of the second reference structure.
- Type:
list-like(int)
- referenceBPs1
Matrix containing number of basepairs of reference structure1 in interval [i,j].
- Type:
list-like(unsigned int)
- referenceBPs2
Matrix containing number of basepairs of reference structure2 in interval [i,j].
- Type:
list-like(unsigned int)
- bpdist
Matrix containing base pair distance of reference structure 1 and 2 on interval [i,j].
- Type:
list-like(unsigned int)
- mm1
Maximum matching matrix, reference struct 1 disallowed.
- Type:
list-like(unsigned int)
- mm2
Maximum matching matrix, reference struct 2 disallowed.
- Type:
list-like(unsigned int)
- window_size
window size for local folding sliding window approach
- Type:
int
- ptype_local
Pair type array (for local folding)
- Type:
char **
- zscore_data
Data structure with settings for z-score computations.
- Type:
vrna_zsc_dat_t
- @1
- Type:
union vrna_fc_s::@0
- E_ext_hp_loop(i, j)
- E_ext_int_loop(i, j)
- E_hp_loop(i, j)
- E_int_loop(i, j)
- E_stack(i, j)
- MEA(fold_compound self) char
- MEA(fold_compound self, double gamma) char *
Compute a MEA (maximum expected accuracy) structure.
The algorithm maximizes the expected accuracy
\[A(S) = \sum_{(i,j) \in S} 2 \gamma p_{ij} + \sum_{i \notin S} p^u_{i}\]Higher values of \(\gamma\) result in more base pairs of lower probability and thus higher sensitivity. Low values of \(\gamma\) result in structures containing only highly likely pairs (high specificity). The code of the MEA function also demonstrates the use of sparse dynamic programming scheme to reduce the time and memory complexity of folding.
- Precondition
RNA.fold_compound.pf() must be executed on input parameter fc
SWIG Wrapper Notes
This function is attached as overloaded method MEA`(gamma = 1.) to objects of type `fold_compound. Note, that it returns the MEA structure and MEA value as a tuple (MEA_structure, MEA). See, e.g.
RNA.fold_compound.MEA()
in the Python API.- Parameters:
gamma (
double
) – The weighting factor for base pairs vs. unpaired nucleotidesmea (
list-like(double)
) – A pointer to a variable where the MEA value will be written to
- Returns:
An MEA structure (or NULL on any error)
- Return type:
string
- add_auxdata(fold_compound self, PyObject * data, PyObject * PyFuncOrNone=Py_None) PyObject *
Add auxiliary data to the RNA.fold_compound().
This function allows one to bind arbitrary data to a RNA.fold_compound() which may later on be used by one of the callback functions, e.g. RNA.recursion_status(). To allow for proper cleanup of the memory occupied by this auxiliary data, the user may also provide a pointer to a cleanup function that free’s the corresponding memory. This function will be called automatically when the RNA.fold_compound() is free’d with RNA.fold_compound_free().
- Parameters:
data (
void *
) – A pointer to an arbitrary data structuref (
RNA.auxdata_free
) – A pointer to function that free’s memory occupied by the arbitrary data (May be NULL)
See also
RNA.auxdata_free
Note
Before attaching the arbitrary data pointer, this function will call the RNA.auxdata_free() on any pre-existing data that is already attached.
- add_callback(fold_compound self, PyObject * PyFunc) PyObject *
Add a recursion status callback to the RNA.fold_compound().
Binding a recursion status callback function to a RNA.fold_compound() allows one to perform arbitrary operations just before, or after an actual recursive computations, e.g. MFE prediction, is performed by the RNAlib. The callback function will be provided with a pointer to its RNA.fold_compound(), and a status message. Hence, it has complete access to all variables that incluence the recursive computations.
- Parameters:
f (
RNA.recursion_status
) – The pointer to the recursion status callback function
See also
RNA.recursion_status
,RNA.fold_compound
,RNA.STATUS_MFE_PRE
,RNA.STATUS_MFE_POST
,RNA.STATUS_PF_PRE
,RNA.STATUS_PF_POST
- backtrack(fold_compound self, unsigned int length) char
- backtrack(fold_compound self) char *
Backtrack an MFE (sub)structure.
This function allows one to backtrack the MFE structure for a (sub)sequence
- Precondition
Requires pre-filled MFE dynamic programming matrices, i.e. one has to call RNA.fold_compound.mfe() prior to calling this function
SWIG Wrapper Notes
This function is attached as overloaded method backtrack() to objects of type fold_compound. The parameter length defaults to the total length of the RNA sequence and may be omitted. The parameter structure is returned along with the MFE und must not be provided. See e.g.
RNA.fold_compound.backtrack()
in the Python API.- Parameters:
length (
unsigned int
) – The length of the subsequence, starting from the 5’ endstructure (
string
) – A pointer to the character array where the secondary structure in dot-bracket notation will be written to. (Must have size of at least $p length + 1)
- Returns:
The minimum free energy (MFE) for the specified length in kcal/mol and a corresponding secondary structure in dot-bracket notation (stored in structure)
- Return type:
float
Note
On error, the function returns INF / 100. and stores the empty string in structure.
- bpp()
- centroid(fold_compound self) char *
Get the centroid structure of the ensemble.
The centroid is the structure with the minimal average distance to all other structures \(<d(S)> = \sum_{(i,j) \in S} (1-p_{ij}) + \sum_{(i,j) \notin S} p_{ij}\) Thus, the centroid is simply the structure containing all pairs with \(p_{i}j>0.5\) The distance of the centroid to the ensemble is written to the memory adressed by dist.
- Parameters:
dist (
list-like(double)
) – A pointer to the distance variable where the centroid distance will be written to- Returns:
The centroid structure of the ensemble in dot-bracket notation (NULL on error)
- Return type:
string
- commands_apply(fold_compound self, cmd commands, unsigned int options=) int
Apply a list of commands to a RNA.fold_compound().
SWIG Wrapper Notes
This function is attached as method commands_apply() to objects of type fold_compound. See, e.g.
RNA.fold_compound.commands_apply()
in the Python API .- Parameters:
commands (
RNA.cmd()
) – The commands to applyoptions (
unsigned int
) – Options to limit the type of commands read from the file
- Returns:
The number of commands successfully applied
- Return type:
int
- constraints_add(fold_compound self, char const * constraint, unsigned int options=)
Add constraints to a RNA.fold_compound() data structure.
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 RNA.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 RNA.fold_compound() 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.
In constrat to the above, constraints may also be read from file:
- Parameters:
constraint (
string
) – A string with either the filename of the constraint definitions or a pseudo dot-bracket notation of the hard constraint. May be NULL.options (
unsigned int
) – The option flags
See also
RNA.fold_compound.hc_add_from_db
,RNA.fold_compound.hc_add_up
,RNA.hc_add_up_batch
,RNA.hc_add_bp_unspecific
,RNA.fold_compound.hc_add_bp
,RNA.fold_compound.hc_init
,RNA.fold_compound.sc_set_up
,RNA.fold_compound.sc_set_bp
,RNA.fold_compound.sc_add_SHAPE_deigan
,RNA.fold_compound.sc_add_SHAPE_zarringhalam
,RNA.hc_free
,RNA.sc_free
,RNA.CONSTRAINT_DB
,RNA.CONSTRAINT_DB_DEFAULT
,RNA.CONSTRAINT_DB_PIPE
,RNA.CONSTRAINT_DB_DOT
,RNA.CONSTRAINT_DB_X
,RNA.CONSTRAINT_DB_ANG_BRACK
,RNA.CONSTRAINT_DB_RND_BRACK
,RNA.CONSTRAINT_DB_INTRAMOL
,RNA.CONSTRAINT_DB_INTERMOL
,RNA.CONSTRAINT_DB_GQUAD
- db_from_probs()
- ensemble_defect(*args)
Compute the Ensemble Defect for a given target structure.
This is a wrapper around RNA.ensemble_defect_pt(). Given a target structure \(s\), compute the average dissimilarity of a randomly drawn structure from the ensemble, i.e.:
\[ED(s) = 1 - \frac{1}{n} \sum_{ij, (i,j) \in s} p_{ij} - \frac{1}{n} \sum_{i}(1 - s_{i})q_{i}\]with sequence length \(n\), the probability \(p_{ij}\) of a base pair \((i,j)\), the probability \(q_{i} = 1 - \sum_{j} p_{ij}\) of nucleotide \(i\) being unpaired, and the indicator variable \(s_{i} = 1\) if \(\exists (i,j) \in s\), and \(s_{i} = 0\) otherwise.
- Precondition
The RNA.fold_compound() input parameter fc must contain a valid base pair probability matrix. This means that partition function and base pair probabilities must have been computed using fc before execution of this function!
SWIG Wrapper Notes
This function is attached as method ensemble_defect() to objects of type fold_compound. Note that the SWIG wrapper takes a structure in dot-bracket notation and converts it into a pair table using RNA.ptable_from_string(). The resulting pair table is then internally passed to RNA.ensemble_defect_pt(). To control which kind of matching brackets will be used during conversion, the optional argument options can be used. See also the description of RNA.ptable_from_string() for available options. (default: RNA.BRACKETS_RND). See, e.g.
RNA.fold_compound.ensemble_defect()
in the Python API.- Parameters:
structure (
string
) – A target structure in dot-bracket notation- Returns:
The ensemble defect with respect to the target structure, or -1. upon failure, e.g. pre- conditions are not met
- Return type:
double
See also
RNA.fold_compound.pf
,RNA.pairing_probs
,RNA.ensemble_defect_pt
- eval_covar_structure(structure)
Calculate the pseudo energy derived by the covariance scores of a set of aligned sequences.
Consensus structure prediction is driven by covariance scores of base pairs in rows of the provided alignment. This function allows one to retrieve the total amount of this covariance pseudo energy scores. The RNA.fold_compound() does not need to contain any DP matrices, but requires all most basic init values as one would get from a call like this:
SWIG Wrapper Notes
This function is attached as method eval_covar_structure() to objects of type fold_compound. See, e.g.
RNA.fold_compound.eval_covar_structure()
in the Python API .- Parameters:
structure (
string
) – Secondary (consensus) structure in dot-bracket notation- Returns:
The covariance pseudo energy score of the input structure given the input sequence alignment in kcal/mol
- Return type:
float
See also
RNA.fold_compound_comparative
,RNA.fold_compound.eval_structure
Note
Accepts RNA.fold_compound() of type RNA.FC_TYPE_COMPARATIVE only!
- eval_ext_hp_loop(i, j)
- eval_ext_stem(i, j)
- eval_hp_loop(fold_compound self, int i, int j) int
SWIG Wrapper Notes
This function is attached as method eval_hp_loop() to objects of type fold_compound. See, e.g.
RNA.fold_compound.eval_hp_loop()
in the Python API .
- eval_int_loop(fold_compound self, int i, int j, int k, int l) int
SWIG Wrapper Notes
This function is attached as method eval_int_loop() to objects of type fold_compound. See, e.g.
RNA.fold_compound.eval_int_loop()
in the Python API .
- eval_loop_pt(*args)
Calculate energy of a loop.
SWIG Wrapper Notes
This function is attached as method eval_loop_pt() to objects of type fold_compound. See, e.g.
RNA.fold_compound.eval_loop_pt()
in the Python API .- Parameters:
i (
int
) – position of covering base pairpt (
const short *
) – the pair table of the secondary structure
- Returns:
free energy of the loop in 10cal/mol
- Return type:
int
- eval_move(structure, m1, m2)
Calculate energy of a move (closing or opening of a base pair)
If the parameters m1 and m2 are negative, it is deletion (opening) of a base pair, otherwise it is insertion (opening).
SWIG Wrapper Notes
This function is attached as method eval_move() to objects of type fold_compound. See, e.g.
RNA.fold_compound.eval_move()
in the Python API .- Parameters:
structure (
string
) – secondary structure in dot-bracket notationm1 (
int
) – first coordinate of base pairm2 (
int
) – second coordinate of base pair
- Returns:
energy change of the move in kcal/mol (INF / 100. upon any error)
- Return type:
float
See also
- eval_move_pt(*args)
Calculate energy of a move (closing or opening of a base pair)
If the parameters m1 and m2 are negative, it is deletion (opening) of a base pair, otherwise it is insertion (opening).
SWIG Wrapper Notes
This function is attached as method eval_move_pt() to objects of type fold_compound. See, e.g.
RNA.fold_compound.eval_move_pt()
in the Python API .- Parameters:
pt (
list-like(int)
) – the pair table of the secondary structurem1 (
int
) – first coordinate of base pairm2 (
int
) – second coordinate of base pair
- Returns:
energy change of the move in 10cal/mol
- Return type:
int
See also
- eval_structure(structure)
Calculate the free energy of an already folded RNA.
This function allows for energy evaluation of a given pair of structure and sequence (alignment). Model details, energy parameters, and possibly soft constraints are used as provided via the parameter ‘fc’. The RNA.fold_compound() does not need to contain any DP matrices, but requires all most basic init values as one would get from a call like this:
SWIG Wrapper Notes
This function is attached as method eval_structure() to objects of type fold_compound. See, e.g.
RNA.fold_compound.eval_structure()
in the Python API .- Parameters:
structure (
string
) – Secondary structure in dot-bracket notation- Returns:
The free energy of the input structure given the input sequence in kcal/mol
- Return type:
float
See also
RNA.fold_compound.eval_structure_pt
,RNA.fold_compound.eval_structure_verbose
,RNA.fold_compound.eval_structure_pt_verbose
,RNA.fold_compound
,RNA.fold_compound_comparative
,RNA.fold_compound.eval_covar_structure
Note
Accepts RNA.fold_compound() of type RNA.FC_TYPE_SINGLE and RNA.FC_TYPE_COMPARATIVE
- eval_structure_pt(*args)
Calculate the free energy of an already folded RNA.
This function allows for energy evaluation of a given sequence/structure pair where the structure is provided in pair_table format as obtained from RNA.ptable(). Model details, energy parameters, and possibly soft constraints are used as provided via the parameter ‘fc’. The fold_compound does not need to contain any DP matrices, but all the most basic init values as one would get from a call like this:
SWIG Wrapper Notes
This function is attached as method eval_structure_pt() to objects of type fold_compound. See, e.g.
RNA.fold_compound.eval_structure_pt()
in the Python API .- Parameters:
pt (
const short *
) – Secondary structure as pair_table- Returns:
The free energy of the input structure given the input sequence in 10cal/mol
- Return type:
int
- eval_structure_pt_verbose(*args)
Calculate the free energy of an already folded RNA.
This function is a simplyfied version of RNA.eval_structure_simple_v() that uses the default verbosity level.
SWIG Wrapper Notes
This function is attached as method eval_structure_pt_verbose() to objects of type fold_compound. See, e.g.
RNA.fold_compound.eval_structure_pt_verbose()
in the Python API .- Parameters:
pt (
const short *
) – Secondary structure as pair_tablefile (
FILE *
) – A file handle where this function should print to (may be NULL).
- Returns:
The free energy of the input structure given the input sequence in 10cal/mol
- Return type:
int
See also
RNA.eval_structure_pt_v
,RNA.ptable
,RNA.fold_compound.eval_structure_pt
,RNA.fold_compound.eval_structure_verbose
- eval_structure_verbose(structure, nullfile=None)
Calculate the free energy of an already folded RNA and print contributions on a per-loop base.
This function is a simplyfied version of RNA.eval_structure_v() that uses the default verbosity level.
SWIG Wrapper Notes
This function is attached as method eval_structure_verbose() to objects of type fold_compound. See, e.g.
RNA.fold_compound.eval_structure_verbose()
in the Python API .- Parameters:
structure (
string
) – Secondary structure in dot-bracket notationfile (
FILE *
) – A file handle where this function should print to (may be NULL).
- Returns:
The free energy of the input structure given the input sequence in kcal/mol
- Return type:
float
- exp_E_ext_stem(i, j)
- exp_E_hp_loop(i, j)
- exp_E_int_loop(i, j)
- exp_E_interior_loop(i, j, k, l)
- property exp_matrices
- property exp_params
- exp_params_rescale(*args)
Rescale Boltzmann factors for partition function computations.
This function may be used to (automatically) rescale the Boltzmann factors used in partition function computations. Since partition functions over subsequences can easily become extremely large, the RNAlib internally rescales them to avoid numerical over- and/or underflow. Therefore, a proper scaling factor \(s\) needs to be chosen that in turn is then used to normalize the corresponding partition functions \(\hat{q}[i,j] = q[i,j] / s^{(j-i+1)}\).
This function provides two ways to automatically adjust the scaling factor.
Automatic guess
Automatic adjustment according to MFE
Passing NULL as second parameter activates the automatic guess mode. Here, the scaling factor is recomputed according to a mean free energy of 184.3*length cal for random sequences. On the other hand, if the MFE for a sequence is known, it can be used to recompute a more robust scaling factor, since it represents the lowest free energy of the entire ensemble of structures, i.e. the highest Boltzmann factor. To activate this second mode of automatic adjustment according to MFE, a pointer to the MFE value needs to be passed as second argument. This value is then taken to compute the scaling factor as \(s = exp((sfact * MFE) / kT / length )\), where sfact is an additional scaling weight located in the RNA.md() data structure of exp_params in fc.
Note
This recomputation only takes place if the pf_scale attribute of the exp_params data structure contained in fc has a value below 1.0.
The computed scaling factor \(s\) will be stored as pf_scale attribute of the exp_params data structure in fc.
SWIG Wrapper Notes
This function is attached to RNA.fc() objects as overloaded exp_params_rescale() method.
When no parameter is passed to this method, the resulting action is the same as passing NULL as second parameter to RNA.fold_compound.exp_params_rescale(), i.e. default scaling of the partition function. Passing an energy in kcal/mol, e.g. as retrieved by a previous call to the mfe() method, instructs all subsequent calls to scale the partition function accordingly. See, e.g.
RNA.fold_compound.exp_params_rescale()
in the Python API.- Parameters:
mfe (
list-like(double)
) – A pointer to the MFE (in kcal/mol) or NULL
- exp_params_reset(md=None)
Reset Boltzmann factors for partition function computations within a RNA.fold_compound() according to provided, or default model details.
This function allows one to rescale Boltzmann factors for subsequent partition function computations according to a set of model details, e.g. temperature values. To do so, the caller provides either a pointer to a set of model details to be used for rescaling, or NULL if global default setting should be used.
SWIG Wrapper Notes
This function is attached to RNA.fc() objects as overloaded exp_params_reset() method.
When no parameter is passed to this method, the resulting action is the same as passing NULL as second parameter to RNA.fold_compound.exp_params_reset(), i.e. global default model settings are used. Passing an object of type RNA.md() resets the fold compound according to the specifications stored within the RNA.md() object. See, e.g.
RNA.fold_compound.exp_params_reset()
in the Python API.- Parameters:
md (
RNA.md() *
) – A pointer to the new model details (or NULL for reset to defaults)
- exp_params_subst(par)
Update the energy parameters for subsequent partition function computations.
This function can be used to properly assign new energy parameters for partition function computations to a RNA.fold_compound(). For this purpose, the data of the provided pointer params will be copied into fc and a recomputation of the partition function scaling factor is issued, if the pf_scale attribute of params is less than 1.0.
Passing NULL as second argument leads to a reset of the energy parameters within fc to their default values
SWIG Wrapper Notes
This function is attached to RNA.fc() objects as overloaded exp_params_subst() method.
When no parameter is passed, the resulting action is the same as passing NULL as second parameter to RNA.fold_compound.exp_params_subst(), i.e. resetting the parameters to the global defaults. See, e.g.
RNA.fold_compound.exp_params_subst()
in the Python API.- Parameters:
params (
RNA.exp_param() *
) – A pointer to the new energy parameters
See also
RNA.fold_compound.exp_params_reset
,RNA.fold_compound.exp_params_rescale
,RNA.exp_param
,RNA.md
,RNA.exp_params
- file_commands_apply(fold_compound self, std::string filename, unsigned int options=) int
- property hc
- hc_add_bp(fold_compound self, unsigned int i, unsigned int j, unsigned int option=VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS)
Favorize/Enforce a certain base pair (i,j)
- Parameters:
i (
unsigned int
) – The 5’ located nucleotide position of the base pair (1-based)j (
unsigned int
) – The 3’ located nucleotide position of the base pair (1-based)option (
unsigned char
) – The options flag indicating how/where to store the hard constraints
See also
RNA.fold_compound.hc_add_bp_nonspecific
,RNA.fold_compound.hc_add_up
,RNA.fold_compound.hc_init
,RNA.CONSTRAINT_CONTEXT_EXT_LOOP
,RNA.CONSTRAINT_CONTEXT_HP_LOOP
,RNA.CONSTRAINT_CONTEXT_INT_LOOP
,RNA.CONSTRAINT_CONTEXT_INT_LOOP_ENC
,RNA.CONSTRAINT_CONTEXT_MB_LOOP
,RNA.CONSTRAINT_CONTEXT_MB_LOOP_ENC
,RNA.CONSTRAINT_CONTEXT_ENFORCE
,RNA.CONSTRAINT_CONTEXT_ALL_LOOPS
- hc_add_bp_nonspecific(fold_compound self, unsigned int i, int d, unsigned int option=VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS)
Enforce a nucleotide to be paired (upstream/downstream)
- Parameters:
i (
unsigned int
) – The position that needs to stay unpaired (1-based)d (
int
) – The direction of base pairing ( \(d < 0\): pairs upstream, \(d > 0\): pairs downstream, \(d == 0\): no direction)option (
unsigned char
) – The options flag indicating in which loop type context the pairs may appear
See also
RNA.fold_compound.hc_add_bp
,RNA.fold_compound.hc_add_up
,RNA.fold_compound.hc_init
,RNA.CONSTRAINT_CONTEXT_EXT_LOOP
,RNA.CONSTRAINT_CONTEXT_HP_LOOP
,RNA.CONSTRAINT_CONTEXT_INT_LOOP
,RNA.CONSTRAINT_CONTEXT_INT_LOOP_ENC
,RNA.CONSTRAINT_CONTEXT_MB_LOOP
,RNA.CONSTRAINT_CONTEXT_MB_LOOP_ENC
,RNA.CONSTRAINT_CONTEXT_ALL_LOOPS
- hc_add_bp_strand(*args, **kwargs)
- hc_add_from_db(fold_compound self, char const * constraint, unsigned int options=) int
Add hard constraints from pseudo dot-bracket notation.
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 RNA.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 Python API .- Parameters:
constraint (
string
) – A pseudo dot-bracket notation of the hard constraint.options (
unsigned int
) – The option flags
See also
RNA.CONSTRAINT_DB_PIPE
,RNA.CONSTRAINT_DB_DOT
,RNA.CONSTRAINT_DB_X
,RNA.CONSTRAINT_DB_ANG_BRACK
,RNA.CONSTRAINT_DB_RND_BRACK
,RNA.CONSTRAINT_DB_INTRAMOL
,RNA.CONSTRAINT_DB_INTERMOL
,RNA.CONSTRAINT_DB_GQUAD
- hc_add_up(fold_compound self, unsigned int i, unsigned int option=VRNA_CONSTRAINT_CONTEXT_ALL_LOOPS)
Make a certain nucleotide unpaired.
- Parameters:
i (
unsigned int
) – The position that needs to stay unpaired (1-based)option (
unsigned char
) – The options flag indicating how/where to store the hard constraints
See also
RNA.fold_compound.hc_add_bp
,RNA.fold_compound.hc_add_bp_nonspecific
,RNA.fold_compound.hc_init
,RNA.CONSTRAINT_CONTEXT_EXT_LOOP
,RNA.CONSTRAINT_CONTEXT_HP_LOOP
,RNA.CONSTRAINT_CONTEXT_INT_LOOP
,RNA.CONSTRAINT_CONTEXT_MB_LOOP
,RNA.CONSTRAINT_CONTEXT_ALL_LOOPS
- hc_add_up_strand(*args, **kwargs)
- hc_init()
Initialize/Reset hard constraints to default values.
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 Python API .
- heat_capacity(fold_compound self, float T_min=0., float T_max=100., float T_increment=1., unsigned int mpoints=2) HeatCapacityVector
Compute the specific heat for an RNA.
This function computes an RNAs specific heat in a given temperature range from the partition function by numeric differentiation. The result is returned as a list of pairs of temperature in C and specific heat in Kcal/(Mol*K).
Users can specify the temperature range for the computation from T_min to T_max, as well as the increment step size T_increment. The latter also determines how many times the partition function is computed. Finally, the parameter mpoints determines how smooth the curve should be. The algorithm itself fits a parabola to \(2 \cdot mpoints + 1\) data points to calculate 2nd derivatives. Increasing this parameter produces a smoother curve.
SWIG Wrapper Notes
This function is attached as overloaded method heat_capacity() to objects of type fold_compound. If the optional function arguments T_min, T_max, T_increment, and mpoints are omitted, they default to 0.0, 100.0, 1.0 and 2, respectively. See, e.g.
RNA.fold_compound.heat_capacity()
in the Python API.- Parameters:
T_min (
float
) – Lowest temperature in CT_max (
float
) – Highest temperature in CT_increment (
float
) – Stepsize for temperature incrementation in C (a reasonable choice might be 1C)mpoints (
unsigned int
) – The number of interpolation points to calculate 2nd derivative (a reasonable choice might be 2, min: 1, max: 100)
- Returns:
A list of pairs of temperatures and corresponding heat capacity or NULL upon any failure. The last entry of the list is indicated by a temperature field set to a value smaller than T_min
- Return type:
RNA.heat_capacity() *
- heat_capacity_cb(fold_compound self, float T_min, float T_max, float T_increment, unsigned int mpoints, PyObject * PyFunc, PyObject * data=Py_None) PyObject *
Compute the specific heat for an RNA (callback variant)
Similar to RNA.fold_compound.heat_capacity(), this function computes an RNAs specific heat in a given temperature range from the partition function by numeric differentiation. Instead of returning a list of temperature/specific heat pairs, however, this function returns the individual results through a callback mechanism. The provided function will be called for each result and passed the corresponding temperature and specific heat values along with the arbitrary data as provided through the data pointer argument.
Users can specify the temperature range for the computation from T_min to T_max, as well as the increment step size T_increment. The latter also determines how many times the partition function is computed. Finally, the parameter mpoints determines how smooth the curve should be. The algorithm itself fits a parabola to \(2 \cdot mpoints + 1\) data points to calculate 2nd derivatives. Increasing this parameter produces a smoother curve.
SWIG Wrapper Notes
This function is attached as method heat_capacity_cb() to objects of type fold_compound. See, e.g.
RNA.fold_compound.heat_capacity_cb()
in the Python API.- Parameters:
T_min (
float
) – Lowest temperature in CT_max (
float
) – Highest temperature in CT_increment (
float
) – Stepsize for temperature incrementation in C (a reasonable choice might be 1C)mpoints (
unsigned int
) – The number of interpolation points to calculate 2nd derivative (a reasonable choice might be 2, min: 1, max: 100)cb (
RNA.heat_capacity
) – The user-defined callback function that receives the individual resultsdata (
void *
) – An arbitrary data structure that will be passed to the callback in conjunction with the results
- Returns:
Returns 0 upon failure, and non-zero otherwise
- Return type:
int
- property iindx
- property jindx
- property length
- property matrices
- maxmimum_matching()
- mean_bp_distance()
Get the mean base pair distance in the thermodynamic ensemble.
\[<d> = \sum_{a,b} p_{a} p_{b} d(S_{a},S_{b})\]this can be computed from the pair probs \(p_{ij}\) as
\[<d> = \sum_{ij} p_{ij}(1-p_{ij})\]SWIG Wrapper Notes
This function is attached as method mean_bp_distance() to objects of type fold_compound. See, e.g.
RNA.fold_compound.mean_bp_distance()
in the Python API.- Returns:
The mean pair distance of the structure ensemble
- Return type:
double
- mfe()
Compute minimum free energy and an appropriate secondary structure of an RNA sequence, or RNA sequence alignment.
Depending on the type of the provided RNA.fold_compound(), this function predicts the MFE for a single sequence (or connected component of multiple sequences), or an averaged MFE for a sequence alignment. If backtracking is activated, it also constructs the corresponding secondary structure, or consensus structure. Therefore, the second parameter, structure, has to point to an allocated block of memory with a size of at least \(\mathrm{strlen}(\mathrm{sequence})+1\) to store the backtracked MFE structure. (For consensus structures, this is the length of the alignment + 1. If NULL is passed, no backtracking will be performed.
SWIG Wrapper Notes
This function is attached as method mfe() to objects of type fold_compound. The parameter structure is returned along with the MFE und must not be provided. See e.g.
RNA.fold_compound.mfe()
in the Python API.- Parameters:
structure (
string
) – A pointer to the character array where the secondary structure in dot-bracket notation will be written to (Maybe NULL)- Returns:
the minimum free energy (MFE) in kcal/mol
- Return type:
float
See also
RNA.fold_compound
,RNA.fold_compound
,RNA.fold
,RNA.circfold
,RNA.fold_compound_comparative
,RNA.alifold
,RNA.circalifold
Note
This function is polymorphic. It accepts RNA.fold_compound() of type RNA.FC_TYPE_SINGLE, and RNA.FC_TYPE_COMPARATIVE.
- mfe_dimer(fold_compound self) char *
Compute the minimum free energy of two interacting RNA molecules.
The code is analog to the RNA.fold_compound.mfe() function.
Deprecated since version 2.7.0: This function is obsolete since RNA.fold_compound.mfe() can handle complexes multiple sequences since v2.5.0. Use RNA.fold_compound.mfe() for connected component MFE instead and compute MFEs of unconnected states separately.
SWIG Wrapper Notes
This function is attached as method mfe_dimer() to objects of type fold_compound. The parameter structure is returned along with the MFE und must not be provided. See e.g.
RNA.fold_compound.mfe_dimer()
in the Python API.- Parameters:
structure (
string
) – Will hold the barcket dot structure of the dimer molecule- Returns:
minimum free energy of the structure
- Return type:
float
See also
- mfe_window(nullfile=None)
Local MFE prediction using a sliding window approach.
Computes minimum free energy structures using a sliding window approach, where base pairs may not span outside the window. In contrast to RNA.fold_compound.mfe(), where a maximum base pair span may be set using the RNA.md().max_bp_span attribute and one globally optimal structure is predicted, this function uses a sliding window to retrieve all locally optimal structures within each window. The size of the sliding window is set in the RNA.md().window_size attribute, prior to the retrieval of the RNA.fold_compound() using RNA.fold_compound() with option RNA.OPTION_WINDOW
The predicted structures are written on-the-fly, either to stdout, if a NULL pointer is passed as file parameter, or to the corresponding filehandle.
SWIG Wrapper Notes
This function is attached as overloaded method mfe_window() to objects of type fold_compound. The parameter FILE has default value of NULL and can be omitted. See e.g.
RNA.fold_compound.mfe_window()
in the Python API.- Parameters:
file (
FILE *
) – The output file handle where predictions are written to (maybe NULL)
See also
RNA.fold_compound
,RNA.fold_compound.mfe_window_zscore
,RNA.fold_compound.mfe
,RNA.Lfold
,RNA.Lfoldz
,RNA.OPTION_WINDOW
,RNA.md
,RNA.md
- mfe_window_cb(fold_compound self, PyObject * PyFunc, PyObject * data=Py_None) float
SWIG Wrapper Notes
This function is attached as overloaded method mfe_window_cb() to objects of type fold_compound. The parameter data has default value of NULL and can be omitted. See e.g.
RNA.fold_compound.mfe_window_cb()
in the Python API.
- mfe_window_zscore(min_z, nullfile=None)
Local MFE prediction using a sliding window approach (with z-score cut-off)
Computes minimum free energy structures using a sliding window approach, where base pairs may not span outside the window. This function is the z-score version of RNA.fold_compound.mfe_window(), i.e. only predictions above a certain z-score cut-off value are printed. As for RNA.fold_compound.mfe_window(), the size of the sliding window is set in the RNA.md().window_size attribute, prior to the retrieval of the RNA.fold_compound() using RNA.fold_compound() with option RNA.OPTION_WINDOW.
The predicted structures are written on-the-fly, either to stdout, if a NULL pointer is passed as file parameter, or to the corresponding filehandle.
SWIG Wrapper Notes
This function is attached as overloaded method mfe_window_zscore() to objects of type fold_compound. The parameter FILE has default value of NULL and can be omitted. See e.g.
RNA.fold_compound.mfe_window_zscore()
in the Python API.- Parameters:
min_z (
double
) – The minimal z-score for a predicted structure to appear in the outputfile (
FILE *
) – The output file handle where predictions are written to (maybe NULL)
See also
RNA.fold_compound
,RNA.fold_compound.mfe_window_zscore
,RNA.fold_compound.mfe
,RNA.Lfold
,RNA.Lfoldz
,RNA.OPTION_WINDOW
,RNA.md
,RNA.md
- mfe_window_zscore_cb(fold_compound self, double min_z, PyObject * PyFunc, PyObject * data=Py_None) float
- move_neighbor_diff(self, pt, move, options=4 | 8) varArrayMove
- move_neighbor_diff(fold_compound self, varArrayShort pt, move move, PyObject * PyFunc, PyObject * data=Py_None, unsigned int options=(4|8)) int
Apply a move to a secondary structure and indicate which neighbors have changed consequentially.
Similar to RNA.move_neighbor_diff_cb(), this function applies a move to a secondary structure and reports back the neighbors of the current structure become affected by this move. Instead of executing a callback for each of the affected neighbors, this function compiles two lists of neighbor moves, one that is returned and consists of all moves that are novel or may have changed in energy, and a second, invalid_moves, that consists of all the neighbor moves that become invalid, respectively.
- Parameters:
ptable (
list-like(int)
) – The current structure as pair tablemove (
RNA.move()
) – The move to applyinvalid_moves (
RNA.move() **
) – The address of a move list where the function stores those moves that become invalidoptions (
unsigned int
) – Options to modify the behavior of this function, .e.g available move set
- Returns:
A list of moves that might have changed in energy or are novel compared to the structure before application of the move
- Return type:
RNA.move() *
- neighbors(fold_compound self, varArrayShort pt, unsigned int options=(4|8)) varArrayMove
Generate neighbors of a secondary structure.
This function allows one to generate all structural neighbors (according to a particular move set) of an RNA secondary structure. The neighborhood is then returned as a list of transitions / moves required to transform the current structure into the actual neighbor.
SWIG Wrapper Notes
This function is attached as an overloaded method neighbors() to objects of type fold_compound. The optional parameter options defaults to RNA.MOVESET_DEFAULT if it is omitted. See, e.g.
RNA.fold_compound.neighbors()
in the Python API.- Parameters:
pt (
const short *
) – The pair table representation of the structureoptions (
unsigned int
) – Options to modify the behavior of this function, e.g. available move set
- Returns:
Neighbors as a list of moves / transitions (the last element in the list has both of its fields set to 0)
- Return type:
RNA.move() *
See also
RNA.neighbors_successive
,RNA.move_apply
,RNA.MOVESET_INSERTION
,RNA.MOVESET_DELETION
,RNA.MOVESET_SHIFT
,RNA.MOVESET_DEFAULT
- property params
- params_reset(md=None)
Reset free energy parameters within a RNA.fold_compound() according to provided, or default model details.
This function allows one to rescale free energy parameters for subsequent structure prediction or evaluation according to a set of model details, e.g. temperature values. To do so, the caller provides either a pointer to a set of model details to be used for rescaling, or NULL if global default setting should be used.
SWIG Wrapper Notes
This function is attached to RNA.fc() objects as overloaded params_reset() method.
When no parameter is passed to this method, the resulting action is the same as passing NULL as second parameter to RNA.fold_compound.params_reset(), i.e. global default model settings are used. Passing an object of type RNA.md() resets the fold compound according to the specifications stored within the RNA.md() object. See, e.g.
RNA.fold_compound.params_reset()
in the Python API.- Parameters:
md (
RNA.md() *
) – A pointer to the new model details (or NULL for reset to defaults)
See also
RNA.fold_compound.exp_params_reset
,RNA.params_subs
- params_subst(par=None)
Update/Reset energy parameters data structure within a RNA.fold_compound().
Passing NULL as second argument leads to a reset of the energy parameters within fc to their default values. Otherwise, the energy parameters provided will be copied over into fc.
SWIG Wrapper Notes
This function is attached to RNA.fc() objects as overloaded params_subst() method.
When no parameter is passed, the resulting action is the same as passing NULL as second parameter to RNA.fold_compound.params_subst(), i.e. resetting the parameters to the global defaults. See, e.g.
RNA.fold_compound.params_subst()
in the Python API.- Parameters:
par (
RNA.param() *
) – The energy parameters used to substitute those within fc (Maybe NULL)
See also
RNA.fold_compound.params_reset
,RNA.param
,RNA.md
,RNA.params
- path(fold_compound self, IntVector pt, unsigned int steps, unsigned int options=) MoveVector
- path(fold_compound self, varArrayShort pt, unsigned int steps, unsigned int options=) MoveVector
Compute a path, store the final structure, and return a list of transition moves from the start to the final structure.
This function computes, given a start structure in pair table format, a transition path, updates the pair table to the final structure of the path. Finally, if not requested otherwise by using the RNA.PATH_NO_TRANSITION_OUTPUT flag in the options field, this function returns a list of individual transitions that lead from the start to the final structure if requested.
The currently available transition paths are
Steepest Descent / Gradient walk (flag: RNA.PATH_STEEPEST_DESCENT)
Random walk (flag: RNA.PATH_RANDOM)
The type of transitions must be set through the options parameter
SWIG Wrapper Notes
This function is attached as an overloaded method path() to objects of type fold_compound. The optional parameter options defaults to RNA.PATH_DEFAULT if it is omitted. See, e.g.
RNA.fold_compound.path()
in the Python API.- Parameters:
pt (
list-like(int)
) – The pair table containing the start structure. Used to update to the final structure after execution of this functionoptions (
unsigned int
) – Options to modify the behavior of this function
- Returns:
A list of transition moves (default), or NULL (if options & RNA.PATH_NO_TRANSITION_OUTPUT)
- Return type:
RNA.move() *
See also
RNA.fold_compound.path_gradient
,RNA.fold_compound.path_random
,RNA.ptable
,RNA.ptable_copy
,RNA.fold_compound
,RNA.PATH_RANDOM
,RNA.MOVESET_DEFAULT
,RNA.MOVESET_SHIFT
,RNA.PATH_NO_TRANSITION_OUTPUT
Note
Since the result is written to the input structure you may want to use RNA.ptable_copy() before calling this function to keep the initial structure
- path_direct(fold_compound self, std::string s1, std::string s2, int maxE=INT_MAX-1, path_options options=None) PathVector
Determine an optimal direct (re-)folding path between two secondary structures.
This function is similar to RNA.path_direct(), but allows to specify an upper-bound for the saddle point energy. The underlying algorithms will stop determining an (optimal) (re-)folding path, if none can be found that has a saddle point below the specified upper-bound threshold maxE.
SWIG Wrapper Notes
This function is attached as an overloaded method path_direct() to objects of type fold_compound. The optional parameter maxE defaults to #INT_MAX - 1 if it is omitted, while the optional parameter options defaults to NULL. In case the function did not find a path with \(E_{saddle} < E_{max}\) it returns an empty list. See, e.g.
RNA.fold_compound.path_direct()
in the Python API.- Parameters:
s1 (
string
) – The start structure in dot-bracket notations2 (
string
) – The target structure in dot-bracket notationmaxE (
int
) – Upper bound for the saddle point along the (re-)folding pathoptions (
RNA.path_options()
) – An options data structure that specifies the path heuristic and corresponding settings (maybe NULL)
- Returns:
An optimal (re-)folding path between the two input structures
- Return type:
RNA.path() *
Warning
The argument maxE enables one to specify an upper bound, or maximum free energy for the saddle point between the two input structures. If no path with \(E_{saddle} < E_{max}\) is found, the function simply returns NULL
See also
RNA.fold_compound.path_direct
,RNA.path_options_findpath
,RNA.path_options_free
,RNA.path_free
- path_findpath(fold_compound self, std::string s1, std::string s2, int width=1, int maxE=INT_MAX-1) PathVector
- path_findpath_saddle(fold_compound self, std::string s1, std::string s2, int width=1, int maxE=INT_MAX) PyObject *
Find energy of a saddle point between 2 structures (search only direct path)
This function uses an inplementation of the findpath algorithm [Flamm et al., 2001] for near- optimal direct refolding path prediction.
Model details, and energy parameters are used as provided via the parameter ‘fc’. The RNA.fold_compound() does not require memory for any DP matrices, but requires all most basic init values as one would get from a call like this:
SWIG Wrapper Notes
This function is attached as an overloaded method path_findpath_saddle() to objects of type fold_compound. The optional parameter width defaults to 1 if it is omitted, while the optional parameter maxE defaults to INF. In case the function did not find a path with \(E_{saddle} < E_{max}\) the function returns a NULL object, i.e. undef for Perl and None for Python. See, e.g.
RNA.fold_compound.path_findpath_saddle()
in the Python API.- Parameters:
s1 (
string
) – The start structure in dot-bracket notations2 (
string
) – The target structure in dot-bracket notationwidth (
int
) – A number specifying how many strutures are being kept at each step during the searchmaxE (
int
) – An upper bound for the saddle point energy in 10cal/mol
- Returns:
The saddle energy in 10cal/mol
- Return type:
int
Warning
The argument maxE ( \(E_{max}\)) enables one to specify an upper bound, or maximum free energy for the saddle point between the two input structures. If no path with \(E_{saddle} < E_{max}\) is found, the function simply returns maxE
See also
RNA.path_findpath_saddle
,RNA.fold_compound
,RNA.fold_compound
,RNA.path_findpath
- path_gradient(fold_compound self, IntVector pt, unsigned int options=) MoveVector
- path_gradient(fold_compound self, varArrayShort pt, unsigned int options=) MoveVector
Compute a steepest descent / gradient path, store the final structure, and return a list of transition moves from the start to the final structure.
This function computes, given a start structure in pair table format, a steepest descent path, updates the pair table to the final structure of the path. Finally, if not requested otherwise by using the RNA.PATH_NO_TRANSITION_OUTPUT flag in the options field, this function returns a list of individual transitions that lead from the start to the final structure if requested.
SWIG Wrapper Notes
This function is attached as an overloaded method path_gradient() to objects of type fold_compound. The optional parameter options defaults to RNA.PATH_DEFAULT if it is omitted. See, e.g.
RNA.fold_compound.path_gradient()
in the Python API.- Parameters:
pt (
list-like(int)
) – The pair table containing the start structure. Used to update to the final structure after execution of this functionoptions (
unsigned int
) – Options to modify the behavior of this function
- Returns:
A list of transition moves (default), or NULL (if options & RNA.PATH_NO_TRANSITION_OUTPUT)
- Return type:
RNA.move() *
See also
RNA.fold_compound.path_random
,RNA.fold_compound.path
,RNA.ptable
,RNA.ptable_copy
,RNA.fold_compound
,RNA.MOVESET_SHIFT
,RNA.PATH_NO_TRANSITION_OUTPUT
Note
Since the result is written to the input structure you may want to use RNA.ptable_copy() before calling this function to keep the initial structure
- path_random(fold_compound self, IntVector pt, unsigned int steps, unsigned int options=) MoveVector
- path_random(fold_compound self, varArrayShort pt, unsigned int steps, unsigned int options=) MoveVector
Generate a random walk / path of a given length, store the final structure, and return a list of transition moves from the start to the final structure.
This function generates, given a start structure in pair table format, a random walk / path, updates the pair table to the final structure of the path. Finally, if not requested otherwise by using the RNA.PATH_NO_TRANSITION_OUTPUT flag in the options field, this function returns a list of individual transitions that lead from the start to the final structure if requested.
SWIG Wrapper Notes
This function is attached as an overloaded method path_gradient() to objects of type fold_compound. The optional parameter options defaults to RNA.PATH_DEFAULT if it is omitted. See, e.g.
RNA.fold_compound.path_random()
in the Python API.- Parameters:
pt (
list-like(int)
) – The pair table containing the start structure. Used to update to the final structure after execution of this functionsteps (
unsigned int
) – The length of the path, i.e. the total number of transitions / movesoptions (
unsigned int
) – Options to modify the behavior of this function
- Returns:
A list of transition moves (default), or NULL (if options & RNA.PATH_NO_TRANSITION_OUTPUT)
- Return type:
RNA.move() *
See also
RNA.fold_compound.path_gradient
,RNA.fold_compound.path
,RNA.ptable
,RNA.ptable_copy
,RNA.fold_compound
,RNA.MOVESET_SHIFT
,RNA.PATH_NO_TRANSITION_OUTPUT
Note
Since the result is written to the input structure you may want to use RNA.ptable_copy() before calling this function to keep the initial structure
- pbacktrack(fold_compound self) char
- pbacktrack(fold_compound self, unsigned int num_samples, unsigned int options=) StringVector
- pbacktrack(fold_compound self, unsigned int num_samples, pbacktrack_mem nr_memory, unsigned int options=) StringVector
- pbacktrack(self, num_samples, PyFunc, data=Py_None, options=0) unsigned int
- Parameters:
num_samples (
unsigned int
) –PyFunc (
PyObject *
) –data (
PyObject *
) –options (
unsigned int
) –pbacktrack(self –
num_samples –
PyFunc –
data –
nr_memory (
vrna_pbacktrack_mem_t *
) –int (options=0) -> unsigned) –
num_samples –
PyFunc –
data –
nr_memory –
options –
Sample a secondary structure from the Boltzmann ensemble according its probability.
Perform a probabilistic (stochastic) backtracing in the partition function DP arrays to obtain a secondary structure.
The structure \(s\) with free energy \(E(s)\) is picked from the Boltzmann distributed ensemble according to its probability
\[p(s) = \frac{exp(-E(s) / kT)}{Z}\]with partition function \(Z = \sum_{s} exp(-E(s) / kT)\), Boltzmann constant \(k\) and thermodynamic temperature \(T\).
- Precondition
Unique multiloop decomposition has to be active upon creation of fc with RNA.fold_compound() or similar. This can be done easily by passing RNA.fold_compound() a model details parameter with RNA.md().uniq_ML = 1. RNA.fold_compound.pf() has to be called first to fill the partition function matrices
SWIG Wrapper Notes
This function is attached as overloaded method pbacktrack() to objects of type fold_compound. See, e.g.
RNA.fold_compound.pbacktrack()
in the Python API and the Boltzmann Sampling Python examples .- Returns:
A sampled secondary structure in dot-bracket notation (or NULL on error)
- Return type:
string
See also
RNA.fold_compound.pbacktrack5
,RNA.pbacktrack_num
,RNA.pbacktrack_cb
Note
This function is polymorphic. It accepts RNA.fold_compound() of type RNA.FC_TYPE_SINGLE, and RNA.FC_TYPE_COMPARATIVE.
- pbacktrack5(fold_compound self, unsigned int length) char
- pbacktrack5(fold_compound self, unsigned int num_samples, unsigned int length, unsigned int options=) StringVector
- pbacktrack5(fold_compound self, unsigned int num_samples, unsigned int length, pbacktrack_mem nr_memory, unsigned int options=) StringVector
- pbacktrack5(fold_compound self, unsigned int num_samples, unsigned int length, PyObject * PyFunc, PyObject * data=Py_None, unsigned int options=0) unsigned int
- pbacktrack5(fold_compound self, unsigned int num_samples, unsigned int length, PyObject * PyFunc, PyObject * data, pbacktrack_mem nr_memory, unsigned int options=0) unsigned int
Sample a secondary structure of a subsequence from the Boltzmann ensemble according its probability.
Perform a probabilistic (stochastic) backtracing in the partition function DP arrays to obtain a secondary structure. The parameter length specifies the length of the substructure starting from the 5’ end.
The structure \(s\) with free energy \(E(s)\) is picked from the Boltzmann distributed ensemble according to its probability
\[p(s) = \frac{exp(-E(s) / kT)}{Z}\]with partition function \(Z = \sum_{s} exp(-E(s) / kT)\), Boltzmann constant \(k\) and thermodynamic temperature \(T\).
- Precondition
Unique multiloop decomposition has to be active upon creation of fc with RNA.fold_compound() or similar. This can be done easily by passing RNA.fold_compound() a model details parameter with RNA.md().uniq_ML = 1. RNA.fold_compound.pf() has to be called first to fill the partition function matrices
SWIG Wrapper Notes
This function is attached as overloaded method pbacktrack5() to objects of type fold_compound. See, e.g.
RNA.fold_compound.pbacktrack5()
in the Python API and the Boltzmann Sampling Python examples .- Parameters:
length (
unsigned int
) – The length of the subsequence to consider (starting with 5’ end)- Returns:
A sampled secondary structure in dot-bracket notation (or NULL on error)
- Return type:
string
See also
RNA.pbacktrack5_num
,RNA.pbacktrack5_cb
,RNA.fold_compound.pbacktrack
Note
This function is polymorphic. It accepts RNA.fold_compound() of type RNA.FC_TYPE_SINGLE, and RNA.FC_TYPE_COMPARATIVE.
- pbacktrack_sub(fold_compound self, unsigned int start, unsigned int end) char
- pbacktrack_sub(fold_compound self, unsigned int num_samples, unsigned int start, unsigned int end, unsigned int options=) StringVector
- pbacktrack_sub(fold_compound self, unsigned int num_samples, unsigned int start, unsigned int end, pbacktrack_mem nr_memory, unsigned int options=) StringVector
- pbacktrack_sub(fold_compound self, unsigned int num_samples, unsigned int start, unsigned int end, PyObject * PyFunc, PyObject * data=Py_None, unsigned int options=0) unsigned int
- pbacktrack_sub(fold_compound self, unsigned int num_samples, unsigned int start, unsigned int end, PyObject * PyFunc, PyObject * data, pbacktrack_mem nr_memory, unsigned int options=0) unsigned int
Sample a secondary structure of a subsequence from the Boltzmann ensemble according its probability.
Perform a probabilistic (stochastic) backtracing in the partition function DP arrays to obtain a secondary structure. The parameters start and end specify the interval \([start:end]\) of the subsequence with \(1 \leq start < end \leq n\) for sequence length \(n\), the structure \(s_{start,end}\) should be drawn from.
The resulting substructure \(s_{start,end}\) with free energy \(E(s_{start, end})\) is picked from the Boltzmann distributed sub ensemble of all structures within the interval \([start:end]\) according to its probability
\[p(s_{start,end}) = \frac{exp(-E(s_{start,end}) / kT)}{Z_{start,end}}\]with partition function \(Z_{start,end} = \sum_{s_{start,end}} exp(-E(s_{start,end}) / kT)\), Boltzmann constant \(k\) and thermodynamic temperature \(T\).
- Precondition
Unique multiloop decomposition has to be active upon creation of fc with RNA.fold_compound() or similar. This can be done easily by passing RNA.fold_compound() a model details parameter with RNA.md().uniq_ML = 1. RNA.fold_compound.pf() has to be called first to fill the partition function matrices
SWIG Wrapper Notes
This function is attached as overloaded method pbacktrack_sub() to objects of type fold_compound. See, e.g.
RNA.fold_compound.pbacktrack_sub()
in the Python API and the Boltzmann Sampling Python examples .- Parameters:
start (
unsigned int
) – The start of the subsequence to consider, i.e. 5’-end position(1-based)end (
unsigned int
) – The end of the subsequence to consider, i.e. 3’-end position (1-based)
- Returns:
A sampled secondary structure in dot-bracket notation (or NULL on error)
- Return type:
string
See also
RNA.pbacktrack_sub_num
,RNA.pbacktrack_sub_cb
,RNA.fold_compound.pbacktrack
Note
This function is polymorphic. It accepts RNA.fold_compound() of type RNA.FC_TYPE_SINGLE, and RNA.FC_TYPE_COMPARATIVE.
- pf()
Compute the partition function \(Q\) for a given RNA sequence, or sequence alignment.
If structure is not a NULL pointer on input, it contains on return a string consisting of the letters “ . , | { } ( ) “ denoting bases that are essentially unpaired, weakly paired, strongly paired without preference, weakly upstream (downstream) paired, or strongly up- (down-)stream paired bases, respectively. If the model’s compute_bpp is set to 0 base pairing probabilities will not be computed (saving CPU time), otherwise after calculations took place pr will contain the probability that bases i and j pair.
SWIG Wrapper Notes
This function is attached as method pf() to objects of type fold_compound. See, e.g.
RNA.fold_compound.pf()
in the Python API.- Parameters:
structure (
string
) – A pointer to the character array where position-wise pairing propensity will be stored. (Maybe NULL)- Returns:
The ensemble free energy \(G = -RT \cdot \log(Q)\) in kcal/mol
- Return type:
double
See also
RNA.fold_compound
,RNA.fold_compound
,RNA.pf_fold
,RNA.pf_circfold
,RNA.fold_compound_comparative
,RNA.pf_alifold
,RNA.pf_circalifold
,RNA.db_from_probs
,RNA.exp_params
,RNA.aln_pinfo
Note
This function is polymorphic. It accepts RNA.fold_compound() of type RNA.FC_TYPE_SINGLE, and RNA.FC_TYPE_COMPARATIVE. Also, this function may return INF / 100. in case of contradicting constraints or numerical over-/underflow. In the latter case, a corresponding warning will be issued to stdout.
- pf_dimer()
Calculate partition function and base pair probabilities of nucleic acid/nucleic acid dimers.
This is the cofold partition function folding.
SWIG Wrapper Notes
This function is attached as method pf_dimer() to objects of type fold_compound. See, e.g.
RNA.fold_compound.pf_dimer()
in the Python API.- Parameters:
structure (
string
) – Will hold the structure or constraints- Returns:
RNA.dimer_pf() structure containing a set of energies needed for concentration computations.
- Return type:
RNA.dimer_pf()
See also
Note
This function may return INF / 100. for the FA, FB, FAB, F0AB members of the output data structure in case of contradicting constraints or numerical over-/underflow. In the latter case, a corresponding warning will be issued to stdout.
- plist_from_probs(fold_compound self, double cutoff) ElemProbVector
Create a RNA.ep() from base pair probability matrix.
The probability matrix provided via the RNA.fold_compound() is parsed and all pair probabilities above the given threshold are used to create an entry in the plist
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:
cut_off (
double
) – The cutoff value- Returns:
A pointer to the plist that is to be created
- Return type:
RNA.ep() *
- positional_entropy()
Compute a vector of positional entropies.
This function computes the positional entropies from base pair probabilities as
\[S(i) = - \sum_{j} p_{ij} \log(p_{ij}) - q_{i} \log(q_{i})\]with unpaired probabilities \(q_{i} = 1 - \sum_{j} p_{ij}\).
Low entropy regions have little structural flexibility and the reliability of the predicted structure is high. High entropy implies many structural alternatives. While these alternatives may be functionally important, they make structure prediction more difficult and thus less reliable.
- Precondition
This function requires pre-computed base pair probabilities! Thus, RNA.fold_compound.pf() must be called beforehand.
SWIG Wrapper Notes
This function is attached as method positional_entropy() to objects of type fold_compound. See, e.g.
RNA.fold_compound.positional_entropy()
in the Python API.- Returns:
A 1-based vector of positional entropies \(S(i)\). (position 0 contains the sequence length)
- Return type:
list-like(double)
- pr_energy(e)
SWIG Wrapper Notes
This function is attached as method pr_energy() to objects of type fold_compound. See, e.g.
RNA.fold_compound.pr_energy()
in the Python API.
- pr_structure(structure)
Compute the equilibrium probability of a particular secondary structure.
The probability \(p(s)\) of a particular secondary structure \(s\) can be computed as
\[p(s) = \frac{exp(-\beta E(s)}{Z}\]from the structures free energy \(E(s)\) and the partition function
\[Z = \sum_{s} exp(-\beta E(s)),\quad\mathrm{with}\quad\beta = \frac{1}{RT}\]where \(R\) is the gas constant and \(T\) the thermodynamic temperature.
- Precondition
The fold compound fc must have went through a call to RNA.fold_compound.pf() to fill the dynamic programming matrices with the corresponding partition function.
SWIG Wrapper Notes
This function is attached as method pr_structure() to objects of type fold_compound. See, e.g.
RNA.fold_compound.pr_structure()
in the Python API.- Parameters:
structure (
string
) – The secondary structure to compute the probability for in dot-bracket notation- Returns:
The probability of the input structure (range \([0:1]\))
- Return type:
double
- probs_window(fold_compound self, int ulength, unsigned int options, PyObject * PyFunc, PyObject * data=Py_None) int
Compute various equilibrium probabilities under a sliding window approach.
This function applies a sliding window scan for the sequence provided with the argument fc and reports back equilibrium probabilities through the callback function cb. The data reported to the callback depends on the options flag.
#### Options: .. note:
The parameter `ulength` only affects computation and resulting data if unpaired probability computations are requested through the `options` flag. * RNA.PROBS_WINDOW_BPP - Trigger base pairing probabilities. * RNA.PROBS_WINDOW_UP - Trigger unpaired probabilities. * RNA.PROBS_WINDOW_UP_SPLIT - Trigger detailed unpaired probabilities split up into different loop type contexts. Options may be OR-ed together
- Parameters:
ulength (
int
) – The maximal length of an unpaired segment (only for unpaired probability computations)cb (
RNA.probs_window
) – The callback function which collects the pair probability data for further processingdata (
void *
) – Some arbitrary data structure that is passed to the callback cboptions (
unsigned int
) – Option flags to control the behavior of this function
- Returns:
0 on failure, non-zero on success
- Return type:
int
See also
- rotational_symmetry_db(structure)
Determine the order of rotational symmetry for a dot-bracket structure.
Given a (permutation of multiple) RNA strand(s) and a particular secondary structure in dot-bracket notation, compute the degree of rotational symmetry. In case there is only a single linear RNA strand, the structure always has degree 1, as there are no rotational symmetries due to the direction of the nucleic acid sequence and the fixed positions of 5’ and 3’ ends. However, for circular RNAs, rotational symmetries might arise if the sequence consists of a concatenation of \(k\) identical subsequences.
If the argument positions is not NULL, the function stores an array of string start positions for rotational shifts that map the string back onto itself. This array has length of order of rotational symmetry, i.e. the number returned by this function. The first element positions`[0] always contains a shift value of `0 representing the trivial rotation.
SWIG Wrapper Notes
This function is attached as method rotational_symmetry_db() to objects of type fold_compound (i.e. RNA.fold_compound()). Thus, the first argument must be omitted. In contrast to our C-implementation, this function doesn’t simply return the order of rotational symmetry of the secondary structure, but returns the list position of cyclic permutation shifts that result in a rotationally symmetric structure. The length of the list then determines the order of rotational symmetry. See, e.g.
RNA.fold_compound.rotational_symmetry_db()
in the Python API .- Parameters:
structure (
string
) – The dot-bracket structure the degree of rotational symmetry is checked forpositions (
list-like(list-like(unsigned int))
) – A pointer to an (undefined) list of alternative string start positions that lead to an identity mapping (may be NULL)
- Returns:
The degree of rotational symmetry of the structure (0 in case of any errors)
- Return type:
unsigned int
See also
RNA.rotational_symmetry_db
,RNA.rotational_symmetry_pos
,RNA.rotational_symmetry_pos_num
Note
Do not forget to release the memory occupied by positions after a successful execution of this function.
- sc_add_SHAPE_deigan(fold_compound self, DoubleVector reactivities, double m, double b, unsigned int options=) int
Add SHAPE reactivity data as soft constraints (Deigan et al. method)
This approach of SHAPE directed RNA folding uses the simple linear ansatz
\[\Delta G_{\text{SHAPE}}(i) = m \ln(\text{SHAPE reactivity}(i)+1)+ b\]to convert SHAPE reactivity values to pseudo energies whenever a nucleotide \(i\) contributes to a stacked pair. A positive slope \(m\) penalizes high reactivities in paired regions, while a negative intercept \(b\) results in a confirmatory `bonus’ free energy for correctly predicted base pairs. Since the energy evaluation of a base pair stack involves two pairs, the pseudo energies are added for all four contributing nucleotides. Consequently, the energy term is applied twice for pairs inside a helix and only once for pairs adjacent to other structures. For all other loop types the energy model remains unchanged even when the experimental data highly disagrees with a certain motif.
SWIG Wrapper Notes
This function is attached as method sc_add_SHAPE_deigan() to objects of type fold_compound. See, e.g.
RNA.fold_compound.sc_add_SHAPE_deigan()
in the Python API .- Parameters:
reactivities (
list-like(double)
) – A vector of normalized SHAPE reactivitiesm (
double
) – The slope of the conversion functionb (
double
) – The intercept of the conversion functionoptions (
unsigned int
) – The options flag indicating how/where to store the soft constraints
- Returns:
1 on successful extraction of the method, 0 on errors
- Return type:
int
See also
RNA.fold_compound.sc_remove
,RNA.fold_compound.sc_add_SHAPE_zarringhalam
,RNA.sc_minimize_pertubation
Note
For further details, we refer to Deigan et al. [2009] .
- sc_add_SHAPE_deigan_ali(fold_compound self, StringVector shape_files, IntVector shape_file_association, double m, double b, unsigned int options=) int
Add SHAPE reactivity data from files as soft constraints for consensus structure prediction (Deigan et al. method)
SWIG Wrapper Notes
This function is attached as method sc_add_SHAPE_deigan_ali() to objects of type fold_compound. See, e.g.
RNA.fold_compound.sc_add_SHAPE_deigan_ali()
in the Python API .- Parameters:
shape_files (
const char **
) – A set of filenames that contain normalized SHAPE reactivity datashape_file_association (
const int *
) – An array of integers that associate the files with sequences in the alignmentm (
double
) – The slope of the conversion functionb (
double
) – The intercept of the conversion functionoptions (
unsigned int
) – The options flag indicating how/where to store the soft constraints
- Returns:
1 on successful extraction of the method, 0 on errors
- Return type:
int
- sc_add_SHAPE_eddy_2(fold_compound self, DoubleVector reactivities, DoubleVector unpaired_data, DoubleVector paired_data) int
- sc_add_SHAPE_zarringhalam(fold_compound self, DoubleVector reactivities, double b, double default_value, char const * shape_conversion, unsigned int options=) int
Add SHAPE reactivity data as soft constraints (Zarringhalam et al. method)
This method first converts the observed SHAPE reactivity of nucleotide \(i\) into a probability \(q_{i}\) that position \(i\) is unpaired by means of a non-linear map. Then pseudo-energies of the form
\[\Delta G_{\text{SHAPE}}(x,i) = \beta\ |x_{i} - q_{i}|\]are computed, where \(x_{i}=0\) if position \(i\) is unpaired and \(x_{i}=1\) if \(i\) is paired in a given secondary structure. The parameter \(\beta\) serves as scaling factor. The magnitude of discrepancy between prediction and experimental observation is represented by \(|x_{i} - q_{i}|\).
SWIG Wrapper Notes
This function is attached as method sc_add_SHAPE_zarringhalam() to objects of type fold_compound. See, e.g.
RNA.fold_compound.sc_add_SHAPE_zarringhalam()
in the Python API .- Parameters:
reactivities (
list-like(double)
) – A vector of normalized SHAPE reactivitiesb (
double
) – The scaling factor \(\beta\) of the conversion functiondefault_value (
double
) – The default value for a nucleotide where reactivity data is missing forshape_conversion (
string
) – A flag that specifies how to convert reactivities to probabilitiesoptions (
unsigned int
) – The options flag indicating how/where to store the soft constraints
- Returns:
1 on successful extraction of the method, 0 on errors
- Return type:
int
See also
RNA.fold_compound.sc_remove
,RNA.fold_compound.sc_add_SHAPE_deigan
,RNA.sc_minimize_pertubation
Note
For further details, we refer to Zarringhalam et al. [2012]
- sc_add_bp(*args)
Add soft constraints for paired nucleotides.
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:
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\): In both variants, the optional argument options defaults to RNA.OPTION_DEFAULT. See, e.g.
RNA.fold_compound.sc_add_bp()
in the Python API .- Parameters:
i (
unsigned int
) – The 5’ position of the base pair the soft constraint is added forj (
unsigned int
) – The 3’ position of the base pair the soft constraint is added forenergy (
double
) – The free energy (soft-constraint) in \(kcal / mol\)options (
unsigned int
) – The options flag indicating how/where to store the soft constraints
- Returns:
Non-zero on successful application of the constraint, 0 otherwise.
- Return type:
int
- sc_add_bt(fold_compound self, PyObject * PyFunc) int
Bind a backtracking function pointer for generic soft constraint feature.
This function allows one to easily bind a function pointer to the soft constraint part RNA.sc() of the RNA.fold_compound(). 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 RNA.basepair() 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 Python API .- Parameters:
f (
RNA.sc_bt
) – A pointer to the function that returns additional base pairs- Returns:
Non-zero on successful binding the callback function, 0 otherwise
- Return type:
int
See also
RNA.fold_compound.sc_add_data
,RNA.fold_compound.sc_add
,RNA.fold_compound.sc_add_exp
- sc_add_data(fold_compound self, PyObject * data, PyObject * callback=Py_None) int
Add an auxiliary data structure for the generic soft constraints callback function.
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 Python API .- Parameters:
data (
void *
) – A pointer to the data structure that holds required data for function ‘f’free_data (
RNA.auxdata_free
) – 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
- Return type:
int
See also
RNA.fold_compound.sc_add
,RNA.fold_compound.sc_add_exp
,RNA.fold_compound.sc_add_bt
- sc_add_exp_f(fold_compound self, PyObject * PyFunc) int
Bind a function pointer for generic soft constraint feature (PF version)
This function allows one to easily bind a function pointer and corresponding data structure to the soft constraint part RNA.sc() of the RNA.fold_compound(). 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() to objects of type fold_compound. See, e.g.
RNA.fold_compound.sc_add_exp()
in the Python API .- Parameters:
exp (
RNA.sc_exp
) – A pointer to the function that evaluates the generic soft constraint feature- Returns:
Non-zero on successful binding the callback function, 0 otherwise
- Return type:
int
See also
RNA.fold_compound.sc_add_bt
,RNA.fold_compound.sc_add
,RNA.fold_compound.sc_add_data
- sc_add_f(fold_compound self, PyObject * callback) int
Bind a function pointer for generic soft constraint feature (MFE version)
This function allows one to easily bind a function pointer and corresponding data structure to the soft constraint part RNA.sc() of the RNA.fold_compound(). 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() to objects of type fold_compound. See, e.g.
RNA.fold_compound.sc_add()
in the Python API .- Parameters:
f (
RNA.sc
) – A pointer to the function that evaluates the generic soft constraint feature- Returns:
Non-zero on successful binding the callback function, 0 otherwise
- Return type:
int
See also
RNA.fold_compound.sc_add_data
,RNA.fold_compound.sc_add_bt
,RNA.fold_compound.sc_add_exp
- sc_add_hi_motif(fold_compound self, char const * seq, char const * structure, FLT_OR_DBL energy, unsigned int options=) int
Add soft constraints for hairpin or internal loop binding motif.
Here is an example that adds a theophylline binding motif. Free energy contribution is derived from \(k_{d} = 0.1 \mu M\), taken from Jenison et al. 1994. At \(1M\) concentration the corresponding binding free energy amounts to \(-9.93~kcal/mol\).
SWIG Wrapper Notes
This function is attached as method sc_add_hi_motif() to objects of type fold_compound. The last parameter is optional an defaults to options = RNA.OPTION_DEFAULT. See, e.g.
RNA.fold_compound.sc_add_hi_motif()
in the Python API .- Parameters:
seq (
string
) – The sequence motif (may be interspaced by ‘&’ characterstructure (
string
) – The structure motif (may be interspaced by ‘&’ characterenergy (
double
) – The free energy of the motif (e.g. binding free energy)options (
unsigned int
) – Options
- Returns:
non-zero value if application of the motif using soft constraints was successful
- Return type:
int
- sc_add_stack(fold_compound self, unsigned int i, double energy, unsigned int options=) int
- sc_add_stack(fold_compound self, UIntVector i, DoubleVector energies, unsigned int options=) int
- sc_add_up(*args)
Add soft constraints for unpaired nucleotides.
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:
or an entire vector that stores free energy contributions for each nucleotide \(i\) with \(1 \leq i \leq n\): In both variants, the optional argument options defaults to RNA.OPTION_DEFAULT. See, e.g.
RNA.fold_compound.sc_add_up()
in the Python API .- Parameters:
i (
unsigned int
) – The nucleotide position the soft constraint is added forenergy (
double
) – The free energy (soft-constraint) in \(kcal / mol\)options (
unsigned int
) – The options flag indicating how/where to store the soft constraints
- Returns:
Non-zero on successful application of the constraint, 0 otherwise.
- Return type:
int
See also
RNA.fold_compound.sc_set_up
,RNA.fold_compound.sc_add_bp
,RNA.fold_compound.sc_set_bp
,RNA.sc_add_up_comparative
- sc_init()
Initialize an empty soft constraints data structure within a RNA.fold_compound().
This function adds a proper soft constraints data structure to the RNA.fold_compound() 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 Python API .See also
RNA.fold_compound.sc_set_bp
,RNA.fold_compound.sc_set_up
,RNA.fold_compound.sc_add_SHAPE_deigan
,RNA.fold_compound.sc_add_SHAPE_zarringhalam
,RNA.fold_compound.sc_remove
,RNA.fold_compound.sc_add
,RNA.fold_compound.sc_add_exp
,RNA.sc_add_pre
,RNA.sc_add_post
Note
Accepts RNA.fold_compound() of type RNA.FC_TYPE_SINGLE and RNA.FC_TYPE_COMPARATIVE
- sc_mod(*args, **kwargs)
Prepare soft constraint callbacks for modified base as specified in JSON string.
This function takes a RNA.sc_mod_param() data structure as obtained from RNA.sc_mod_read_from_json() or RNA.sc_mod_read_from_jsonfile() and prepares all requirements to acknowledge modified bases as specified in the provided params data structure. All subsequent predictions will treat each modification site special and adjust energy contributions if necessary.
SWIG Wrapper Notes
This function is attached as overloaded method sc_mod() to objects of type fold_compound with default options = RNA.SC_MOD_DEFAULT. See, e.g.
RNA.fold_compound.sc_mod()
in the Python API .- Parameters:
json – The JSON formatted string with the modified base parameters
modification_sites (
const unsigned int *
) – A list of modification site, i.e. positions that contain the modified base (1-based, last element in the list indicated by 0)options (
unsigned int
) – A bitvector of options how to handle the input, e.g. RNA.SC_MOD_DEFAULT
- Returns:
Number of sequence positions modified base parameters will be used for
- Return type:
int
See also
RNA.sc_mod_read_from_json
,RNA.sc_mod_read_from_jsonfile
,RNA.fold_compound.sc_mod_json
,RNA.fold_compound.sc_mod_jsonfile
,RNA.fold_compound.sc_mod_m6A
,RNA.fold_compound.sc_mod_pseudouridine
,RNA.fold_compound.sc_mod_inosine
,RNA.fold_compound.sc_mod_7DA
,RNA.fold_compound.sc_mod_purine
,RNA.sc_mod_dihydrouridine
,RNA.SC_MOD_CHECK_UNMOD
,RNA.SC_MOD_SILENT
,RNA.SC_MOD_DEFAULT
- sc_mod_7DA(*args, **kwargs)
Add soft constraint callbacks for 7-deaza-adenosine (7DA)
This is a convenience wrapper to add support for 7-deaza-adenosine using the soft constraint callback mechanism. Modification sites are provided as a list of sequence positions (1-based). Energy parameter corrections are derived from Richardson and Znosko [2016] .
SWIG Wrapper Notes
This function is attached as overloaded method sc_mod_7DA() to objects of type fold_compound with default options = RNA.SC_MOD_DEFAULT. See, e.g.
RNA.fold_compound.sc_mod_7DA()
in the Python API .- Parameters:
modification_sites (
const unsigned int *
) – A list of modification site, i.e. positions that contain the modified base (1-based, last element in the list indicated by 0)options (
unsigned int
) – A bitvector of options how to handle the input, e.g. RNA.SC_MOD_DEFAULT
- Returns:
Number of sequence positions modified base parameters will be used for
- Return type:
int
See also
RNA.SC_MOD_CHECK_FALLBACK
,RNA.SC_MOD_CHECK_UNMOD
,RNA.SC_MOD_SILENT
,RNA.SC_MOD_DEFAULT
- sc_mod_dihydrouridine(*args, **kwargs)
Add soft constraint callbacks for dihydrouridine.
This is a convenience wrapper to add support for dihydrouridine using the soft constraint callback mechanism. Modification sites are provided as a list of sequence positions (1-based). Energy parameter corrections are derived from Rosetta/RECESS predictions.
SWIG Wrapper Notes
This function is attached as overloaded method sc_mod_dihydrouridine() to objects of type fold_compound with default options = RNA.SC_MOD_DEFAULT. See, e.g.
RNA.fold_compound.sc_mod_dihydrouridine()
in the Python API .- Parameters:
modification_sites (
const unsigned int *
) – A list of modification site, i.e. positions that contain the modified base (1-based, last element in the list indicated by 0)options (
unsigned int
) – A bitvector of options how to handle the input, e.g. RNA.SC_MOD_DEFAULT
- Returns:
Number of sequence positions modified base parameters will be used for
- Return type:
int
See also
RNA.SC_MOD_CHECK_FALLBACK
,RNA.SC_MOD_CHECK_UNMOD
,RNA.SC_MOD_SILENT
,RNA.SC_MOD_DEFAULT
- sc_mod_inosine(*args, **kwargs)
Add soft constraint callbacks for Inosine.
This is a convenience wrapper to add support for inosine using the soft constraint callback mechanism. Modification sites are provided as a list of sequence positions (1-based). Energy parameter corrections are derived from Wright et al. [2007] and Wright et al. [2018] .
SWIG Wrapper Notes
This function is attached as overloaded method sc_mod_inosine() to objects of type fold_compound with default options = RNA.SC_MOD_DEFAULT. See, e.g.
RNA.fold_compound.sc_mod_inosine()
in the Python API .- Parameters:
modification_sites (
const unsigned int *
) – A list of modification site, i.e. positions that contain the modified base (1-based, last element in the list indicated by 0)options (
unsigned int
) – A bitvector of options how to handle the input, e.g. RNA.SC_MOD_DEFAULT
- Returns:
Number of sequence positions modified base parameters will be used for
- Return type:
int
See also
RNA.SC_MOD_CHECK_FALLBACK
,RNA.SC_MOD_CHECK_UNMOD
,RNA.SC_MOD_SILENT
,RNA.SC_MOD_DEFAULT
- sc_mod_json(*args, **kwargs)
Prepare soft constraint callbacks for modified base as specified in JSON string.
This function prepares all requirements to acknowledge modified bases as specified in the provided json string. All subsequent predictions will treat each modification site special and adjust energy contributions if necessary.
SWIG Wrapper Notes
This function is attached as overloaded method sc_mod_json() to objects of type fold_compound with default options = RNA.SC_MOD_DEFAULT. See, e.g.
RNA.fold_compound.sc_mod_json()
in the Python API .- Parameters:
json (
string
) – The JSON formatted string with the modified base parametersmodification_sites (
const unsigned int *
) – A list of modification site, i.e. positions that contain the modified base (1-based, last element in the list indicated by 0)options (
unsigned int
) – A bitvector of options how to handle the input, e.g. RNA.SC_MOD_DEFAULT
- Returns:
Number of sequence positions modified base parameters will be used for
- Return type:
int
See also
RNA.fold_compound.sc_mod_jsonfile
,RNA.fold_compound.sc_mod
,RNA.fold_compound.sc_mod_m6A
,RNA.fold_compound.sc_mod_pseudouridine
,RNA.fold_compound.sc_mod_inosine
,RNA.fold_compound.sc_mod_7DA
,RNA.fold_compound.sc_mod_purine
,RNA.fold_compound.sc_mod_dihydrouridine
,RNA.SC_MOD_CHECK_FALLBACK
,RNA.SC_MOD_CHECK_UNMOD
,RNA.SC_MOD_SILENT
,RNA.SC_MOD_DEFAULT
,modified-bases-params
- sc_mod_jsonfile(*args, **kwargs)
Prepare soft constraint callbacks for modified base as specified in JSON string.
Similar to RNA.fold_compound.sc_mod_json(), this function prepares all requirements to acknowledge modified bases as specified in the provided json file. All subsequent predictions will treat each modification site special and adjust energy contributions if necessary.
SWIG Wrapper Notes
This function is attached as overloaded method sc_mod_jsonfile() to objects of type fold_compound with default options = RNA.SC_MOD_DEFAULT. See, e.g.
RNA.fold_compound.sc_mod_jsonfile()
in the Python API .- Parameters:
json – The JSON formatted string with the modified base parameters
modification_sites (
const unsigned int *
) – A list of modification site, i.e. positions that contain the modified base (1-based, last element in the list indicated by 0)
- Returns:
Number of sequence positions modified base parameters will be used for
- Return type:
int
See also
RNA.fold_compound.sc_mod_json
,RNA.fold_compound.sc_mod
,RNA.fold_compound.sc_mod_m6A
,RNA.fold_compound.sc_mod_pseudouridine
,RNA.fold_compound.sc_mod_inosine
,RNA.fold_compound.sc_mod_7DA
,RNA.fold_compound.sc_mod_purine
,RNA.fold_compound.sc_mod_dihydrouridine
,RNA.SC_MOD_CHECK_FALLBACK
,RNA.SC_MOD_CHECK_UNMOD
,RNA.SC_MOD_SILENT
,RNA.SC_MOD_DEFAULT
,modified-bases-params
- sc_mod_m6A(*args, **kwargs)
Add soft constraint callbacks for N6-methyl-adenosine (m6A)
This is a convenience wrapper to add support for m6A using the soft constraint callback mechanism. Modification sites are provided as a list of sequence positions (1-based). Energy parameter corrections are derived from Kierzek et al. [2022] .
SWIG Wrapper Notes
This function is attached as overloaded method sc_mod_m6A() to objects of type fold_compound with default options = RNA.SC_MOD_DEFAULT. See, e.g.
RNA.fold_compound.sc_mod_m6A()
in the Python API .- Parameters:
modification_sites (
const unsigned int *
) – A list of modification site, i.e. positions that contain the modified base (1-based, last element in the list indicated by 0)options (
unsigned int
) – A bitvector of options how to handle the input, e.g. RNA.SC_MOD_DEFAULT
- Returns:
Number of sequence positions modified base parameters will be used for
- Return type:
int
See also
RNA.SC_MOD_CHECK_FALLBACK
,RNA.SC_MOD_CHECK_UNMOD
,RNA.SC_MOD_SILENT
,RNA.SC_MOD_DEFAULT
- sc_mod_pseudouridine(*args, **kwargs)
Add soft constraint callbacks for Pseudouridine.
This is a convenience wrapper to add support for pseudouridine using the soft constraint callback mechanism. Modification sites are provided as a list of sequence positions (1-based). Energy parameter corrections are derived from Hudson et al. [2013] .
SWIG Wrapper Notes
This function is attached as overloaded method sc_mod_pseudouridine() to objects of type fold_compound with default options = RNA.SC_MOD_DEFAULT. See, e.g.
RNA.fold_compound.sc_mod_pseudouridine()
in the Python API .- Parameters:
modification_sites (
const unsigned int *
) – A list of modification site, i.e. positions that contain the modified base (1-based, last element in the list indicated by 0)options (
unsigned int
) – A bitvector of options how to handle the input, e.g. RNA.SC_MOD_DEFAULT
- Returns:
Number of sequence positions modified base parameters will be used for
- Return type:
int
See also
RNA.SC_MOD_CHECK_FALLBACK
,RNA.SC_MOD_CHECK_UNMOD
,RNA.SC_MOD_SILENT
,RNA.SC_MOD_DEFAULT
- sc_mod_purine(*args, **kwargs)
Add soft constraint callbacks for Purine (a.k.a. nebularine)
This is a convenience wrapper to add support for Purine using the soft constraint callback mechanism. Modification sites are provided as a list of sequence positions (1-based). Energy parameter corrections are derived from Jolley and Znosko [2017] .
SWIG Wrapper Notes
This function is attached as overloaded method sc_mod_purine() to objects of type fold_compound with default options = RNA.SC_MOD_DEFAULT. See, e.g.
RNA.fold_compound.sc_mod_purine()
in the Python API .- Parameters:
modification_sites (
const unsigned int *
) – A list of modification site, i.e. positions that contain the modified base (1-based, last element in the list indicated by 0)options (
unsigned int
) – A bitvector of options how to handle the input, e.g. RNA.SC_MOD_DEFAULT
- Returns:
Number of sequence positions modified base parameters will be used for
- Return type:
int
See also
RNA.SC_MOD_CHECK_FALLBACK
,RNA.SC_MOD_CHECK_UNMOD
,RNA.SC_MOD_SILENT
,RNA.SC_MOD_DEFAULT
- sc_multi_cb_add(fold_compound self, PyObject * f, PyObject * f_exp=Py_None, PyObject * data=Py_None, PyObject * data_prepare=Py_None, PyObject * data_free=Py_None, unsigned int decomp_type=0) unsigned int
- sc_probing(fold_compound self, probing_data data) int
Apply probing data (e.g. SHAPE) to guide the structure prediction.
SWIG Wrapper Notes
This function is attached as method sc_probing() to objects of type fold_compound. See, e.g.
RNA.fold_compound.sc_probing()
in the Python API .- Parameters:
data (
RNA.probing_data()
) – The prepared probing data and probing data integration strategy- Returns:
The number of probing data sets applied, 0 upon any error
- Return type:
int
- sc_remove()
Remove soft constraints from RNA.fold_compound().
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 Python API .Note
Accepts RNA.fold_compound() of type RNA.FC_TYPE_SINGLE and RNA.FC_TYPE_COMPARATIVE
- sc_set_bp(fold_compound self, DoubleDoubleVector constraints, unsigned int options=) int
Set soft constraints for paired nucleotides.
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 Python API .- Parameters:
constraints (
const FLT_OR_DBL **
) – A two-dimensional array of pseudo free energies in \(kcal / mol\)options (
unsigned int
) – The options flag indicating how/where to store the soft constraints
- Returns:
Non-zero on successful application of the constraint, 0 otherwise.
- Return type:
int
Note
This function replaces any pre-exisitng soft constraints with the ones supplied in constraints.
- sc_set_stack(fold_compound self, DoubleVector constraints, unsigned int options=) int
- sc_set_stack(fold_compound self, DoubleDoubleVector constraints, unsigned int options=) int
- sc_set_up(fold_compound self, DoubleVector constraints, unsigned int options=) int
Set soft constraints for unpaired nucleotides.
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 Python API .- Parameters:
constraints (
const FLT_OR_DBL *
) – A vector of pseudo free energies in \(kcal / mol\)options (
unsigned int
) – The options flag indicating how/where to store the soft constraints
- Returns:
Non-zero on successful application of the constraint, 0 otherwise.
- Return type:
int
Note
This function replaces any pre-exisitng soft constraints with the ones supplied in constraints.
- property sequence
- sequence_add(*args, **kwargs)
- property sequence_encoding
- property sequence_encoding2
- sequence_prepare()
- sequence_remove(i)
- sequence_remove_all()
- stack_prob(cutoff=1e-05)
Compute stacking probabilities.
For each possible base pair \((i,j)\), compute the probability of a stack \((i,j)\), \((i+1, j-1)\).
SWIG Wrapper Notes
This function is attached as overloaded method stack_prob() to objects of type fold_compound. The optional argument cutoff defaults to 1e-5. See, e.g.
RNA.fold_compound.stack_prob()
in the Python API.- Parameters:
cutoff (
double
) – A cutoff value that limits the output to stacks with \(p > \textrm{cutoff}\).- Returns:
A list of stacks with enclosing base pair \((i,j)\) and probabiltiy \(p\)
- Return type:
RNA.ep() *
- property strand_end
- property strand_number
- property strand_order
- property strand_start
- property strands
- subopt(fold_compound self, int delta, int sorted=1, FILE * nullfile=None) SuboptVector
Returns list of subopt structures or writes to fp.
This function produces all suboptimal secondary structures within ‘delta’ * 0.01 kcal/mol of the optimum, see Wuchty et al. [1999] . The results are either directly written to a ‘fp’ (if ‘fp’ is not NULL), or (fp==NULL) returned in a RNA.subopt_solution() * list terminated by an entry were the ‘structure’ member is NULL.
SWIG Wrapper Notes
This function is attached as method subopt() to objects of type fold_compound. See, e.g.
RNA.fold_compound.subopt()
in the Python API.- Parameters:
delta (
int
) –sorted (
int
) – Sort results by energy in ascending orderfp (
FILE *
) –
- Return type:
RNA.subopt_solution() *
Note
This function requires all multibranch loop DP matrices for unique multibranch loop backtracing. Therefore, the supplied RNA.fold_compound()`fc` (argument 1) must be initialized with RNA.md().uniq_ML = 1, for instance like this:
- subopt_cb(fold_compound self, int delta, PyObject * PyFunc, PyObject * data=Py_None) PyObject *
Generate suboptimal structures within an energy band arround the MFE.
This is the most generic implementation of the suboptimal structure generator according to Wuchty et al. [1999] . Identical to RNA.fold_compound.subopt(), it computes all secondary structures within an energy band delta arround the MFE. However, this function does not print the resulting structures and their corresponding free energies to a file pointer, or returns them as a list. Instead, it calls a user-provided callback function which it passes the structure in dot-bracket format, the corresponding free energy in kcal/mol, and a user-provided data structure each time a structure was backtracked successfully. This function indicates the final output, i.e. the end of the backtracking procedure by passing NULL instead of an actual dot-bracket string to the callback.
SWIG Wrapper Notes
This function is attached as method subopt_cb() to objects of type fold_compound. See, e.g.
RNA.fold_compound.subopt_cb()
in the Python API.- Parameters:
delta (
int
) – Energy band arround the MFE in 10cal/mol, i.e. deka-caloriescb (
RNA.subopt_result
) – Pointer to a callback function that handles the backtracked structure and its free energy in kcal/moldata (
void *
) – Pointer to some data structure that is passed along to the callback
See also
RNA.subopt_result
,RNA.fold_compound.subopt
,RNA.fold_compound.subopt_zuker
Note
This function requires all multibranch loop DP matrices for unique multibranch loop backtracing. Therefore, the supplied RNA.fold_compound()`fc` (argument 1) must be initialized with RNA.md().uniq_ML = 1, for instance like this:
- subopt_zuker()
Compute Zuker type suboptimal structures.
Compute Suboptimal structures according to Zuker [1989] , i.e. for every possible base pair the minimum energy structure containing the resp. base pair. Returns a list of these structures and their energies.
SWIG Wrapper Notes
This function is attached as method subopt_zuker() to objects of type fold_compound. See, e.g.
RNA.fold_compound.subopt_zuker()
in the Python API.- Returns:
List of zuker suboptimal structures
- Return type:
RNA.subopt_solution() *
See also
RNA.fold_compound.subopt
,zukersubopt
,zukersubopt_par
- property thisown
The membership flag
- property type
- ud_add_motif(fold_compound self, std::string motif, double motif_en, std::string name="", unsigned int options=)
Add an unstructured domain motif, e.g. for ligand binding.
This function adds a ligand binding motif and the associated binding free energy to the RNA.ud() attribute of a RNA.fold_compound(). The motif data will then be used in subsequent secondary structure predictions. Multiple calls to this function with different motifs append all additional data to a list of ligands, which all will be evaluated. Ligand motif data can be removed from the RNA.fold_compound() again using the RNA.fold_compound.ud_remove() function. The loop type parameter allows one to limit the ligand binding to particular loop type, such as the exterior loop, hairpin loops, internal loops, or multibranch loops.
- Parameters:
motif (
string
) – The sequence motif the ligand binds tomotif_en (
double
) – The binding free energy of the ligand in kcal/molmotif_name (
string
) – The name/id of the motif (may be NULL)loop_type (
unsigned int
) – The loop type the ligand binds to
See also
RNA.UNSTRUCTURED_DOMAIN_EXT_LOOP
,RNA.UNSTRUCTURED_DOMAIN_HP_LOOP
,RNA.UNSTRUCTURED_DOMAIN_INT_LOOP
,RNA.UNSTRUCTURED_DOMAIN_MB_LOOP
,RNA.UNSTRUCTURED_DOMAIN_ALL_LOOPS
,RNA.fold_compound.ud_remove
- ud_remove()
Remove ligand binding to unpaired stretches.
This function removes all ligand motifs that were bound to a RNA.fold_compound() using the RNA.fold_compound.ud_add_motif() function.
SWIG Wrapper Notes
This function is attached as method ud_remove() to objects of type fold_compound. See, e.g.
RNA.fold_compound.ud_remove()
in the Python API.
- ud_set_data(fold_compound self, PyObject * data, PyObject * free_cb=Py_None) PyObject *
Attach an auxiliary data structure.
This function binds an arbitrary, auxiliary data structure for user-implemented ligand binding. The optional callback free_cb will be passed the bound data structure whenever the RNA.fold_compound() is removed from memory to avoid memory leaks.
SWIG Wrapper Notes
This function is attached as method ud_set_data() to objects of type fold_compound. See, e.g.
RNA.fold_compound.ud_set_data()
in the Python API.- Parameters:
data (
void *
) – A pointer to the auxiliary data structurefree_cb (
RNA.auxdata_free
) – A pointer to a callback function that free’s memory occupied by data
- ud_set_exp_prod_rule_cb(fold_compound self, PyObject * prod_cb, PyObject * eval_cb) PyObject *
Attach production rule for partition function.
This function is the partition function companion of RNA.fold_compound.ud_set_prod_rule_cb().
Use it to bind callbacks to (i) fill the U production rule dynamic programming matrices and/or prepare the RNA.unstructured_domain().data, and (ii) provide a callback to retrieve partition functions for subsegments \([i,j]\).
SWIG Wrapper Notes
This function is attached as method ud_set_exp_prod_rule_cb() to objects of type fold_compound. See, e.g.
RNA.fold_compound.ud_set_exp_prod_rule_cb()
in the Python API.- Parameters:
pre_cb (
RNA.ud_exp_production
) – A pointer to a callback function for the B production ruleexp_e_cb (
RNA.ud_exp
) – A pointer to a callback function that retrieves the partition function for a segment \([i,j]\) that may be bound by one or more ligands.
- ud_set_prob_cb(fold_compound self, PyObject * setter_cb, PyObject * getter_cb) PyObject *
SWIG Wrapper Notes
This function is attached as method ud_set_prob_cb() to objects of type fold_compound. See, e.g.
RNA.fold_compound.ud_set_prob_cb()
in the Python API.
- ud_set_prod_rule_cb(fold_compound self, PyObject * prod_cb, PyObject * eval_cb) PyObject *
Attach production rule callbacks for free energies computations.
Use this function to bind a user-implemented grammar extension for unstructured domains.
The callback e_cb needs to evaluate the free energy contribution \(f(i,j)\) of the unpaired segment \([i,j]\). It will be executed in each of the regular secondary structure production rules. Whenever the callback is passed the RNA.UNSTRUCTURED_DOMAIN_MOTIF flag via its loop_type parameter the contribution of any ligand that consecutively binds from position \(i\) to \(j\) (the white box) is requested. Otherwise, the callback usually performs a lookup in the precomputed B matrices. Which B matrix is addressed will be indicated by the flags RNA.UNSTRUCTURED_DOMAIN_EXT_LOOP, RNA.UNSTRUCTURED_DOMAIN_HP_LOOPRNA.UNSTRUCTURED_DOMAIN_INT_LOOP, and RNA.UNSTRUCTURED_DOMAIN_MB_LOOP. As their names already imply, they specify exterior loops (F production rule), hairpin loops and internal loops (C production rule), and multibranch loops (M and M1 production rule).
The pre_cb callback will be executed as a pre-processing step right before the regular secondary structure rules. Usually one would use this callback to fill the dynamic programming matrices U and preparations of the auxiliary data structure RNA.unstructured_domain().data
SWIG Wrapper Notes
This function is attached as method ud_set_prod_rule_cb() to objects of type fold_compound. See, e.g.
RNA.fold_compound.ud_set_prod_rule_cb()
in the Python API.- Parameters:
pre_cb (
RNA.ud_production
) – A pointer to a callback function for the B production rulee_cb (
RNA.ud
) – A pointer to a callback function for free energy evaluation
- zsc_compute(i, j, e)
- zsc_compute_raw(i, j, e)
- zsc_filter_free()
- zsc_filter_init(*args, **kwargs)
- zsc_filter_on()
- zsc_filter_threshold()
- zsc_filter_update(*args, **kwargs)
- RNA.free_alifold_arrays()
Free the memory occupied by MFE alifold functions.
Deprecated since version 2.7.0: Usage of this function is discouraged! It only affects memory being free’d that was allocated by an old API function before. Release of memory occupied by the newly introduced RNA.fold_compound() is handled by RNA.fold_compound_free()
See also
RNA.fold_compound_free
- RNA.free_arrays()
Free arrays for mfe folding.
Deprecated since version 2.7.0: See RNA.fold(), RNA.circfold(), or RNA.fold_compound.mfe() and RNA.fold_compound() for the usage of the new API!
- RNA.free_co_arrays()
Free memory occupied by cofold()
Deprecated since version 2.7.0: This function will only free memory allocated by a prior call of cofold() or cofold_par(). See RNA.fold_compound.mfe_dimer() for how to use the new API
See also
RNA.fc_destroy
,RNA.fold_compound.mfe_dimer
Note
folding matrices now reside in the fold compound, and should be free’d there
- RNA.free_co_pf_arrays()
Free the memory occupied by co_pf_fold()
Deprecated since version 2.7.0: This function will be removed for the new API soon! See RNA.fold_compound.pf_dimer(), RNA.fold_compound(), and RNA.fold_compound_free() for an alternative
- RNA.free_path(path)
Free memory allocated by get_path() function.
Deprecated since version 2.7.0: Use RNA.path_free() instead!
- Parameters:
path (
RNA.path() *
) – pointer to memory to be freed
- RNA.free_pf_arrays()
Free arrays for the partition function recursions.
Call this function if you want to free all allocated memory associated with the partition function forward recursion.
Deprecated since version 2.7.0: See RNA.fold_compound() and its related functions for how to free memory occupied by the dynamic programming matrices
Note
Successive calls of pf_fold(), pf_circ_fold() already check if they should free any memory from a previous run. OpenMP notice:
This function should be called before leaving a thread in order to avoid leaking memory
- Postcondition
All memory allocated by pf_fold_par(), pf_fold() or pf_circ_fold() will be free’d
See also
pf_fold_par
,pf_fold
,pf_circ_fold
- RNA.free_profile(T)
free space allocated in Make_bp_profile
Backward compatibility only. You can just use plain free()
- RNA.free_tree(t)
Free the memory allocated for Tree t.
- Parameters:
t (
Tree *
) –
- RNA.get_aligned_line(arg1)
- RNA.get_centroid_struct_pl(length, dist, pl)
Get the centroid structure of the ensemble.
Deprecated since version 2.7.0: This function was renamed to RNA.centroid_from_plist()
- RNA.get_centroid_struct_pr(length, dist, pr)
Get the centroid structure of the ensemble.
Deprecated since version 2.7.0: This function was renamed to RNA.centroid_from_probs()
- RNA.get_concentrations(FcAB, FcAA, FcBB, FEA, FEB, A0, BO)
- RNA.get_gquad_L_matrix(S, start, maxdist, n, g, P)
- RNA.get_gquad_ali_matrix(n, S_cons, S, a2s, n_seq, P)
- RNA.get_gquad_matrix(S, P)
- RNA.get_gquad_pattern_pf(S, i, j, pf, L, l)
- RNA.get_gquad_pf_matrix(S, scale, pf)
- RNA.get_gquad_pf_matrix_comparative(n, S_cons, S, a2s, scale, n_seq, pf)
- RNA.get_multi_input_line(string, options)
- RNA.get_path(std::string seq, std::string s1, std::string s2, int maxkeep) PathVector
- RNA.get_plist_gquad_from_db(structure, pr)
- RNA.get_plist_gquad_from_pr(S, gi, gj, q_gq, probs, scale, pf)
- RNA.get_plist_gquad_from_pr_max(S, gi, gj, q_gq, probs, scale, L, l, pf)
- RNA.get_pr(i, j)
- RNA.get_xy_coordinates(char const * structure) COORDINATE
Compute nucleotide coordinates for secondary structure plot.
This function takes a secondary structure and computes X-Y coordinates for each nucleotide that then can be used to create a structure plot. The parameter plot_type is used to select the underlying layout algorithm. Currently, the following selections are provided:
RNA.PLOT_TYPE_SIMPLE
RNA.PLOT_TYPE_NAVIEW
RNA.PLOT_TYPE_CIRCULAR
RNA.PLOT_TYPE_TURTLE
RNA.PLOT_TYPE_PUZZLER
Passing an unsupported selection leads to the default algorithm RNA.PLOT_TYPE_NAVIEW
Here is a simple example how to use this function, assuming variable structure contains a valid dot-bracket string:
- Parameters:
structure (
string
) – The secondary structure in dot-bracket notationx (
float **
) – The address of a pointer of X coordinates (pointer will point to memory, or NULL on failure)y (
float **
) – The address of a pointer of Y coordinates (pointer will point to memory, or NULL on failure)plot_type (
int
) – The layout algorithm to be used
- Returns:
The length of the structure on success, 0 otherwise
- Return type:
int
See also
RNA.plot_coords_pt
,RNA.plot_coords_simple
,RNA.plot_coords_naview
,RNA.plot_coords_circular
,RNA.plot_coords_turtle
,RNA.plot_coords_puzzler
Note
On success, this function allocates memory for X and Y coordinates and assigns the pointers at addressess x and y to the corresponding memory locations. It’s the users responsibility to cleanup this memory after usage!
- RNA.gettype(ident)
- RNA.gmlRNA(string, structure, ssfile, option)
Produce a secondary structure graph in Graph Meta Language (gml) and write it to a file.
If ‘option’ is an uppercase letter the RNA sequence is used to label nodes, if ‘option’ equals ‘X’ or ‘x’ the resulting file will coordinates for an initial layout of the graph.
- Parameters:
string (
string
) – The RNA sequencestructure (
string
) – The secondary structure in dot-bracket notationssfile (
string
) – The filename of the gml outputoption (
char
) – The option flag
- Returns:
1 on success, 0 otherwise
- Return type:
int
- RNA.gq_parse(std::string structure) unsigned int
- RNA.hamming(s1, s2)
Calculate hamming distance between two sequences.
- Parameters:
s1 (
string
) – The first sequences2 (
string
) – The second sequence
- Returns:
The hamming distance between s1 and s2
- Return type:
int
- RNA.hamming_bound(s1, s2, n)
Calculate hamming distance between two sequences up to a specified length.
This function is similar to RNA.hamming_distance() but instead of comparing both sequences up to their actual length only the first ‘n’ characters are taken into account
- Parameters:
s1 (
string
) – The first sequences2 (
string
) – The second sequencen (
int
) – The length of the subsequences to consider (starting from the 5’ end)
- Returns:
The hamming distance between s1 and s2
- Return type:
int
- RNA.hamming_distance(s1, s2)
- RNA.hamming_distance_bound(s1, s2, n)
- class RNA.hc
Bases:
object
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:
in the exterior loop (RNA.CONSTRAINT_CONTEXT_EXT_LOOP)
enclosing a hairpin (RNA.CONSTRAINT_CONTEXT_HP_LOOP)
enclosing an internal loop (RNA.CONSTRAINT_CONTEXT_INT_LOOP)
enclosed by an exterior loop (RNA.CONSTRAINT_CONTEXT_INT_LOOP_ENC)
enclosing a multi branch loop (RNA.CONSTRAINT_CONTEXT_MB_LOOP)
enclosed by a multi branch loop (RNA.CONSTRAINT_CONTEXT_MB_LOOP_ENC)
The four linear arrays ‘up_xxx’ provide the number of available unpaired nucleotides (including position i) 3’ of each position in the sequence.
See also
RNA.fold_compound.hc_init
,RNA.hc_free
,RNA.CONSTRAINT_CONTEXT_EXT_LOOP
,RNA.CONSTRAINT_CONTEXT_HP_LOOP
,RNA.CONSTRAINT_CONTEXT_INT_LOOP
,RNA.CONSTRAINT_CONTEXT_MB_LOOP
,RNA.CONSTRAINT_CONTEXT_MB_LOOP_ENC
- type
- Type:
vrna_hc_type_e
- n
- Type:
unsigned int
- state
- Type:
unsigned char
- mx
- Type:
unsigned char *
- matrix_local
- Type:
unsigned char **
- up_ext
A linear array that holds the number of allowed unpaired nucleotides in an exterior loop.
- Type:
list-like(unsigned int)
- up_hp
A linear array that holds the number of allowed unpaired nucleotides in a hairpin loop.
- Type:
list-like(unsigned int)
- up_int
A linear array that holds the number of allowed unpaired nucleotides in an internal loop.
- Type:
list-like(unsigned int)
- up_ml
A linear array that holds the number of allowed unpaired nucleotides in a multi branched loop.
- Type:
list-like(unsigned int)
- f
A function pointer that returns whether or not a certain decomposition may be evaluated.
- Type:
vrna_hc_eval_f
- data
A pointer to some structure where the user may store necessary data to evaluate its generic hard constraint function.
- Type:
void *
- free_data
A pointer to a function to free memory occupied by auxiliary data.
The function this pointer is pointing to will be called upon destruction of the RNA.hc(), and provided with the RNA.hc().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.
- Type:
vrna_auxdata_free_f
- depot
- Type:
vrna_hc_depot_t *
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:
in the exterior loop (RNA.CONSTRAINT_CONTEXT_EXT_LOOP)
enclosing a hairpin (RNA.CONSTRAINT_CONTEXT_HP_LOOP)
enclosing an internal loop (RNA.CONSTRAINT_CONTEXT_INT_LOOP)
enclosed by an exterior loop (RNA.CONSTRAINT_CONTEXT_INT_LOOP_ENC)
enclosing a multi branch loop (RNA.CONSTRAINT_CONTEXT_MB_LOOP)
enclosed by a multi branch loop (RNA.CONSTRAINT_CONTEXT_MB_LOOP_ENC)
The four linear arrays ‘up_xxx’ provide the number of available unpaired nucleotides (including position i) 3’ of each position in the sequence.
See also
RNA.fold_compound.hc_init
,RNA.hc_free
,RNA.CONSTRAINT_CONTEXT_EXT_LOOP
,RNA.CONSTRAINT_CONTEXT_HP_LOOP
,RNA.CONSTRAINT_CONTEXT_INT_LOOP
,RNA.CONSTRAINT_CONTEXT_MB_LOOP
,RNA.CONSTRAINT_CONTEXT_MB_LOOP_ENC
- type
- Type:
vrna_hc_type_e
- n
- Type:
unsigned int
- state
- Type:
unsigned char
- mx
- Type:
unsigned char *
- matrix_local
- Type:
unsigned char **
- up_ext
A linear array that holds the number of allowed unpaired nucleotides in an exterior loop.
- Type:
list-like(unsigned int)
- up_hp
A linear array that holds the number of allowed unpaired nucleotides in a hairpin loop.
- Type:
list-like(unsigned int)
- up_int
A linear array that holds the number of allowed unpaired nucleotides in an internal loop.
- Type:
list-like(unsigned int)
- up_ml
A linear array that holds the number of allowed unpaired nucleotides in a multi branched loop.
- Type:
list-like(unsigned int)
- f
A function pointer that returns whether or not a certain decomposition may be evaluated.
- Type:
vrna_hc_eval_f
- data
A pointer to some structure where the user may store necessary data to evaluate its generic hard constraint function.
- Type:
void *
- free_data
A pointer to a function to free memory occupied by auxiliary data.
The function this pointer is pointing to will be called upon destruction of the RNA.hc(), and provided with the RNA.hc().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.
- Type:
vrna_auxdata_free_f
- depot
- Type:
vrna_hc_depot_t *
- property mx
- property n
- property thisown
The membership flag
- property type
- property up_ext
- property up_hp
- property up_int
- property up_ml
- RNA.heat_capacity(sequence, T_min=0.0, T_max=100.0, T_increment=1.0, mpoints=2)
Compute the specific heat for an RNA (simplified variant)
Similar to RNA.fold_compound.heat_capacity(), this function computes an RNAs specific heat in a given temperature range from the partition function by numeric differentiation. This simplified version, however, only requires the RNA sequence as input instead of a RNA.fold_compound() data structure. The result is returned as a list of pairs of temperature in C and specific heat in Kcal/(Mol*K).
Users can specify the temperature range for the computation from T_min to T_max, as well as the increment step size T_increment. The latter also determines how many times the partition function is computed. Finally, the parameter mpoints determines how smooth the curve should be. The algorithm itself fits a parabola to \(2 \cdot mpoints + 1\) data points to calculate 2nd derivatives. Increasing this parameter produces a smoother curve.
SWIG Wrapper Notes
This function is available as overloaded function heat_capacity(). If the optional function arguments T_min, T_max, T_increment, and mpoints are omitted, they default to 0.0, 100.0, 1.0 and 2, respectively. See, e.g.
RNA.head_capacity()
in the Python API.- Parameters:
sequence (
string
) – The RNA sequence input (must be uppercase)T_min (
float
) – Lowest temperature in CT_max (
float
) – Highest temperature in CT_increment (
float
) – Stepsize for temperature incrementation in C (a reasonable choice might be 1C)mpoints (
unsigned int
) – The number of interpolation points to calculate 2nd derivative (a reasonable choice might be 2, min: 1, max: 100)
- Returns:
A list of pairs of temperatures and corresponding heat capacity or NULL upon any failure. The last entry of the list is indicated by a temperature field set to a value smaller than T_min
- Return type:
RNA.heat_capacity() *
- class RNA.heat_capacity_result
Bases:
object
- property heat_capacity
- property temperature
- property thisown
The membership flag
- class RNA.hx(start, end, length, up5=0, up3=0)
Bases:
object
- property end
- property length
- property start
- property thisown
The membership flag
- property up3
- property up5
- RNA.hx_from_ptable(IntVector pt) HelixVector
- RNA.hx_from_ptable(varArrayShort pt) HelixVector
Convert a pair table representation of a secondary structure into a helix list.
- Parameters:
pt (
list-like(int)
) – The secondary structure in pair table representation- Returns:
The secondary structure represented as a helix list
- Return type:
RNA.hx() *
- RNA.hx_merge(list, maxdist=0)
- RNA.init_pf_circ_fold(length)
- RNA.init_pf_fold(length)
Allocate space for pf_fold()
Deprecated since version 2.7.0: This function is obsolete and will be removed soon!
- RNA.init_rand(*args)
Initialize the random number generator with a pre-defined seed.
SWIG Wrapper Notes
This function is available as an overloaded function init_rand() where the argument seed is optional. See, e.g.
RNA.init_rand()
in the Python API.- Parameters:
seed (
unsigned int
) – The seed for the random number generator
See also
- RNA.initialize_cofold(length)
allocate arrays for folding
Deprecated since version 2.7.0: {This function is obsolete and will be removed soon!}
- class RNA.intArray(nelements)
Bases:
object
- cast()
- static frompointer(t)
- property thisown
The membership flag
- RNA.intArray_frompointer(t)
- RNA.intP_getitem(ary, index)
- RNA.intP_setitem(ary, index, value)
- RNA.int_urn(_from, to)
Generates a pseudo random integer in a specified range.
- Parameters:
from (
int
) – The first number in rangeto (
int
) – The last number in range
- Returns:
A pseudo random number in range [from, to]
- Return type:
int
See also
- RNA.inverse_fold(char * start, char const * target) char *
Find sequences with predefined structure.
This function searches for a sequence with minimum free energy structure provided in the parameter ‘target’, starting with sequence ‘start’. It returns 0 if the search was successful, otherwise a structure distance in terms of the energy difference between the search result and the actual target ‘target’ is returned. The found sequence is returned in ‘start’. If give_up is set to 1, the function will return as soon as it is clear that the search will be unsuccessful, this speeds up the algorithm if you are only interested in exact solutions.
- Parameters:
start (
string
) – The start sequencetarget (
string
) – The target secondary structure in dot-bracket notation
- Returns:
The distance to the target in case a search was unsuccessful, 0 otherwise
- Return type:
float
- RNA.inverse_pf_fold(char * start, char const * target) char *
Find sequence that maximizes probability of a predefined structure.
This function searches for a sequence with maximum probability to fold into the provided structure ‘target’ using the partition function algorithm. It returns \(-kT \cdot \log(p)\) where \(p\) is the frequency of ‘target’ in the ensemble of possible structures. This is usually much slower than inverse_fold().
- Parameters:
start (
string
) – The start sequencetarget (
string
) – The target secondary structure in dot-bracket notation
- Returns:
The distance to the target in case a search was unsuccessful, 0 otherwise
- Return type:
float
- RNA.last_parameter_file()
Get the file name of the parameter file that was most recently loaded.
- Returns:
The file name of the last parameter file, or NULL if parameters are still at defaults
- Return type:
string
- RNA.log_cb_add(PyObject * callback, PyObject * data=Py_None, PyObject * data_release=Py_None, vrna_log_levels_e level=VRNA_LOG_LEVEL_WARNING) unsigned int
- RNA.log_cb_add_pycallback(PyFunc, data, PyFuncOrNone, level)
- RNA.log_cb_num()
Get the current number of log message callbacks.
- Returns:
The current number of log message callbacks stored in the logging system
- Return type:
size()
- RNA.log_fp()
Get the output file pointer for the default logging system.
- Returns:
The file pointer where the default logging system will print log messages to
- Return type:
FILE *
- RNA.log_fp_set(fp)
Set the output file pointer for the default logging system.
- Parameters:
fp (
FILE *
) – The file pointer where the default logging system should print log messages to
- RNA.log_level()
Get the current default log level.
- Returns:
The current default log level
- Return type:
RNA.log_levels
See also
RNA.log_level_set
,RNA.log_levels
- RNA.log_level_set(level)
Set the default log level.
Set the log level for the default log output system. Any user-defined log callback mechanism will not be affected…
- Parameters:
level (
RNA.log_levels
) – The new log level for the default logging system- Returns:
The (updated) log level of the default logging system
- Return type:
int
See also
RNA.log_level
,RNA.log_levels
,RNA.log_cb_add
,RNA.log_reset
- RNA.log_options()
Get the current log options of the default logging system.
- Returns:
The current options for the default logging system
- Return type:
unsigned int
See also
RNA.log_options_set
,RNA.LOG_OPTION_QUIET
,RNA.LOG_OPTION_TRACE_TIMERNA.LOG_OPTION_TRACE_CALL
,RNA.LOG_OPTION_DEFAULT
- RNA.log_options_set(options)
Set the log options for the default logging system.
- Parameters:
options (
unsigned int
) – The new options for the default logging system
See also
RNA.log_options
,RNA.LOG_OPTION_QUIET
,RNA.LOG_OPTION_TRACE_TIMERNA.LOG_OPTION_TRACE_CALL
,RNA.LOG_OPTION_DEFAULT
- RNA.log_reset()
Reset the logging system.
This resets the logging system and restores default settings
- RNA.loop_energy(ptable, s, s1, i)
Calculate energy of a loop.
Deprecated since version 2.7.0: Use RNA.fold_compound.eval_loop_pt() instead!
- Parameters:
ptable (
list-like(int)
) – the pair table of the secondary structures (
list-like(int)
) – encoded RNA sequences1 (
list-like(int)
) – encoded RNA sequencei (
int
) – position of covering base pair
- Returns:
free energy of the loop in 10cal/mol
- Return type:
int
See also
- RNA.loopidx_from_ptable(IntVector pt) IntVector
- RNA.loopidx_from_ptable(varArrayShort pt) varArrayInt
Get a loop index representation of a structure.
- RNA.make_loop_index(structure)
- RNA.make_tree(struc)
Constructs a Tree ( essentially the postorder list ) of the structure ‘struc’, for use in tree_edit_distance().
- Parameters:
struc (
string
) – may be any rooted structure representation.- Return type:
Tree *
- RNA.maximum_matching(sequence)
SWIG Wrapper Notes
This function is available as global function maximum_matching(). See e.g.
RNA.maximum_matching()
in the Python API.
- class RNA.md(md self, double temperature=vrna_md_defaults_temperature_get(), double betaScale=vrna_md_defaults_betaScale_get(), int pf_smooth=vrna_md_defaults_pf_smooth_get(), int dangles=vrna_md_defaults_dangles_get(), int special_hp=vrna_md_defaults_special_hp_get(), int noLP=vrna_md_defaults_noLP_get(), int noGU=vrna_md_defaults_noGU_get(), int noGUclosure=vrna_md_defaults_noGUclosure_get(), int logML=vrna_md_defaults_logML_get(), int circ=vrna_md_defaults_circ_get(), int circ_penalty=vrna_md_defaults_circ_penalty_get(), int gquad=vrna_md_defaults_gquad_get(), int uniq_ML=vrna_md_defaults_uniq_ML_get(), int energy_set=vrna_md_defaults_energy_set_get(), int backtrack=vrna_md_defaults_backtrack_get(), char backtrack_type=vrna_md_defaults_backtrack_type_get(), int compute_bpp=vrna_md_defaults_compute_bpp_get(), int max_bp_span=vrna_md_defaults_max_bp_span_get(), int min_loop_size=vrna_md_defaults_min_loop_size_get(), int window_size=vrna_md_defaults_window_size_get(), int oldAliEn=vrna_md_defaults_oldAliEn_get(), int ribo=vrna_md_defaults_ribo_get(), double cv_fact=vrna_md_defaults_cv_fact_get(), double nc_fact=vrna_md_defaults_nc_fact_get(), double sfact=vrna_md_defaults_sfact_get(), double salt=vrna_md_defaults_salt_get(), int saltMLLower=vrna_md_defaults_saltMLLower_get(), int saltMLUpper=vrna_md_defaults_saltMLUpper_get(), int saltDPXInit=vrna_md_defaults_saltDPXInit_get(), float saltDPXInitFact=vrna_md_defaults_saltDPXInitFact_get(), float helical_rise=vrna_md_defaults_helical_rise_get(), float backbone_length=vrna_md_defaults_backbone_length_get())
Bases:
object
The data structure that contains the complete model details used throughout the calculations.
For convenience reasons, we provide the type name RNA.md() to address this data structure without the use of the struct keyword
See also
RNA.md.reset
,set_model_details
,RNA.md_update
,RNA.md
This data structure is wrapped as an object md with multiple related functions attached as methods. A new set of default parameters can be obtained by calling the constructure of md: * md()– Initialize with default settings The resulting object has a list of attached methods which directly correspond to functions that mainly operate on the corresponding C data structure: * reset() - RNA.md.reset() * set_from_globals() - set_model_details() * option_string() - RNA.md.option_string()
- temperature
The temperature used to scale the thermodynamic parameters.
- Type:
double
- betaScale
A scaling factor for the thermodynamic temperature of the Boltzmann factors.
- Type:
double
- pf_smooth
A flat specifying whether energies in Boltzmann factors need to be smoothed.
- Type:
int
- dangles
Specifies the dangle model used in any energy evaluation (0,1,2 or 3)
If set to 0 no stabilizing energies are assigned to bases adjacent to helices in free ends and multiloops (so called dangling ends). Normally (dangles = 1) dangling end energies are assigned only to unpaired bases and a base cannot participate simultaneously in two dangling ends. In the partition function algorithm RNA.fold_compound.pf() these checks are neglected. To provide comparability between free energy minimization and partition function algorithms, the default setting is 2. This treatment of dangling ends gives more favorable energies to helices directly adjacent to one another, which can be beneficial since such helices often do engage in stabilizing interactions through co-axial stacking. If set to 3 co-axial stacking is explicitly included for adjacent helices in multiloops. The option affects only mfe folding and energy evaluation (RNA.mfe() and RNA.eval_structure()), as well as suboptimal folding (RNA.subopt()) via re-evaluation of energies. Co-axial stacking with one intervening mismatch is not considered so far. Note, that some function do not implement all dangle model but only a subset of (0,1,2,3). In particular, partition function algorithms can only handle 0 and 2. Read the documentation of the particular recurrences or energy evaluation function for information about the provided dangle model.
- Type:
int
- special_hp
Include special hairpin contributions for tri, tetra and hexaloops.
- Type:
int
- noLP
Only consider canonical structures, i.e. no ‘lonely’ base pairs.
- Type:
int
- noGU
Do not allow GU pairs.
- Type:
int
- noGUclosure
Do not allow loops to be closed by GU pair.
- Type:
int
- logML
Use logarithmic scaling for multiloops.
- Type:
int
- circ
Assume RNA to be circular instead of linear.
- Type:
int
- circ_penalty
Add an entropic penalty to the unpaired circRNA chain.
- Type:
int
- gquad
Include G-quadruplexes in structure prediction.
- Type:
int
- uniq_ML
Flag to ensure unique multi-branch loop decomposition during folding.
- Type:
int
- energy_set
Specifies the energy set that defines set of compatible base pairs.
- Type:
int
- backtrack
Specifies whether or not secondary structures should be backtraced.
- Type:
int
- backtrack_type
Specifies in which matrix to backtrack.
- Type:
char
- compute_bpp
Specifies whether or not backward recursions for base pair probability (bpp) computation will be performed.
- Type:
int
- nonstandards
contains allowed non standard bases
- Type:
char
- max_bp_span
maximum allowed base pair span
- Type:
int
- min_loop_size
Minimum size of hairpin loops.
The default value for this field is TURN, however, it may be 0 in cofolding context.
- Type:
int
- window_size
Size of the sliding window for locally optimal structure prediction.
- Type:
int
- oldAliEn
Use old alifold energy model.
- Type:
int
- ribo
Use ribosum scoring table in alifold energy model.
- Type:
int
- cv_fact
Co-variance scaling factor for consensus structure prediction.
- Type:
double
- nc_fact
Scaling factor to weight co-variance contributions of non-canonical pairs.
- Type:
double
- sfact
Scaling factor for partition function scaling.
- Type:
double
- rtype
Reverse base pair type array.
- Type:
int
- alias
alias of an integer nucleotide representation
- Type:
short
- pair
Integer representation of a base pair.
- Type:
int
- pair_dist
Base pair dissimilarity, a.k.a. distance matrix.
- Type:
float
- salt
Salt (monovalent) concentration (M) in buffer.
- Type:
double
- saltMLLower
Lower bound of multiloop size to use in loop salt correction linear fitting.
- Type:
int
- saltMLUpper
Upper bound of multiloop size to use in loop salt correction linear fitting.
- Type:
int
- saltDPXInit
User-provided salt correction for duplex initialization (in dcal/mol). If set to 99999 the default salt correction is used. If set to 0 there is no salt correction for duplex initialization.
- Type:
int
- saltDPXInitFact
- Type:
float
helical_rise : float
backbone_length : float
circ_alpha0 : double
- Parameters:
temperature (
double
) – The temperature in degree C used to scale the thermodynamic parametersbetaScale (
double
) – A scaling factor for the thermodynamic temperature of the Boltzmann factors.pf_smooth (
int
) – A flag specifying whether energies in Boltzmann factors need to be smoothed.dangles (
int
) – Specifies the dangle model used in any energy evaluation (0, 1, 2, or 3)special_hp (
int
) – Include special hairpin contributions for tri, tetra and hexaloops.noLP (
int
) – Only consider canonical structures, i.e. no ‘lonely’ base pairs.noGU (
int
) – Do not allow GU pairs.noGUclosure (
int
) – Do not allow loops to be closed by GU pair.logML (
int
) – Use logarithmic scaling for multiloops.circ (
int
) – Assume RNA to be circular instead of linear.circ_penalty (
int
) – Add entropic penalty for unpaired chain in circular RNAs.gquad (
int
) – Include G-quadruplexes in structure prediction.uniq_ML (
int
) – Flag to ensure unique multi-branch loop decomposition during folding.energy_set (
int
) – Specifies the energy set that defines set of compatible base pairs.backtrack (
int
) – Specifies whether or not secondary structures should be backtraced.backtrack_type (
char
) – Specifies in which matrix to backtrack.compute_bpp (
int
) – Specifies whether or not backward recursions for base pair probability (bpp) computation will be performed.max_bp_span (
int
) – maximum allowed base pair spanmin_loop_size (
int
) – Minimum size of hairpin loops.window_size (
int
) – Size of the sliding window for locally optimal structure prediction.oldAliEn (
int
) – Use old alifold energy model.ribo (
int
) – Use ribosum scoring table in alifold energy model.cv_fact (
double
) – Co-variance scaling factor for consensus structure prediction.nc_fact (
double
) – Scaling factor to weight co-variance contributions of non-canonical pairs.sfact (
double
) – Scaling factor for partition function scaling.salt (
double
) – Salt (monovalent) concentration (M) in buffer.saltMLLower (
int
) – Lower bound of multiloop size to use in loop salt correction linear fitting.saltMLUpper (
int
) – Upper bound of multiloop size to use in loop salt correction linear fitting.saltDPXInit (
int
) – User-provided salt correction for duplex initialization (in dcal/mol).saltDPXInitFact (
float
) –helical_rise (
float
) –backbone_length (
float
) –
Note
Default parameters can be modified by directly setting any of the following global variables (accessible as RNA.cvar.variable where variable is the variable name. Internally, getting/setting default parameters using their global variable representative translates into calls of the corresponding getter and setter functions, which consequently have not been wrapped directly in the scripting language interface(s):
global variable
C getter
C setter
temperature
dangles
betaScale
tetra_loop
this is an alias of variable special_hp
special_hp
noLonelyPairs
this is an alias of variable noLP
noLP
noGU
no_closingGU
this is an alias of variable noGUclosure
noGUclosure
logML
circ
gquad
uniq_ML
energy_set
backtrack
backtrack_type
do_backtrack
this is an alias of variable compute_bpp
compute_bpp
max_bp_span
min_loop_size
window_size
oldAliEn
ribo
cv_fact
nc_fact
sfact
- property alias
- property backbone_length
- property backtrack
- property backtrack_type
- property betaScale
- property circ
- property circ_alpha0
- property circ_penalty
- property compute_bpp
- property cv_fact
- property dangles
- property energy_set
- property gquad
- property helical_rise
- property logML
- property max_bp_span
- property min_loop_size
- property nc_fact
- property noGU
- property noGUclosure
- property noLP
- property nonstandards
- property oldAliEn
- option_string()
Get a corresponding commandline parameter string of the options in a RNA.md().
Note
This function is not threadsafe!
- property pair
- property pf_smooth
- reset()
Apply default model details to a provided RNA.md() data structure.
Use this function to initialize a RNA.md() data structure with its default values
- property ribo
- property rtype
- property salt
- property saltDPXInit
- property saltDPXInitFact
- property saltMLLower
- property saltMLUpper
- set_from_globals()
- property sfact
- property special_hp
- property temperature
- property thisown
The membership flag
- property uniq_ML
- property window_size
- RNA.mean_bp_distance(length)
Get the mean base pair distance of the last partition function computation.
Deprecated since version 2.7.0: Use RNA.fold_compound.mean_bp_distance() or RNA.mean_bp_distance_pr() instead!
- Parameters:
length (
int
) –- Returns:
mean base pair distance in thermodynamic ensemble
- Return type:
double
See also
RNA.fold_compound.mean_bp_distance
,RNA.mean_bp_distance_pr
- RNA.memmove(data, indata)
- class RNA.move(pos_5=0, pos_3=0)
Bases:
object
An atomic representation of the transition / move from one structure to its neighbor.
An atomic transition / move may be one of the following:
a base pair insertion,
a base pair removal, or
a base pair shift where an existing base pair changes one of its pairing partner.
These moves are encoded by two integer values that represent the affected 5’ and 3’ nucleotide positions. Furthermore, we use the following convention on the signedness of these encodings:
both values are positive for insertion moves
both values are negative for base pair removals
both values have different signedness for shift moves, where the positive value indicates the nucleotide that stays constant, and the others absolute value is the new pairing partner
Note
A value of 0 in either field is used as list-end indicator and doesn’t represent any valid move.
- pos_5
The (absolute value of the) 5’ position of a base pair, or any position of a shifted pair.
- Type:
int
- pos_3
The (absolute value of the) 3’ position of a base pair, or any position of a shifted pair.
- Type:
int
- next
The next base pair (if an elementary move changes more than one base pair), or NULL Has to be terminated with move 0,0.
- Type:
vrna_move_t *
An atomic representation of the transition / move from one structure to its neighbor.
An atomic transition / move may be one of the following:
a base pair insertion,
a base pair removal, or
a base pair shift where an existing base pair changes one of its pairing partner.
These moves are encoded by two integer values that represent the affected 5’ and 3’ nucleotide positions. Furthermore, we use the following convention on the signedness of these encodings:
both values are positive for insertion moves
both values are negative for base pair removals
both values have different signedness for shift moves, where the positive value indicates the nucleotide that stays constant, and the others absolute value is the new pairing partner
Note
A value of 0 in either field is used as list-end indicator and doesn’t represent any valid move.
- pos_5
The (absolute value of the) 5’ position of a base pair, or any position of a shifted pair.
- Type:
int
- pos_3
The (absolute value of the) 3’ position of a base pair, or any position of a shifted pair.
- Type:
int
- next
The next base pair (if an elementary move changes more than one base pair), or NULL Has to be terminated with move 0,0.
- Type:
vrna_move_t *
- compare(*args, **kwargs)
Compare two moves.
The function compares two moves m and b and returns whether move m is lexicographically smaller (-1), larger (1) or equal to move b.
If any of the moves m or b is a shift move, this comparison only makes sense in a structure context. Thus, the third argument with the current structure must be provided.
- Parameters:
b (
const RNA.move() *
) – The second move of the comparisonpt (
const short *
) – The pair table of the current structure that is compatible with both moves (maybe NULL if moves are guaranteed to be no shifts)
- Returns:
-1 if m < b, 1 if m > b, 0 otherwise
- Return type:
int
Warning
Currently, shift moves are not supported!
Note
This function returns 0 (equality) upon any error, e.g. missing input
- is_insertion()
Test whether a move is a base pair insertion.
- Returns:
Non-zero if the move is a base pair insertion, 0 otherwise
- Return type:
int
- is_removal()
Test whether a move is a base pair removal.
- Returns:
Non-zero if the move is a base pair removal, 0 otherwise
- Return type:
int
- is_shift()
Test whether a move is a base pair shift.
- Returns:
Non-zero if the move is a base pair shift, 0 otherwise
- Return type:
int
- property pos_3
- property pos_5
- property thisown
The membership flag
- RNA.move_standard(char * seq, char * struc, enum MOVE_TYPE type, int verbosity_level, int shifts, int noLP) char *
- class RNA.mx_mfe
Bases:
object
- property Fc
- property FcH
- property FcI
- property FcM
- property c
- property f3
- property f5
- property fM1
- property fM2
- property fML
- property length
- property strands
- property thisown
The membership flag
- property type
- class RNA.mx_pf
Bases:
object
- property expMLbase
- property length
- property probs
- property q
- property q1k
- property qb
- property qho
- property qio
- property qln
- property qm
- property qm1
- property qm2
- property qmo
- property qo
- property scale
- property thisown
The membership flag
- property type
- RNA.my_PS_rna_plot_snoop_a(std::string sequence, std::string structure, std::string filename, IntVector relative_access, StringVector seqs) int
- RNA.my_aln_consensus_sequence2(alignment, md_p=None)
- RNA.n_multichoose_k(n, k)
- RNA.new_doubleP(nelements)
- RNA.new_floatP(nelements)
- RNA.new_intP(nelements)
- RNA.new_shortP(nelements)
- RNA.new_ushortP(nelements)
- RNA.pack_structure(char const * s) char *
- class RNA.param(model_details=None)
Bases:
object
The datastructure that contains temperature scaled energy parameters.
- id
- Type:
int
- stack
- Type:
int
- hairpin
- Type:
int
- bulge
- Type:
int
- internal_loop
- Type:
int
- mismatchExt
- Type:
int
- mismatchI
- Type:
int
- mismatch1nI
- Type:
int
- mismatch23I
- Type:
int
- mismatchH
- Type:
int
- mismatchM
- Type:
int
- dangle5
- Type:
int
- dangle3
- Type:
int
- int11
- Type:
int
- int21
- Type:
int
- int22
- Type:
int
- ninio
- Type:
int
- lxc
- Type:
double
- MLbase
- Type:
int
- MLintern
- Type:
int
- MLclosing
- Type:
int
- TerminalAU
- Type:
int
- DuplexInit
- Type:
int
- Tetraloop_E
- Type:
int
- Tetraloops
- Type:
char
- Triloop_E
- Type:
int
- Triloops
- Type:
char
- Hexaloop_E
- Type:
int
- Hexaloops
- Type:
char
- TripleC
- Type:
int
- MultipleCA
- Type:
int
- MultipleCB
- Type:
int
- gquad
- Type:
int
- gquadLayerMismatch
- Type:
int
- gquadLayerMismatchMax
- Type:
unsigned int
- temperature
Temperature used for loop contribution scaling.
- Type:
double
- model_details
Model details to be used in the recursions.
- Type:
vrna_md_t
- param_file
The filename the parameters were derived from, or empty string if they represent the default.
- Type:
char
- SaltStack
- Type:
int
- SaltLoop
- Type:
int
- SaltLoopDbl
- Type:
double
- SaltMLbase
- Type:
int
- SaltMLintern
- Type:
int
- SaltMLclosing
- Type:
int
- SaltDPXInit
- Type:
int
The datastructure that contains temperature scaled energy parameters.
- id
- Type:
int
- stack
- Type:
int
- hairpin
- Type:
int
- bulge
- Type:
int
- internal_loop
- Type:
int
- mismatchExt
- Type:
int
- mismatchI
- Type:
int
- mismatch1nI
- Type:
int
- mismatch23I
- Type:
int
- mismatchH
- Type:
int
- mismatchM
- Type:
int
- dangle5
- Type:
int
- dangle3
- Type:
int
- int11
- Type:
int
- int21
- Type:
int
- int22
- Type:
int
- ninio
- Type:
int
- lxc
- Type:
double
- MLbase
- Type:
int
- MLintern
- Type:
int
- MLclosing
- Type:
int
- TerminalAU
- Type:
int
- DuplexInit
- Type:
int
- Tetraloop_E
- Type:
int
- Tetraloops
- Type:
char
- Triloop_E
- Type:
int
- Triloops
- Type:
char
- Hexaloop_E
- Type:
int
- Hexaloops
- Type:
char
- TripleC
- Type:
int
- MultipleCA
- Type:
int
- MultipleCB
- Type:
int
- gquad
- Type:
int
- gquadLayerMismatch
- Type:
int
- gquadLayerMismatchMax
- Type:
unsigned int
- temperature
Temperature used for loop contribution scaling.
- Type:
double
- model_details
Model details to be used in the recursions.
- Type:
vrna_md_t
- param_file
The filename the parameters were derived from, or empty string if they represent the default.
- Type:
char
- SaltStack
- Type:
int
- SaltLoop
- Type:
int
- SaltLoopDbl
- Type:
double
- SaltMLbase
- Type:
int
- SaltMLintern
- Type:
int
- SaltMLclosing
- Type:
int
- SaltDPXInit
- Type:
int
- property DuplexInit
- property Hexaloop_E
- property Hexaloops
- property MLbase
- property MLclosing
- property MLintern
- property MultipleCA
- property MultipleCB
- property SaltDPXInit
- property SaltLoop
- property SaltLoopDbl
- property SaltMLbase
- property SaltMLclosing
- property SaltMLintern
- property SaltStack
- property TerminalAU
- property Tetraloop_E
- property Tetraloops
- property Triloop_E
- property Triloops
- property TripleC
- property bulge
- property dangle3
- property dangle5
- property gquad
- property gquadLayerMismatch
- property gquadLayerMismatchMax
- property hairpin
- property id
- property int11
- property int21
- property int22
- property internal_loop
- property lxc
- property mismatch1nI
- property mismatch23I
- property mismatchExt
- property mismatchH
- property mismatchI
- property mismatchM
- property model_details
- property ninio
- property param_file
- property stack
- property temperature
- property thisown
The membership flag
- RNA.params_load(std::string filename="", unsigned int options=) int
Load energy parameters from a file.
SWIG Wrapper Notes
This function is available as overloaded function params_load`(fname=””, options=RNA.PARAMETER_FORMAT_DEFAULT). Here, the empty filename string indicates to load default RNA parameters, i.e. this is equivalent to calling RNA.params_load_defaults(). See, e.g. :py:func:`RNA.fold_compound.params_load() in the Python API.
- Parameters:
fname (
const char
) – The path to the file containing the energy parametersoptions (
unsigned int
) – File format bit-mask (usually RNA.PARAMETER_FORMAT_DEFAULT)
- Returns:
Non-zero on success, 0 on failure
- Return type:
int
See also
RNA.params_load_from_string
,RNA.params_save
,RNA.params_load_defaults
,RNA.params_load_RNA_Turner2004
,RNA.params_load_RNA_Turner1999
,RNA.params_load_RNA_Andronescu2007
,RNA.params_load_RNA_Langdon2018
,RNA.params_load_RNA_misc_special_hairpins
,RNA.params_load_DNA_Mathews2004
,RNA.params_load_DNA_Mathews1999
- RNA.params_load_DNA_Mathews1999()
Load Mathews 1999 DNA energy parameter set.
SWIG Wrapper Notes
This function is available as function params_load_DNA_Mathews1999(). See, e.g.
RNA.params_load_DNA_Mathews1999()
in the Python API.- Returns:
Non-zero on success, 0 on failure
- Return type:
int
Warning
This function also resets the default geometric parameters as stored in RNA.md() to those of DNA. Only subsequently initialized RNA.md() structures will be affected by this change.
See also
RNA.params_load
,RNA.params_load_from_string
,RNA.params_save
,RNA.params_load_RNA_Turner2004
,RNA.params_load_RNA_Turner1999
,RNA.params_load_RNA_Andronescu2007
,RNA.params_load_RNA_Langdon2018
,RNA.params_load_RNA_misc_special_hairpins
,RNA.params_load_DNA_Mathews2004
,RNA.params_load_defaults
- RNA.params_load_DNA_Mathews2004()
Load Mathews 2004 DNA energy parameter set.
SWIG Wrapper Notes
This function is available as function params_load_DNA_Mathews2004(). See, e.g.
RNA.params_load_DNA_Mathews2004()
in the Python API.- Returns:
Non-zero on success, 0 on failure
- Return type:
int
Warning
This function also resets the default geometric parameters as stored in RNA.md() to those of DNA. Only subsequently initialized RNA.md() structures will be affected by this change.
See also
RNA.params_load
,RNA.params_load_from_string
,RNA.params_save
,RNA.params_load_RNA_Turner2004
,RNA.params_load_RNA_Turner1999
,RNA.params_load_RNA_Andronescu2007
,RNA.params_load_RNA_Langdon2018
,RNA.params_load_RNA_misc_special_hairpins
,RNA.params_load_defaults
,RNA.params_load_DNA_Mathews1999
- RNA.params_load_RNA_Andronescu2007()
Load Andronsecu 2007 RNA energy parameter set.
SWIG Wrapper Notes
This function is available as function params_load_RNA_Andronescu2007(). See, e.g.
RNA.params_load_RNA_Andronescu2007()
in the Python API.- Returns:
Non-zero on success, 0 on failure
- Return type:
int
Warning
This function also resets the default geometric parameters as stored in RNA.md() to those of RNA. Only subsequently initialized RNA.md() structures will be affected by this change.
See also
RNA.params_load
,RNA.params_load_from_string
,RNA.params_save
,RNA.params_load_RNA_Turner2004
,RNA.params_load_RNA_Turner1999
,RNA.params_load_defaults
,RNA.params_load_RNA_Langdon2018
,RNA.params_load_RNA_misc_special_hairpins
,RNA.params_load_DNA_Mathews2004
,RNA.params_load_DNA_Mathews1999
- RNA.params_load_RNA_Langdon2018()
Load Langdon 2018 RNA energy parameter set.
SWIG Wrapper Notes
This function is available as function params_load_RNA_Langdon2018(). See, e.g.
RNA.params_load_RNA_Langdon2018()
in the Python API.- Returns:
Non-zero on success, 0 on failure
- Return type:
int
Warning
This function also resets the default geometric parameters as stored in RNA.md() to those of RNA. Only subsequently initialized RNA.md() structures will be affected by this change.
See also
RNA.params_load
,RNA.params_load_from_string
,RNA.params_save
,RNA.params_load_RNA_Turner2004
,RNA.params_load_RNA_Turner1999
,RNA.params_load_RNA_Andronescu2007
,RNA.params_load_defaults
,RNA.params_load_RNA_misc_special_hairpins
,RNA.params_load_DNA_Mathews2004
,RNA.params_load_DNA_Mathews1999
- RNA.params_load_RNA_Turner1999()
Load Turner 1999 RNA energy parameter set.
SWIG Wrapper Notes
This function is available as function params_load_RNA_Turner1999(). See, e.g.
RNA.params_load_RNA_Turner1999()
in the Python API.- Returns:
Non-zero on success, 0 on failure
- Return type:
int
Warning
This function also resets the default geometric parameters as stored in RNA.md() to those of RNA. Only subsequently initialized RNA.md() structures will be affected by this change.
See also
RNA.params_load
,RNA.params_load_from_string
,RNA.params_save
,RNA.params_load_RNA_Turner2004
,RNA.params_load_defaults
,RNA.params_load_RNA_Andronescu2007
,RNA.params_load_RNA_Langdon2018
,RNA.params_load_RNA_misc_special_hairpins
,RNA.params_load_DNA_Mathews2004
,RNA.params_load_DNA_Mathews1999
- RNA.params_load_RNA_Turner2004()
Load Turner 2004 RNA energy parameter set.
SWIG Wrapper Notes
This function is available as function params_load_RNA_Turner2004(). See, e.g.
RNA.params_load_RNA_Turner2004()
in the Python API.- Returns:
Non-zero on success, 0 on failure
- Return type:
int
Warning
This function also resets the default geometric parameters as stored in RNA.md() to those of RNA. Only subsequently initialized RNA.md() structures will be affected by this change.
See also
RNA.params_load
,RNA.params_load_from_string
,RNA.params_save
,RNA.params_load_defaults
,RNA.params_load_RNA_Turner1999
,RNA.params_load_RNA_Andronescu2007
,RNA.params_load_RNA_Langdon2018
,RNA.params_load_RNA_misc_special_hairpins
,RNA.params_load_DNA_Mathews2004
,RNA.params_load_DNA_Mathews1999
- RNA.params_load_RNA_misc_special_hairpins()
Load Misc Special Hairpin RNA energy parameter set.
SWIG Wrapper Notes
This function is available as function params_load_RNA_misc_special_hairpins(). See, e.g.
RNA.params_load_RNA_misc_special_hairpins()
in the Python API.- Returns:
Non-zero on success, 0 on failure
- Return type:
int
Warning
This function also resets the default geometric parameters as stored in RNA.md() to those of RNA. Only subsequently initialized RNA.md() structures will be affected by this change.
- RNA.params_load_from_string(std::string parameters, std::string name="", unsigned int options=) int
Load energy paramters from string.
The string must follow the default energy parameter file convention! The optional name argument allows one to specify a name for the parameter set which is stored internally.
SWIG Wrapper Notes
This function is available as overloaded function params_load_from_string`(string, name=””, options=RNA.PARAMETER_FORMAT_DEFAULT). See, e.g. :py:func:`RNA.params_load_from_string() in the Python API.
- Parameters:
string (
string
) – A 0-terminated string containing energy parametersname (
string
) – A name for the parameter set in string (Maybe NULL)options (
unsigned int
) – File format bit-mask (usually RNA.PARAMETER_FORMAT_DEFAULT)
- Returns:
Non-zero on success, 0 on failure
- Return type:
int
See also
RNA.params_load
,RNA.params_save
,RNA.params_load_defaults
,RNA.params_load_RNA_Turner2004
,RNA.params_load_RNA_Turner1999
,RNA.params_load_RNA_Andronescu2007
,RNA.params_load_RNA_Langdon2018
,RNA.params_load_RNA_misc_special_hairpins
,RNA.params_load_DNA_Mathews2004
,RNA.params_load_DNA_Mathews1999
- RNA.params_save(std::string filename, unsigned int options=) int
Save energy parameters to a file.
SWIG Wrapper Notes
This function is available as overloaded function params_save`(fname, options=RNA.PARAMETER_FORMAT_DEFAULT). See, e.g. :py:func:`RNA.params_save() in the Python API.
- Parameters:
fname (
const char
) – A filename (path) for the file where the current energy parameters will be written tooptions (
unsigned int
) – File format bit-mask (usually RNA.PARAMETER_FORMAT_DEFAULT)
- Returns:
Non-zero on success, 0 on failure
- Return type:
int
See also
- RNA.parse_gquad(struc, L, l)
Parse a G-Quadruplex from a dot-bracket structure string.
Given a dot-bracket structure (possibly) containing gquads encoded by ‘+’ signs, find first gquad, return end position or 0 if none found Upon return L and l[] contain the number of stacked layers, as well as the lengths of the linker regions. To parse a string with many gquads, call parse_gquad repeatedly e.g. end1 = parse_gquad(struc, &L, l); … ; end2 = parse_gquad(struc+end1, &L, l); end2+=end1; … ; end3 = parse_gquad(struc+end2, &L, l); end3+=end2; … ;
- RNA.parse_structure(structure)
Collects a statistic of structure elements of the full structure in bracket notation.
The function writes to the following global variables: loop_size, loop_degree, helix_size, loops, pairs, unpaired
- Parameters:
structure (
string
) –
- class RNA.path(*args, **kwargs)
Bases:
object
- property en
- property move
- property s
- property thisown
The membership flag
- property type
- RNA.path_options_findpath(*args, **kwargs)
Create options data structure for findpath direct (re-)folding path heuristic.
This function returns an options data structure that switches the RNA.path_direct() and RNA.fold_compound.path_direct() API functions to use the findpath [Flamm et al., 2001] heuristic. The parameter width specifies the width of the breadth-first search while the second parameter type allows one to set the type of the returned (re-)folding path.
Currently, the following return types are available:
A list of dot-bracket structures and corresponding free energy (flag: RNA.PATH_TYPE_DOT_BRACKET)
A list of transition moves and corresponding free energy changes (flag: RNA.PATH_TYPE_MOVES)
SWIG Wrapper Notes
This function is available as overloaded function path_options_findpath(). The optional parameter width defaults to 10 if omitted, while the optional parameter type defaults to RNA.PATH_TYPE_DOT_BRACKET. See, e.g.
RNA.path_options_findpath()
in the Python API.- Parameters:
width (
int
) – Width of the breath-first search strategytype (
unsigned int
) – Setting that specifies how the return (re-)folding path should be encoded
- Returns:
An options data structure with settings for the findpath direct path heuristic
- Return type:
See also
RNA.PATH_TYPE_DOT_BRACKET
,RNA.PATH_TYPE_MOVES
,RNA.path_options_free
,RNA.path_direct
,RNA.fold_compound.path_direct
- RNA.pbacktrack(sequence)
Sample a secondary structure from the Boltzmann ensemble according its probability.
- Precondition
st_back has to be set to 1 before calling pf_fold() or pf_fold_par() pf_fold_par() or pf_fold() have to be called first to fill the partition function matrices
- Parameters:
sequence (
string
) – The RNA sequence- Returns:
A sampled secondary structure in dot-bracket notation
- Return type:
string
- RNA.pbacktrack5(sequence, length)
Sample a sub-structure from the Boltzmann ensemble according its probability.
- RNA.pbacktrack_circ(sequence)
Sample a secondary structure of a circular RNA from the Boltzmann ensemble according its probability.
This function does the same as pbacktrack() but assumes the RNA molecule to be circular
- Precondition
st_back has to be set to 1 before calling pf_fold() or pf_fold_par() pf_fold_par() or pf_circ_fold() have to be called first to fill the partition function matrices
Deprecated since version 2.7.0: Use RNA.fold_compound.pbacktrack() instead.
- Parameters:
sequence (
string
) – The RNA sequence- Returns:
A sampled secondary structure in dot-bracket notation
- Return type:
string
- RNA.pf_add(dG1, dG2, kT=0)
- RNA.pf_circ_fold(*args)
- RNA.pf_float_precision()
Find out whether partition function computations are using single precision floating points.
- Returns:
1 if single precision is used, 0 otherwise
- Return type:
int
See also
double
- RNA.pf_fold(*args)
- RNA.pfl_fold(std::string sequence, int w, int L, double cutoff) ElemProbVector
Compute base pair probabilities using a sliding-window approach.
This is a simplified wrapper to RNA.fold_compound.probs_window() that given a nucleid acid sequence, a window size, a maximum base pair span, and a cutoff value computes the pair probabilities for any base pair in any window. The pair probabilities are returned as a list and the user has to take care to free() the memory occupied by the list.
- Parameters:
sequence (
string
) – The nucleic acid input sequencewindow_size (
int
) – The size of the sliding windowmax_bp_span (
int
) – The maximum distance along the backbone between two nucleotides that form a base pairscutoff (
float
) – A cutoff value that omits all pairs with lower probability
- Returns:
A list of base pair probabilities, terminated by an entry with RNA.ep().i and RNA.ep().j set to 0
- Return type:
RNA.ep() *
Note
This function uses default model settings! For custom model settings, we refer to the function RNA.fold_compound.probs_window().
In case of any computation errors, this function returns NULL
- RNA.pfl_fold_cb(std::string sequence, int window_size, int max_bp_span, PyObject * PyFunc, PyObject * data=Py_None) int
- RNA.pfl_fold_up(std::string sequence, int ulength, int window_size, int max_bp_span) DoubleDoubleVector
Compute probability of contiguous unpaired segments.
This is a simplified wrapper to RNA.fold_compound.probs_window() that given a nucleic acid sequence, a maximum length of unpaired segments (ulength), a window size, and a maximum base pair span computes the equilibrium probability of any segment not exceeding ulength. The probabilities to be unpaired are returned as a 1-based, 2-dimensional matrix with dimensions \(N \times M\), where \(N\) is the length of the sequence and \(M\) is the maximum segment length. As an example, the probability of a segment of size 5 starting at position 100 is stored in the matrix entry \(X[100][5]\).
It is the users responsibility to free the memory occupied by this matrix.
- Parameters:
sequence (
string
) – The nucleic acid input sequenceulength (
int
) – The maximal length of an unpaired segmentwindow_size (
int
) – The size of the sliding windowmax_bp_span (
int
) – The maximum distance along the backbone between two nucleotides that form a base pairs
- Returns:
The probabilities to be unpaired for any segment not exceeding ulength
- Return type:
list-like(list-like(double))
Note
This function uses default model settings! For custom model settings, we refer to the function RNA.fold_compound.probs_window().
- RNA.pfl_fold_up_cb(std::string sequence, int ulength, int window_size, int max_bp_span, PyObject * PyFunc, PyObject * data=Py_None) int
- RNA.plist(std::string structure, float pr) ElemProbVector
Create a RNA.ep() from a dot-bracket string.
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 (
string
) – The secondary structure in dot-bracket notationpr (
float
) – The probability for each base pair used in the plist
- Returns:
The plist array
- Return type:
RNA.ep() *
- class RNA.plot_data(*args, **kwargs)
Bases:
object
- property md
- property options
- property post
- property pre
- property thisown
The membership flag
- RNA.plot_dp_EPS(*args, **kwargs)
Produce an encapsulate PostScript (EPS) dot-plot from one or two lists of base pair probabilities.
This function reads two RNA.ep() lists upper and lower (e.g. base pair probabilities and a secondary structure) and produces an EPS “dot plot” with filename ‘filename’ where data from upper is placed in the upper-triangular and data from lower is placed in the lower triangular part of the matrix.
For default output, provide the flag RNA.PLOT_PROBABILITIES_DEFAULT as options parameter.
SWIG Wrapper Notes
This function is available as overloaded function plot_dp_EPS() where the last three parameters may be omitted. The default values for these parameters are lower = NULL, auxdata = NULL, options = RNA.PLOT_PROBABILITIES_DEFAULT. See, e.g.
RNA.plot_dp_EPS()
in the Python API.- Parameters:
filename (
string
) – A filename for the EPS outputsequence (
string
) – The RNA sequenceupper (
RNA.ep() *
) – The base pair probabilities for the upper triangular partlower (
RNA.ep() *
) – The base pair probabilities for the lower triangular partoptions (
unsigned int
) – Options indicating which of the input data should be included in the dot-plot
- Returns:
1 if EPS file was successfully written, 0 otherwise
- Return type:
int
See also
RNA.plist
,RNA.fold_compound.plist_from_probs
,RNA.PLOT_PROBABILITIES_DEFAULT
- RNA.plot_layout_circular(structure)
Create a layout (coordinates, etc.) for a circular secondary structure plot.
This function basically is a wrapper to RNA.plot_layout() that passes the `plot_type`RNA.PLOT_TYPE_CIRCULAR.
- Parameters:
structure (
string
) – The secondary structure in dot-bracket notation- Returns:
The layout data structure for the provided secondary structure
- Return type:
RNA.plot_layout() *
See also
RNA.plot_layout_free
,RNA.plot_layout
,RNA.plot_layout_naview
,RNA.plot_layout_simple
,RNA.plot_layout_turtle
,RNA.plot_layout_puzzler
,RNA.plot_coords_circular
,RNA.file_PS_rnaplot_layout
Note
If only X-Y coordinates of the corresponding structure layout are required, consider using RNA.plot_coords_circular() instead!
- RNA.plot_layout_puzzler(structure, options)
Create a layout (coordinates, etc.) for a secondary structure plot using the RNApuzzler Algorithm [Wiegreffe et al., 2019] .
This function basically is a wrapper to RNA.plot_layout() that passes the `plot_type`RNA.PLOT_TYPE_PUZZLER.
- Parameters:
structure (
string
) – The secondary structure in dot-bracket notation- Returns:
The layout data structure for the provided secondary structure
- Return type:
RNA.plot_layout() *
See also
RNA.plot_layout_free
,RNA.plot_layout
,RNA.plot_layout_simple
,RNA.plot_layout_circular
,RNA.plot_layout_naview
,RNA.plot_layout_turtle
,RNA.plot_coords_puzzler
,RNA.file_PS_rnaplot_layout
Note
If only X-Y coordinates of the corresponding structure layout are required, consider using RNA.plot_coords_puzzler() instead!
- RNA.plot_layout_simple(structure)
Create a layout (coordinates, etc.) for a simple secondary structure plot.
This function basically is a wrapper to RNA.plot_layout() that passes the `plot_type`RNA.PLOT_TYPE_SIMPLE.
- Parameters:
structure (
string
) – The secondary structure in dot-bracket notation- Returns:
The layout data structure for the provided secondary structure
- Return type:
RNA.plot_layout() *
See also
RNA.plot_layout_free
,RNA.plot_layout
,RNA.plot_layout_naview
,RNA.plot_layout_circular
,RNA.plot_layout_turtle
,RNA.plot_layout_puzzler
,RNA.plot_coords_simple
,RNA.file_PS_rnaplot_layout
Note
If only X-Y coordinates of the corresponding structure layout are required, consider using RNA.plot_coords_simple() instead!
- RNA.plot_layout_turtle(structure)
Create a layout (coordinates, etc.) for a secondary structure plot using the Turtle Algorithm [Wiegreffe et al., 2019] .
This function basically is a wrapper to RNA.plot_layout() that passes the `plot_type`RNA.PLOT_TYPE_TURTLE.
- Parameters:
structure (
string
) – The secondary structure in dot-bracket notation- Returns:
The layout data structure for the provided secondary structure
- Return type:
RNA.plot_layout() *
See also
RNA.plot_layout_free
,RNA.plot_layout
,RNA.plot_layout_simple
,RNA.plot_layout_circular
,RNA.plot_layout_naview
,RNA.plot_layout_puzzler
,RNA.plot_coords_turtle
,RNA.file_PS_rnaplot_layout
Note
If only X-Y coordinates of the corresponding structure layout are required, consider using RNA.plot_coords_turtle() instead!
- class RNA.plot_options_puzzler(*args, **kwargs)
Bases:
object
Options data structure for RNApuzzler algorithm implementation.
- drawArcs
- Type:
short
- paired
- Type:
double
- unpaired
- Type:
double
- checkAncestorIntersections
- Type:
short
- checkSiblingIntersections
- Type:
short
- checkExteriorIntersections
- Type:
short
- allowFlipping
- Type:
short
- optimize
- Type:
short
- maximumNumberOfConfigChangesAllowed
- Type:
int
- config
- Type:
string
- filename
- Type:
string
- numberOfChangesAppliedToConfig
- Type:
int
- psNumber
- Type:
int
- property allowFlipping
- property checkAncestorIntersections
- property checkExteriorIntersections
- property checkSiblingIntersections
- property optimize
- plot_options_puzzler()
Options data structure for RNApuzzler algorithm implementation.
- drawArcs
- Type:
short
- paired
- Type:
double
- unpaired
- Type:
double
- checkAncestorIntersections
- Type:
short
- checkSiblingIntersections
- Type:
short
- checkExteriorIntersections
- Type:
short
- allowFlipping
- Type:
short
- optimize
- Type:
short
- maximumNumberOfConfigChangesAllowed
- Type:
int
- config
- Type:
string
- filename
- Type:
string
- numberOfChangesAppliedToConfig
- Type:
int
- psNumber
- Type:
int
- property thisown
The membership flag
- RNA.plot_structure(std::string filename, std::string sequence, std::string structure, unsigned int file_format=, plot_layout layout=None, plot_data data=None) int
- RNA.plot_structure_eps(std::string filename, std::string sequence, std::string structure, plot_layout layout=None, plot_data data=None) int
- RNA.plot_structure_gml(std::string filename, std::string sequence, std::string structure, plot_layout layout=None, plot_data data=None, char option='x') int
- RNA.plot_structure_ssv(std::string filename, std::string sequence, std::string structure, plot_layout layout=None, plot_data data=None) int
- RNA.plot_structure_svg(std::string filename, std::string sequence, std::string structure, plot_layout layout=None, plot_data data=None) int
- RNA.plot_structure_xrna(std::string filename, std::string sequence, std::string structure, plot_layout layout=None, plot_data data=None) int
- RNA.print_bppm(T)
print string representation of probability profile
- RNA.print_tree(t)
Print a tree (mainly for debugging)
- class RNA.probing_data(probing_data self, DoubleVector reactivities, double m, double b)
- class RNA.probing_data(probing_data self, DoubleDoubleVector reactivities, DoubleVector ms, DoubleVector bs) probing_data
- class RNA.probing_data(probing_data self, DoubleVector reactivities, double beta, std::string pr_conversion=, double pr_default=) probing_data
- class RNA.probing_data(probing_data self, DoubleDoubleVector reactivities, DoubleVector betas, StringVector pr_conversions=std::vector< std::string >(), DoubleVector pr_defaults=std::vector< double >()) probing_data
Bases:
object
The
probing_data()
constructor can be invoked in different ways. Depending on the input parameters, the object returned will invoke particular probing data integration methods either for single sequences or multiple sequence alignments. Hence, it subsumes and provides an easy interface for the functionsprobing_data_Deigan2009()
,probing_data_Deigan2009_comparative()
, etc.When multiple sets of probing data are supplied, the constructor assumes preparations for multiple sequence alignments (MSAs). As a consequence, the parameters for the conversion methods must be supplied as lists of parameters, one for each sequence.
- Parameters:
reactivities (
list(double)
orlist(list(double)
) – single sequence probing data (1-based) or multiple sequence probing data (0-based list for each sequence of 1-based data)m (
double
) – slope for the Deigan et al. 2009 methodb (
double
) – intercept for the Deigan et al. 2009 methodms (
list(double)
) – multiple slopes for the Deigan et al. 2009 method (0-based, one for each sequence)bs (
list(double)
) – multiple intercepts for the Deigan et al. 2009 method (0-based, one for each sequence)beta (
double
) – scaling factor for Zarringhalam et al. 2012 methodbetas (
double
) – multiple scaling factors for Zarringhalam et al. 2012 method (0-based, one for each sequence)pr_conversion (
string
) – probing data to conversion strategypr_conversions (
list(string)
) – multiple probing data to conversion strategies (0-based, one for each sequence)pr_default (
double
) – default probability for a nucleotide where reactivity data is missing forpr_defaults (
list(double)
) – list of default probabilities for a nucleotide where reactivity data is missing for (0-based, one for each sequence)
- property thisown
The membership flag
- RNA.probing_data_Deigan2009(DoubleVector reactivities, double m, double b) probing_data
Prepare probing data according to Deigan et al. 2009 method.
Prepares a data structure to be used with RNA.fold_compound.sc_probing() to directed RNA folding using the simple linear ansatz
\[\Delta G_{\text{SHAPE}}(i) = m \ln(\text{SHAPE reactivity}(i)+1)+ b\]to convert probing data, e.g. SHAPE reactivity values, to pseudo energies whenever a nucleotide \(i\) contributes to a stacked pair. A positive slope \(m\) penalizes high reactivities in paired regions, while a negative intercept \(b\) results in a confirmatory `bonus’ free energy for correctly predicted base pairs. Since the energy evaluation of a base pair stack involves two pairs, the pseudo energies are added for all four contributing nucleotides. Consequently, the energy term is applied twice for pairs inside a helix and only once for pairs adjacent to other structures. For all other loop types the energy model remains unchanged even when the experimental data highly disagrees with a certain motif.
SWIG Wrapper Notes
This function exists in two forms, (i) as overloaded function probing_data_Deigan2009() and (ii) as constructor of the probing_data object. For the former the second argument n can be omitted since the length of the reactivities list is determined from the list itself. When the #RNA.probing_data() constructor is called with the three parameters reactivities, m and b, it will automatically create a prepared data structure for the Deigan et al. 2009 method. See, e.g.
RNA.probing_data_Deigan2009()
andRNA.probing_data()
in the Python API .- Parameters:
reactivities (
list-like(double)
) – 1-based array of per-nucleotide probing data, e.g. SHAPE reactivitiesn (
unsigned int
) – The length of the reactivities listm (
double
) – The slope used for the probing data to soft constraints conversion strategyb (
double
) – The intercept used for the probing data to soft constraints conversion strategy
- Returns:
A pointer to a data structure containing the probing data and any preparations necessary to use it in RNA.fold_compound.sc_probing() according to the method of Deigan et al. [2009] or NULL on any error.
- Return type:
See also
RNA.probing_data
,RNA.probing_data_free
,RNA.fold_compound.sc_probing
,RNA.probing_data_Deigan2009_comparative
,RNA.probing_data_Zarringhalam2012
,RNA.probing_data_Zarringhalam2012_comparative
,RNA.probing_data_Eddy2014_2
,RNA.probing_data_Eddy2014_2_comparative
Note
For further details, we refer to Deigan et al. [2009] .
- RNA.probing_data_Deigan2009_comparative(DoubleDoubleVector reactivities, DoubleVector ms, DoubleVector bs, unsigned int multi_params=) probing_data
Prepare (multiple) probing data according to Deigan et al. 2009 method for comparative structure predictions.
Similar to RNA.probing_data_Deigan2009(), this function prepares a data structure to be used with RNA.fold_compound.sc_probing() to directed RNA folding using the simple linear ansatz
\[\Delta G_{\text{SHAPE}}(i) = m \ln(\text{SHAPE reactivity}(i)+1)+ b\]to convert probing data, e.g. SHAPE reactivity values, to pseudo energies whenever a nucleotide \(i\) contributes to a stacked pair. This functions purpose is to allow for adding multiple probing data as required for comparative structure predictions over multiple sequence alignments (MSA) with n_seq sequences. For that purpose, reactivities can be provided for any of the sequences in the MSA. Individual probing data is always expected to be specified in sequence coordinates, i.e. without considering gaps in the MSA. Therefore, each set of reactivities may have a different length as specified the parameter n. In addition, each set of probing data may undergo the conversion using different parameters \(m\) and \(b\). Whether or not multiple sets of conversion parameters are provided must be specified using the multi_params flag parameter. Use RNA.PROBING_METHOD_MULTI_PARAMS_1 to indicate that ms points to an array of slopes for each sequence. Along with that, RNA.PROBING_METHOD_MULTI_PARAMS_2 indicates that bs is pointing to an array of intercepts for each sequence. Bitwise-OR of the two values renders both parameters to be sequence specific.
- Parameters:
reactivities (
list-like(list-like(double))
) – 0-based array of 1-based arrays of per-nucleotide probing data, e.g. SHAPE reactivitiesn (
const unsigned int *
) – 0-based array of lengths of the reactivities listsn_seq (
unsigned int
) – The number of sequences in the MSAms (
list-like(double)
) – 0-based array of the slopes used for the probing data to soft constraints conversion strategy or the address of a single slope value to be applied for all databs (
list-like(double)
) – 0-based array of the intercepts used for the probing data to soft constraints conversion strategy or the address of a single intercept value to be applied for all datamulti_params (
unsigned int
) – A flag indicating what is passed through parameters ms and bs
- Returns:
A pointer to a data structure containing the probing data and any preparations necessary to use it in RNA.fold_compound.sc_probing() according to the method of Deigan et al. [2009] or NULL on any error.
- Return type:
See also
RNA.probing_data
,RNA.probing_data_free
,RNA.fold_compound.sc_probing
,RNA.probing_data_Deigan2009
,RNA.probing_data_Zarringhalam2012
,RNA.probing_data_Zarringhalam2012_comparative
,RNA.probing_data_Eddy2014_2
,RNA.probing_data_Eddy2014_2_comparative
,RNA.PROBING_METHOD_MULTI_PARAMS_0
,RNA.PROBING_METHOD_MULTI_PARAMS_1
,RNA.PROBING_METHOD_MULTI_PARAMS_2
,RNA.PROBING_METHOD_MULTI_PARAMS_DEFAULT
Note
For further details, we refer to Deigan et al. [2009] .
- RNA.probing_data_Eddy2014_2(DoubleVector reactivities, DoubleVector unpaired_data, DoubleVector paired_data) probing_data
Add probing data as soft constraints (Eddy/RNAprob-2 method)
This approach of probing data directed RNA folding uses the probability framework proposed by Eddy [2014] :
\[\Delta G_{\text{data}}(i) = - RT\ln(\mathbb{P}(\text{data}(i)\mid x_{i}\pi_{i}))\]to convert probing data to pseudo energies for given nucleotide \(x_{i}\) and class probability \(\pi_{i}\) at position \(i\). The conditional probability is taken from a prior- distribution of probing data for the respective classes.
Here, the method distinguishes exactly two different classes of structural context, (i) unpaired and (ii) paired positions, following the lines of the RNAprob-2 method of Deng et al. [2016] . The reactivity distribution is computed using Gaussian kernel density estimation (KDE) with bandwidth \(h\) computed using Scott factor
\[h = n^{-\frac{1}{5}}\]where \(n\) is the number of data points of the prior distribution.
- Parameters:
reactivities (
list-like(double)
) – A 1-based vector of probing data, e.g. normalized SHAPE reactivitiesn (
unsigned int
) – Length of reactivitiesunpaired_data (
list-like(double)
) – Pointer to an array of probing data for unpaired nucleotidesunpaired_len (
unsigned int
) – Length of unpaired_datapaired_data (
list-like(double)
) – Pointer to an array of probing data for paired nucleotidespaired_len (
unsigned int
) – Length of paired_data
- Returns:
A pointer to a data structure containing the probing data and any preparations necessary to use it in RNA.fold_compound.sc_probing() according to the method of Eddy [2014] or NULL on any error.
- Return type:
- RNA.probing_data_Eddy2014_2_comparative(DoubleDoubleVector reactivities, DoubleDoubleVector unpaired_data, DoubleDoubleVector paired_data, unsigned int multi_params=) probing_data
Add probing data as soft constraints (Eddy/RNAprob-2 method) for comparative structure predictions.
Similar to RNA.probing_data_Eddy2014_2(), this function prepares a data structure for probing data directed RNA folding. It uses the probability framework proposed by Eddy [2014] :
\[\Delta G_{\text{data}}(i) = - RT\ln(\mathbb{P}(\text{data}(i)\mid x_{i}\pi_{i}))\]to convert probing data to pseudo energies for given nucleotide \(x_{i}\) and class probability \(\pi_{i}\) at position \(i\). The conditional probability is taken from a prior- distribution of probing data for the respective classes.
This functions purpose is to allow for adding multiple probing data as required for comparative structure predictions over multiple sequence alignments (MSA) with n_seq sequences. For that purpose, reactivities can be provided for any of the sequences in the MSA. Individual probing data is always expected to be specified in sequence coordinates, i.e. without considering gaps in the MSA. Therefore, each set of reactivities may have a different length as specified the parameter n. In addition, each set of probing data may undergo the conversion using different prior distributions for unpaired and paired nucleotides. Whether or not multiple sets of conversion priors are provided must be specified using the multi_params flag parameter. Use RNA.PROBING_METHOD_MULTI_PARAMS_1 to indicate that unpaired_datas points to an array of unpaired probing data for each sequence. Similarly, RNA.PROBING_METHOD_MULTI_PARAMS_2 indicates that paired_datas is pointing to an array paired probing data for each sequence. Bitwise-OR of the two values renders both parameters to be sequence specific.
- Parameters:
reactivities (
list-like(list-like(double))
) – 0-based array of 1-based arrays of per-nucleotide probing data, e.g. SHAPE reactivitiesn (
list-like(unsigned int)
) – 0-based array of lengths of the reactivities listsn_seq (
unsigned int
) – The number of sequences in the MSAunpaired_datas (
list-like(list-like(double))
) – 0-based array of 0-based arrays with probing data for unpaired nucleotides or address of a single array of such dataunpaired_lens (
list-like(unsigned int)
) – 0-based array of lengths for each probing data array in unpaired_dataspaired_datas (
list-like(list-like(double))
) – 0-based array of 0-based arrays with probing data for paired nucleotides or address of a single array of such datapaired_lens (
list-like(unsigned int)
) – 0-based array of lengths for each probing data array in paired_datamulti_params (
unsigned int
) – A flag indicating what is passed through parameters unpaired_datas and paired_datas
- Returns:
A pointer to a data structure containing the probing data and any preparations necessary to use it in RNA.fold_compound.sc_probing() according to the method of Eddy [2014] or NULL on any error.
- Return type:
See also
RNA.probing_data
,RNA.probing_data_free
,RNA.fold_compound.sc_probing
,RNA.probing_data_Eddy2014_2
,RNA.probing_data_Deigan2009
,RNA.probing_data_Deigan2009_comparative
,RNA.probing_data_Zarringhalam2012
,RNA.probing_data_Zarringhalam2012_comparative
,RNA.PROBING_METHOD_MULTI_PARAMS_0
,RNA.PROBING_METHOD_MULTI_PARAMS_1
,RNA.PROBING_METHOD_MULTI_PARAMS_2
,RNA.PROBING_METHOD_MULTI_PARAMS_DEFAULT
- RNA.probing_data_Zarringhalam2012(DoubleVector reactivities, double beta, std::string pr_conversion=, double pr_default=) probing_data
Prepare probing data according to Zarringhalam et al. 2012 method.
Prepares a data structure to be used with RNA.fold_compound.sc_probing() to directed RNA folding using the method of Zarringhalam et al. [2012] .
This method first converts the observed probing data of nucleotide \(i\) into a probability \(q_{i}\) that position \(i\) is unpaired by means of a non-linear map. Then pseudo-energies of the form
\[\Delta G_{\text{SHAPE}}(x,i) = \beta\ |x_{i} - q_{i}|\]are computed, where \(x_{i}=0\) if position \(i\) is unpaired and \(x_{i}=1\) if \(i\) is paired in a given secondary structure. The parameter \(\beta\) serves as scaling factor. The magnitude of discrepancy between prediction and experimental observation is represented by \(|x_{i} - q_{i}|\).
- Parameters:
reactivities (
list-like(double)
) – 1-based array of per-nucleotide probing data, e.g. SHAPE reactivitiesn (
unsigned int
) – The length of the reactivities listbeta (
double
) – The scaling factor \(\beta\) of the conversion functionpr_conversion (
string
) – A flag that specifies how to convert reactivities to probabilitiespr_default (
double
) – The default probability for a nucleotide where reactivity data is missing for
- Returns:
A pointer to a data structure containing the probing data and any preparations necessary to use it in RNA.fold_compound.sc_probing() according to the method of Zarringhalam et al. [2012] or NULL on any error.
- Return type:
See also
RNA.probing_data
,RNA.probing_data_free
,RNA.fold_compound.sc_probing
,RNA.probing_data_Zarringhalam2012_comparative
,RNA.probing_data_Deigan2009
,RNA.probing_data_Deigan2009_comparative
,RNA.probing_data_Eddy2014_2
,RNA.probing_data_Eddy2014_2_comparative
Note
For further details, we refer to Zarringhalam et al. [2012]
- RNA.probing_data_Zarringhalam2012_comparative(DoubleDoubleVector reactivities, DoubleVector betas, StringVector pr_conversions=std::vector< std::string >(), DoubleVector pr_defaults=std::vector< double >(), unsigned int multi_params=) probing_data
- RNA.probing_data_free(d)
Free memory occupied by the (prepared) probing data.
- RNA.profile_edit_distance(T1, T2)
Align the 2 probability profiles T1, T2 .
This is like a Needleman-Wunsch alignment, we should really use affine gap-costs ala Gotoh
- RNA.pt_pk_remove(IntVector pt, unsigned int options=0) IntVector
- RNA.pt_pk_remove(varArrayShort pt, unsigned int options=0) varArrayShort
Remove pseudo-knots from a pair table.
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.
- Parameters:
ptable (
const short *
) – Input structure that may include pseudo-knotsoptions (
unsigned int
) –
- Returns:
The input structure devoid of pseudo-knots
- Return type:
list-like(int)
See also
- RNA.ptable(std::string str, unsigned int options=) varArrayShort
Create a pair table for a secondary structure string.
This function takes an input string of a secondary structure annotation in dot-bracket-notation or dot-bracket-ext-notation, and converts it into a pair table representation.
SWIG Wrapper Notes
This functions is wrapped as overloaded function ptable() that takes an optional argument options to specify which type of matching brackets should be considered during conversion. The default set is round brackets, i.e. RNA.BRACKETS_RND. See, e.g.
RNA.ptable()
in the Python API.- Parameters:
structure (
string
) – Secondary structure in dot-bracket-ext-notationoptions (
unsigned int
) – 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
- Return type:
list-like(int)
See also
RNA.ptable
,RNA.db_from_ptable
,RNA.db_flatten_to
,RNA.pt_pk_remove
,RNA.BRACKETS_ANG
,RNA.BRACKETS_CLY
,RNA.BRACKETS_SQR
,RNA.BRACKETS_ALPHA
,RNA.BRACKETS_DEFAULT
,RNA.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.
- RNA.ptable_pk(std::string str) IntVector
Create a pair table of a secondary structure (pseudo-knot version)
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 RNA.ptable() this function also recognizes the base pairs denoted by ‘[’ and ‘]’ brackets. Thus, this function behaves like
- Parameters:
structure (
string
) – The secondary structure in (extended) dot-bracket notation- Returns:
A pointer to the created pair_table
- Return type:
list-like(int)
See also
RNA.ptable_from_string
- RNA.random_string(l, symbols)
Create a random string using characters from a specified symbol set.
- Parameters:
l (
int
) – The length of the sequencesymbols (
const char
) – The symbol set
- Returns:
A random string of length ‘l’ containing characters from the symbolset
- Return type:
string
- RNA.read_parameter_file(fname)
Read energy parameters from a file.
Deprecated since version 2.7.0: Use RNA.params_load() instead!
- Parameters:
fname (
const char
) – The path to the file containing the energy parameters
- RNA.read_record(header, sequence, rest, options)
Get a data record from stdin.
Deprecated since version 2.7.0: This function is deprecated! Use RNA.file_fasta_read_record() as a replacment.
- RNA.rotational_symmetry(*args)
Determine the order of rotational symmetry for a NULL-terminated string of ASCII characters.
The algorithm applies a fast search of the provided string within itself, assuming the end of the string wraps around to connect with it’s start. For example, a string of the form AABAAB has rotational symmetry of order 2
If the argument positions is not NULL, the function stores an array of string start positions for rotational shifts that map the string back onto itself. This array has length of order of rotational symmetry, i.e. the number returned by this function. The first element positions`[0] always contains a shift value of `0 representing the trivial rotation.
SWIG Wrapper Notes
This function is available as overloaded global function rotational_symmetry(). It merges the functionalities of RNA.rotational_symmetry(), RNA.rotational_symmetry_pos(), RNA.rotational_symmetry_num(), and RNA.rotational_symmetry_pos_num(). In contrast to our C-implementation, this function doesn’t return the order of rotational symmetry as a single value, but returns a list of cyclic permutation shifts that result in a rotationally symmetric string. The length of the list then determines the order of rotational symmetry. See, e.g.
RNA.rotational_symmetry()
in the Python API .- Parameters:
string (
string
) – A NULL-terminated string of characterspositions (
list-like(list-like(unsigned int))
) – A pointer to an (undefined) list of alternative string start positions that lead to an identity mapping (may be NULL)
- Returns:
The order of rotational symmetry
- Return type:
unsigned int
See also
RNA.rotational_symmetry
,RNA.rotational_symmetry_num
,RNA.rotational_symmetry_num_pos
Note
Do not forget to release the memory occupied by positions after a successful execution of this function.
- RNA.salt_duplex_init(md)
Get salt correction for duplex initialization at a given salt concentration.
- Parameters:
md (
RNA.md() *
) – Model details data structure that specfifies salt concentration in buffer (M)- Returns:
Rounded correction for duplex initialization in dcal/mol
- Return type:
int
- RNA.salt_loop(L, salt, T, backbonelen)
Get salt correction for a loop at a given salt concentration and temperature.
- Parameters:
L (
int
) – backbone number in loopsalt (
double
) – salt concentration (M)T (
double
) – absolute temperature (K)backbonelen (
double
) – Backbone Length, phosphate-to-phosphate distance (typically 6 for RNA, 6.76 for DNA)
- Returns:
Salt correction for loop in dcal/mol
- Return type:
double
- RNA.salt_loop_int(L, salt, T, backbonelen)
Get salt correction for a loop at a given salt concentration and temperature.
This functions is same as RNA.salt_loop but returns rounded salt correction in integer
- Parameters:
L (
int
) – backbone number in loopsalt (
double
) – salt concentration (M)T (
double
) – absolute temperature (K)backbonelen (
double
) – Backbone Length, phosphate-to-phosphate distance (typically 6 for RNA, 6.76 for DNA)
- Returns:
Rounded salt correction for loop in dcal/mol
- Return type:
int
See also
- RNA.salt_ml(saltLoop, lower, upper, m, b)
Fit linear function to loop salt correction.
For a given range of loop size (backbone number), we perform a linear fitting on loop salt correction
\[\text{Loop correction} \approx m \cdot L + b.\]- Parameters:
saltLoop (
double
) – List of loop salt correction of size from 1lower (
int
) – Define the size lower bound for fittingupper (
int
) – Define the size upper bound for fittingm (
int *
) – pointer to store the parameter m in fitting resultb (
int *
) – pointer to store the parameter b in fitting result
See also
- RNA.salt_stack(salt, T, hrise)
Get salt correction for a stack at a given salt concentration and temperature.
- Parameters:
salt (
double
) – salt concentration (M)T (
double
) – absolute temperature (K)hrise (
double
) – Helical Rise (typically 2.8 for RNA, 3.4 for DNA)
- Returns:
Rounded salt correction for stack in dcal/mol
- Return type:
int
- RNA.sc_add_bt_pycallback(vc, PyFunc)
- RNA.sc_add_exp_f_pycallback(vc, PyFunc)
- RNA.sc_add_f_pycallback(vc, callback)
- RNA.sc_add_pydata(vc, data, callback)
- class RNA.sc_mod_param(json, md=None)
Bases:
object
- available
- Type:
unsigned int
- name
- Type:
string
- one_letter_code
- Type:
char
- unmodified
- Type:
char
- fallback
- Type:
char
- pairing_partners
- Type:
char
- pairing_partners_encoding
- Type:
unsigned int
- unmodified_encoding
- Type:
unsigned int
- fallback_encoding
- Type:
unsigned int
- num_ptypes
- Type:
size_t
- ptypes
- Type:
size_t
- stack_dG
- Type:
int
- stack_dH
- Type:
int
- dangle5_dG
- Type:
int
- dangle5_dH
- Type:
int
- dangle3_dG
- Type:
int
- dangle3_dH
- Type:
int
- mismatch_dG
- Type:
int
- mismatch_dH
- Type:
int
- terminal_dG
- Type:
int
- terminal_dH
- Type:
int
- available
- Type:
unsigned int
- name
- Type:
string
- one_letter_code
- Type:
char
- unmodified
- Type:
char
- fallback
- Type:
char
- pairing_partners
- Type:
char
- pairing_partners_encoding
- Type:
unsigned int
- unmodified_encoding
- Type:
unsigned int
- fallback_encoding
- Type:
unsigned int
- num_ptypes
- Type:
size_t
- ptypes
- Type:
size_t
- stack_dG
- Type:
int
- stack_dH
- Type:
int
- dangle5_dG
- Type:
int
- dangle5_dH
- Type:
int
- dangle3_dG
- Type:
int
- dangle3_dH
- Type:
int
- mismatch_dG
- Type:
int
- mismatch_dH
- Type:
int
- terminal_dG
- Type:
int
- terminal_dH
- Type:
int
- property thisown
The membership flag
- RNA.sc_mod_parameters_free(params)
Release memory occupied by a modified base parameter data structure.
Properly free a RNA.sc_mod_param() data structure
- Parameters:
params (
RNA.sc_mod_param()
) – The data structure to free
- RNA.sc_mod_read_from_json(json, md=None)
Parse and extract energy parameters for a modified base from a JSON string.
SWIG Wrapper Notes
This function is available as an overloaded function sc_mod_read_from_json() where the md parameter may be omitted and defaults to NULL. See, e.g.
RNA.sc_mod_read_from_json()
in the Python API .- Parameters:
filename – The JSON file containing the specifications of the modified base
md (
RNA.md() *
) – A model-details data structure (for look-up of canonical base pairs)
- Returns:
Parameters of the modified base
- Return type:
See also
RNA.sc_mod_read_from_jsonfile
,RNA.sc_mod_parameters_free
,RNA.fold_compound.sc_mod
,modified-
,bases-
,params
- RNA.sc_mod_read_from_jsonfile(filename, md=None)
Parse and extract energy parameters for a modified base from a JSON file.
SWIG Wrapper Notes
This function is available as an overloaded function sc_mod_read_from_jsonfile() where the md parameter may be omitted and defaults to NULL. See, e.g.
RNA.sc_mod_read_from_jsonfile()
in the Python API .- Parameters:
filename (
string
) – The JSON file containing the specifications of the modified basemd (
RNA.md() *
) – A model-details data structure (for look-up of canonical base pairs)
- Returns:
Parameters of the modified base
- Return type:
See also
RNA.sc_mod_read_from_json
,RNA.sc_mod_parameters_free
,RNA.fold_compound.sc_mod
,modified-
,bases-params
- RNA.sc_multi_cb_add_pycallback(fc, f, f_exp, data, data_prepare, data_free, decomp_type)
- class RNA.score(TP=0, TN=0, FP=0, FN=0)
Bases:
object
- property F1
- property FDR
- property FN
- property FNR
- property FOR
- property FP
- property FPR
- property MCC
- property NPV
- property PPV
- property TN
- property TNR
- property TP
- property TPR
- property thisown
The membership flag
- RNA.seq_encode(std::string sequence, md md_p=None) IntVector
Get a numerical representation of the nucleotide sequence.
SWIG Wrapper Notes
In the target scripting language, this function is wrapped as overloaded function seq_encode() where the last parameter, the model_details data structure, is optional. If it is omitted, default model settings are applied, i.e. default nucleotide letter conversion. The wrapped function returns a list/tuple of integer representations of the input sequence. See, e.g.
RNA.seq_encode()
in the Python API.- Parameters:
sequence (
string
) – The input sequence in upper-case lettersmd (
RNA.md() *
) – A pointer to a RNA.md() data structure that specifies the conversion type
- Returns:
A list of integer encodings for each sequence letter (1-based). Position 0 denotes the length of the list
- Return type:
list-like(int)
- RNA.settype(s)
- RNA.shortP_getitem(ary, index)
- RNA.shortP_setitem(ary, index, value)
- RNA.simple_circplot_coordinates(std::string arg1) CoordinateVector
- RNA.simple_xy_coordinates(*args)
Calculate nucleotide coordinates for secondary structure plot the Simple way
Deprecated since version 2.7.0: Consider switching to RNA.plot_coords_simple_pt() instead!
See also
make_pair_table
,rna_plot_type
,simple_circplot_coordinates
,naview_xy_coordinates
,RNA.file_PS_rnaplot_a
,RNA.file_PS_rnaplot
,svg_rna_plot
- Parameters:
pair_table (
list-like(int)
) – The pair table of the secondary structureX (
list-like(double)
) – a pointer to an array with enough allocated space to hold the x coordinatesY (
list-like(double)
) – a pointer to an array with enough allocated space to hold the y coordinates
- Returns:
length of sequence on success, 0 otherwise
- Return type:
int
- RNA.ssv_rna_plot(string, structure, ssfile)
Produce a secondary structure graph in SStructView format.
Write coord file for SStructView
- Parameters:
string (
string
) – The RNA sequencestructure (
string
) – The secondary structure in dot-bracket notationssfile (
string
) – The filename of the ssv output
- Returns:
1 on success, 0 otherwise
- Return type:
int
- RNA.string_edit_distance(T1, T2)
Calculate the string edit distance of T1 and T2.
- Parameters:
T1 (
swString *
) –T2 (
swString *
) –
- Return type:
float
- RNA.strtrim(char * seq_mutable, char const * delimiters=None, unsigned int keep=0, unsigned int options=) unsigned int
Trim a string by removing (multiple) occurences of a particular character.
This function removes (multiple) consecutive occurences of a set of characters (delimiters) within an input string. It may be used to remove leading and/or trailing whitespaces or to restrict the maximum number of consecutive occurences of the delimiting characters delimiters. Setting keep=0 removes all occurences, while other values reduce multiple consecutive occurences to at most keep delimiters. This might be useful if one would like to reduce multiple whitespaces to a single one, or to remove empty fields within a comma-separated value string.
The parameter delimiters may be a pointer to a 0-terminated char string containing a set of any ASCII character. If NULL is passed as delimiter set or an empty char string, all whitespace characters are trimmed. The options parameter is a bit vector that specifies which part of the string should undergo trimming. The implementation distinguishes the leading (RNA.TRIM_LEADING), trailing (RNA.TRIM_TRAILING), and in-between (RNA.TRIM_IN_BETWEEN) part with respect to the delimiter set. Combinations of these parts can be specified by using logical-or operator.
The following example code removes all leading and trailing whitespace characters from the input string:
SWIG Wrapper Notes
Since many scripting languages treat strings as immutable objects, this function does not modify the input string directly. Instead, it returns the modified string as second return value, together with the number of removed delimiters.
The scripting language interface provides an overloaded version of this function, with default parameters delimiters=NULL, keep=0, and options=RNA.TRIM_DEFAULT. See, e.g.
RNA.strtrim()
in the Python API.- Parameters:
string (
string
) – The ‘0’-terminated input string to trimdelimiters (
string
) – The delimiter characters as 0-terminated char array (or NULL)keep (
unsigned int
) – The maximum number of consecutive occurences of the delimiter in the output stringoptions (
unsigned int
) – The option bit vector specifying the mode of operation
- Returns:
The number of delimiters removed from the string
- Return type:
unsigned int
See also
RNA.TRIM_LEADING
,RNA.TRIM_TRAILING
,RNA.TRIM_IN_BETWEEN
,RNA.TRIM_SUBST_BY_FIRST
,RNA.TRIM_DEFAULT
,RNA.TRIM_ALL
Note
The delimiter always consists of a single character from the set of characters provided. In case of alternative delimiters and non-null keep parameter, the first keep delimiters are preserved within the string. Use RNA.TRIM_SUBST_BY_FIRST to substitute all remaining delimiting characters with the first from the delimiters list.
- class RNA.struct_en
Bases:
object
Data structure for energy_of_move()
- energy
- Type:
int
- structure
- Type:
list-like(int)
Data structure for energy_of_move()
- energy
- Type:
int
- structure
- Type:
list-like(int)
- property energy
- property structure
- property thisown
The membership flag
- RNA.subopt(*args)
- class RNA.subopt_solution
Bases:
object
- property energy
- property structure
- property thisown
The membership flag
- RNA.svg_rna_plot(string, structure, ssfile)
Produce a secondary structure plot in SVG format and write it to a file.
- Parameters:
string (
string
) – The RNA sequencestructure (
string
) – The secondary structure in dot-bracket notationssfile (
string
) – The filename of the svg output
- Returns:
1 on success, 0 otherwise
- Return type:
int
- RNA.tree_edit_distance(T1, T2)
Calculates the edit distance of the two trees.
- Parameters:
T1 (
Tree *
) –T2 (
Tree *
) –
- Return type:
float
- RNA.tree_string_to_db(structure)
Convert a linear tree string representation of a secondary structure back to Dot-Bracket notation.
- Parameters:
tree (
string
) – A linear tree string representation of a secondary structure- Returns:
A dot-bracket notation of the secondary structure provided in tree
- Return type:
string
Warning
This function only accepts Expanded and HIT tree representations!
See also
RNA.db_to_tree_string
,RNA.STRUCTURE_TREE_EXPANDED
,RNA.STRUCTURE_TREE_HIT
,sec_structure_representations_tree
- RNA.tree_string_unweight(structure)
Remove weights from a linear string tree representation of a secondary structure.
This function strips the weights of a linear string tree representation such as HIT, or Coarse Grained Tree sensu Shapiro [1988]
- Parameters:
structure (
string
) – A linear string tree representation of a secondary structure with weights- Returns:
A linear string tree representation of a secondary structure without weights
- Return type:
string
See also
- RNA.ubf_eval_ext_int_loop(i, j, p, q, i1, j1, p1, q1, si, sj, sp, sq, type, type_2, length, P, sc)
- RNA.ubf_eval_int_loop(i, j, p, q, i1, j1, p1, q1, si, sj, sp, sq, type, type_2, rtype, ij, cp, P, sc)
- RNA.ubf_eval_int_loop2(i, j, p, q, i1, j1, p1, q1, si, sj, sp, sq, type, type_2, rtype, ij, sn, ss, P, sc)
- RNA.ud_set_exp_prod_cb(vc, prod_cb, eval_cb)
- RNA.ud_set_prob_cb(vc, setter, getter)
- RNA.ud_set_prod_cb(vc, prod_cb, eval_cb)
- RNA.ud_set_pydata(vc, data, PyFuncOrNone)
- RNA.unexpand_Full(ffull)
Restores the bracket notation from an expanded full or HIT tree, that is any tree using only identifiers ‘U’ ‘P’ and ‘R’.
- Parameters:
ffull (
string
) –- Return type:
string
- RNA.unexpand_aligned_F(align)
Converts two aligned structures in expanded notation.
Takes two aligned structures as produced by tree_edit_distance() function back to bracket notation with ‘_’ as the gap character. The result overwrites the input.
- Parameters:
align (
string
) –
- RNA.unpack_structure(char const * packed) char *
- RNA.unweight(wcoarse)
Strip weights from any weighted tree.
- Parameters:
wcoarse (
string
) –- Return type:
string
- RNA.update_co_pf_params(length)
Recalculate energy parameters.
This function recalculates all energy parameters given the current model settings.
Deprecated since version 2.7.0: Use RNA.fold_compound.exp_params_subst() instead!
- Parameters:
length (
int
) – Length of the current RNA sequence
- RNA.update_cofold_params()
Recalculate parameters.
Deprecated since version 2.7.0: See RNA.fold_compound.params_subst() for an alternative using the new API
- RNA.update_fold_params()
Recalculate energy parameters.
Deprecated since version 2.7.0: For non-default model settings use the new API with RNA.fold_compound.params_subst() and RNA.fold_compound.mfe() instead!
- RNA.update_pf_params(length)
Recalculate energy parameters.
Call this function to recalculate the pair matrix and energy parameters after a change in folding parameters like temperature
Deprecated since version 2.7.0: Use RNA.fold_compound.exp_params_subst() instead
- RNA.urn()
get a random number from [0..1]
- Returns:
A random number in range [0..1]
- Return type:
double
See also
RNA.int_urn
,RNA.init_rand
,RNA.init_rand_seed
Note
Usually implemented by calling erand48().
- RNA.ushortP_getitem(ary, index)
- RNA.ushortP_setitem(ary, index, value)
- class RNA.varArrayChar(d, type)
Bases:
object
- get(i)
- size()
- property thisown
The membership flag
- type()
- class RNA.varArrayFLTorDBL(d, type)
Bases:
object
- get(i)
- size()
- property thisown
The membership flag
- type()
- class RNA.varArrayInt(d, type)
Bases:
object
- get(i)
- size()
- property thisown
The membership flag
- type()
- class RNA.varArrayMove(d, type)
Bases:
object
- get(i)
- size()
- property thisown
The membership flag
- type()
- class RNA.varArrayShort(*args)
Bases:
object
- get(i)
- size()
- property thisown
The membership flag
- type()
- class RNA.varArrayUChar(d, type)
Bases:
object
- get(i)
- size()
- property thisown
The membership flag
- type()
- class RNA.varArrayUInt(d, type)
Bases:
object
- get(i)
- size()
- property thisown
The membership flag
- type()
- RNA.write_parameter_file(fname)
Write energy parameters to a file.
Deprecated since version 2.7.0: Use RNA.params_save() instead!
- Parameters:
fname (
const char
) – A filename (path) for the file where the current energy parameters will be written to
- RNA.xrna_plot(string, structure, ssfile)
Produce a secondary structure plot for further editing in XRNA.
- Parameters:
string (
string
) – The RNA sequencestructure (
string
) – The secondary structure in dot-bracket notationssfile (
string
) – The filename of the xrna output
- Returns:
1 on success, 0 otherwise
- Return type:
int
- RNA.zukersubopt(string)
Compute Zuker type suboptimal structures.
Compute Suboptimal structures according to M. Zuker, i.e. for every possible base pair the minimum energy structure containing the resp. base pair. Returns a list of these structures and their energies.
Deprecated since version 2.7.0: use RNA.zukersubopt() instead
- Parameters:
string (
string
) – RNA sequence- Returns:
List of zuker suboptimal structures
- Return type:
SOLUTION *