Font size: Increase font size Decrease font size Switch style sheet from default to highcontrast and back




RNAfold − manual page for RNAfold 2.2.0


RNAfold [OPTIONS]...


RNAfold 2.2.0

Calculate minimum free energy secondary structures and partition function of RNAs

The program reads RNA sequences, calculates their minimum free energy (mfe) structure and prints the mfe structure in bracket notation and its free energy. If not specified differently using commandline arguments, input is accepted from stdin, and output printed to stdout. If the −p option was given it also computes the partition function (pf) and base pairing probability matrix, and prints the free energy of the thermodynamic ensemble, the frequency of the mfe structure in the ensemble, and the ensemble diversity to stdout.

It also produces PostScript files with plots of the resulting secondary structure graph and a "dot plot" of the base pairing matrix. The dot plot shows a matrix of squares with area proportional to the pairing probability in the upper right half, and one square for each pair in the minimum free energy structure in the lower left half. For each pair i−j with probability p>10E−6 there is a line of the form

i j sqrt(p) ubox

in the PostScript file, so that the pair probabilities can be easily extracted.

Sequences may be provided in a simple text format where each sequence occupies a single line. Output files are named "" and "". Existing files of the same name will be overwritten. It is also possible to provide sequence data in FASTA format. In this case, the first word (max. 42 char) of the FASTA header will be used for output file names. PostScript files "" and "" are produced for the structure and dot plot, respectively. Once FASTA input was provided all following sequences must be in FASTA format too. The program will continue to read new sequences until a line consisting of the single character @ or an end of file condition is encountered.
, −−help

Print help and exit


Print help, including all details and hidden options, and exit


Print help, including hidden options, and exit

−V, −−version

Print version and exit

General Options:

Command line options which alter the general behavior of this program

−v, −−verbose

Be verbose (default=off)

−i, −−infile=<filename>

Read a file instead of reading from stdin

The default behavior of RNAfold is to read input from stdin. Using this parameter the user can specify an input file name where data is read from.

−o, −−outfile=<filename>

Print output to file instead of stdout

Specifying a file name/prefix will print the output into a file instead of stdout. If a FASTA header precedes the input sequence, the appropriate fasta ID is used as infix for the file name. Each generated file will be suffixed with the file extension ’.fold’. If a file with the same filename already exists, any output of the program will be appended to it.


Do not produce postscript drawing of the mfe structure.


−t, −−layout−type=INT

Choose the layout algorithm. Simple radial layout if 0, or naview if 1



Do not automatically substitude nucleotide "T" with "U"


Structure Constraints:

Command line options to interact with the structure constraints feature of this program


Set the maximum base pair span (default=‘−1’)

−C, −−constraint[=<filename>] Calculate structures subject to


The program reads first the sequence, then a string containing constraints on the structure encoded with the symbols:

. (no constraint for this base)

| (the corresponding base has to be paired

x (the base is unpaired)

< (base i is paired with a base j>i)

> (base i is paired with a base j<i)

and matching brackets ( ) (base i pairs base j)

With the exception of "|", constraints will disallow all pairs conflicting with the constraint. This is usually sufficient to enforce the constraint, but occasionally a base may stay unpaired in spite of constraints. PF folding ignores constraints of type "|".


Use constraints for multiple sequences. (default=off)

Usually, constraints provided from input file only apply to a single input sequence. Therefore, RNAfold will stop its computation and quit after the first input sequence was processed. Using this switch, RNAfold processes multiple input sequences and applies the same provided constraints to each of them.


Remove non−canonical base pairs from the structure constraint



Enforce base pairs given by round brackets ( ) in structure constraint



Use SHAPE reactivity data to guide structure predictions

−−shapeMethod=[D/Z/W] + [optional parameters]

Specify the method how to convert SHAPE

reactivity data to pseudo energy contributions


The following methods can be used to convert SHAPE reactivities into pseudo energy contributions.

’D’: Convert by using a linear equation according to Deigan et al 2009. The calculated pseudo energies will be applied for every nucleotide involved in a stacked pair. This method is recognized by a capital ’D’ in the provided parameter, i.e.: −−shapeMethod="D" is the default setting. The slope ’m’ and the intercept ’b’ can be set to a non−default value if necessary, otherwise m=1.8 and b=−0.6. To alter these parameters, e.g. m=1.9 and b=−0.7, use a parameter string like this: −−shapeMethod="Dm1.9b−0.7". You may also provide only one of the two parameters like: −−shapeMethod="Dm1.9" or −−shapeMethod="Db−0.7".

’Z’: Convert SHAPE reactivities to pseudo energies according to Zarringhalam et al 2012. SHAPE reactivities will be converted to pairing probabilities by using linear mapping. Aberration from the observed pairing probabilities will be penalized during the folding recursion. The magnitude of the penalties can affected by adjusting the factor beta (e.g. −−shapeMethod="Zb0.8").

’W’: Apply a given vector of perturbation energies to unpaired nucleotides according to Washietl et al 2012. Perturbation vectors can be calculated by using RNApvmin.


+ [optional parameters] Specify the method used to convert SHAPE

reactivities to pairing probabilities when using the SHAPE approach of Zarringhalam et al.


The following methods can be used to convert SHAPE reactivities into the probability for a certain nucleotide to be unpaired.

’M’: Use linear mapping according to Zarringhalam et al. ’C’: Use a cutoff−approach to divide into paired and unpaired nucleotides (e.g. "C0.25") ’S’: Skip the normalizing step since the input data already represents probabilities for being unpaired rather than raw reactivity values ’L’: Use a linear model to convert the reactivity into a probability for being unpaired (e.g. "Ls0.68i0.2" to use a slope of 0.68 and an intercept of 0.2) ’O’: Use a linear model to convert the log of the reactivity into a probability for being unpaired (e.g. "Os1.6i−2.29" to use a slope of 1.6 and an intercept of −2.29)


Specify stabilizing effect of ligand binding to

a particular sequence/structure motif.

Some ligands binding to RNAs require and/or induce particular sequence and structure motifs. For instance they bind to an interior loop, or small hairpin loop. If for such cases a binding free energy is known, the binding and therefore stabilizing effect of the ligand can be included in the folding recursions. Interior loop motifs are specified as concatenations of 5’ and 3’ motif, separated by an ’&’ character.

Energy contributions must be specified in kcal/mol.

See the manpage for an example usage of this option.


Select additional algorithms which should be included in the calculations. The Minimum free energy (MFE) and a structure representative are calculated in any case.

−p, −−partfunc[=INT]

Calculate the partition function and base pairing probability matrix.


In addition to the MFE structure we print a coarse representation of the pair probabilities in form of a pseudo bracket notation followed by the ensemble free energy. This notation makes use 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. On the next line the centroid structure as derived from the pair probabilities together with its free energy and distance to the ensemble is shown. Finally it prints the frequency of the mfe structure, and the structural diversity (mean distance between the structures in the ensemble). See the description of pf_fold() and mean_bp_dist() and centroid() in the RNAlib documentation for details. Note that unless you also specify −d2 or −d0, the partition function and mfe calculations will use a slightly different energy model. See the discussion of dangling end options below.

An additionally passed value to this option changes the behavior of partition function calculation: −p0 Calculate the partition function but not the pair probabilities, saving about 50% in runtime. This prints the ensemble free energy −kT ln(Z). −p2 Compute stack probabilities, i.e. the probability that a pair (i,j) and the immediately interior pair (i+1,j−1) are formed simultaneously in addition to pair probabilities. A second postscript dot plot called "", or "" (if the sequence does not have a name), is produced that contains pair probabilities in the upper right half and stack probabilities in the lower left.


Calculate an MEA (maximum expected accuracy) structure, where the expected accuracy is computed from the pair probabilities: each base pair (i,j) gets a score 2*gamma*p_ij and the score of an unpaired base is given by the probability of not forming a pair.


The parameter gamma tunes the importance of correctly predicted pairs versus unpaired bases. Thus, for small values of gamma the MEA structure will contain only pairs with very high probability. Using −−MEA implies −p for computing the pair probabilities.

−S, −−pfScale=scaling factor

In the calculation of the pf use scale*mfe as an estimate for the ensemble free energy (used to avoid overflows).

The default is 1.07, useful values are 1.0 to 1.2. Occasionally needed for long sequences. You can also recompile the program to use double precision (see the README file).

−c, −−circ

Assume a circular (instead of linear) RNA molecule.



Return exactly one stochastically backtracked structure


This function computes the partition function and returns exactly one secondary structure stochastically sampled from the Boltzmann equilibrium according to its probability in the ensemble


Set the threshold for base pair probabilities included in the postscript output


By setting the threshold the base pair probabilities that are included in the output can be varied. By default only those exceeding 1e−5 in probability will be shown as squares in the dot plot. Changing the threshold to any other value allows for increase or decrease of data.

−g, −−gquad

Incoorporate G−Quadruplex formation into the structure prediction algorithm


Model Details:
, −−temp=DOUBLE

Rescale energy parameters to a temperature of temp C. Default is 37C.

−4, −−noTetra

Do not include special tabulated stabilizing energies for tri−, tetra− and hexaloop hairpins. Mostly for testing.


−d, −−dangles=INT

How to treat "dangling end" energies for bases adjacent to helices in free ends and multi−loops


With −d1 only unpaired bases can participate in at most one dangling end, this is the default for mfe folding but unsupported for the partition function folding.

With −d2 this check is ignored, dangling energies will be added for the bases adjacent to a helix on both sides in any case; this is the default for partition function folding (−p). The option −d0 ignores dangling ends altogether (mostly for debugging). With −d3 mfe folding will allow coaxial stacking of adjacent helices in multi−loops. At the moment the implementation will not allow coaxial stacking of the two interior pairs in a loop of degree 3 and works only for mfe folding.

Note that by default (as well as with −d1 and −d3) pf and mfe folding treat dangling ends differently. Use −d2 in addition to −p to ensure that both algorithms use the same energy model.


Produce structures without lonely pairs (helices of length 1).


For partition function folding this only disallows pairs that can only occur isolated. Other pairs may still occasionally occur as helices of length 1.


Do not allow GU pairs



Do not allow GU pairs at the end of helices


−P, −−paramFile=paramfile

Read energy parameters from paramfile, instead of using the default parameter set.

A sample parameter file should accompany your distribution. See the RNAlib documentation for details on the file format.


Allow other pairs in addition to the usual AU,GC,and GU pairs.

Its argument is a comma separated list of additionally allowed pairs. If the first character is a "−" then AB will imply that AB and BA are allowed pairs. e.g. RNAfold −nsp −GA will allow GA and AG pairs. Nonstandard pairs are given 0 stacking energy.

−e, −−energyModel=INT

Rarely used option to fold sequences from the artificial ABCD... alphabet, where A pairs B, C−D etc. Use the energy parameters for GC (−e 1) or AU (−e 2) pairs.


Set the scaling of the Boltzmann factors (default=‘1.’)

The argument provided with this option enables to scale the thermodynamic temperature used in the Boltzmann factors independently from the temperature used to scale the individual energy contributions of the loop types. The Boltzmann factors then become exp(−dG/(kT*betaScale)) where k is the Boltzmann constant, dG the free energy contribution of the state and T the absolute temperature.


Single line sequence input and calculation of partition function and MEA structure

  $ RNAfold --MEA -d2 -p

The program will then prompt for sequence input. Using the example sequence "CGACGTAGATGCTAGCTGACTCGATGC" and pressing ENTER the output of the program will be similar to

   minimum free energy =  -1.90 kcal/mol
   free energy of ensemble =  -2.86 kcal/mol
  (((.(.((.......))..)))).... {  0.80 d=2.81}
  (((.((((.......))).)))).... { -1.90 MEA=22.32}
   frequency of mfe structure in ensemble 0.20997; ensemble diversity 4.19

Here, the first line just repeats the sequence input. The second line contains a MFE structure in dot bracket notation followed by the minimum free energy. After this, the pairing probabilities for each nucleotide are shown in a pseudo dot-bracket notation followed by the free energy of ensemble. The next two lines show the centroid structure with its free energy and its distance to the ensemble as well as the MEA structure, its free energy and the maximum expected accuracy, respectively. The last line finally contains the frequency of the MFE representative in the complete ensemble of secondary structures and the ensemble diversity. For further details about the calculation and interpretation of the given output refer to the reference manual of RNAlib.

Since version 2.0 it is also possible to provide FASTA file sequence input. Assume you have a file containing two sequences in FASTA format, e.g

  $ cat sequences.fa

In order to compute the MFE for the two sequences the user can use the following command

  $ RNAfold < sequences.fa

which would result in an output like this

  .((.(((...((((..(((((........)))))))))...))).))................... ( -5.40)
  .......((((..............))))........................... ( -2.00)

Secondary structure constraints may be given in addition to the sequence information, too. Using the first sequence of the previous example and restricting the nucleotides of the outermost helix to be unpaired, i.e. base pairs (2,47) and (3,46) the input file should have the following form

  $ cat sequence_unpaired.fa

Calling RNAfold with the structure constraint option -C it shows the following result

  $ RNAfold -C < sequence_unpaired.fa
  ....(((...((((..(((((........)))))))))...)))...................... ( -4.20)

This represents the minimum free energy and a structure representative of the RNA sequence given that nucleotides 2,3,46 and 47 must not be involved in any base pair. For further information about constrained folding refer to the details of the -C option and the reference manual of RNAlib.


Ivo L Hofacker, Walter Fontana, Sebastian Bonhoeffer, Peter F Stadler, Ronny Lorenz


If you use this program in your work you might want to cite:

R. Lorenz, S.H. Bernhart, C. Hoener zu Siederdissen, H. Tafer, C. Flamm, P.F. Stadler and I.L. Hofacker (2011), "ViennaRNA Package 2.0", Algorithms for Molecular Biology: 6:26

I.L. Hofacker, W. Fontana, P.F. Stadler, S. Bonhoeffer, M. Tacker, P. Schuster (1994), "Fast Folding and Comparison of RNA Secondary Structures", Monatshefte f. Chemie: 125, pp 167-188

M. Zuker, P. Stiegler (1981), "Optimal computer folding of large RNA sequences using thermodynamic and auxiliary information", Nucl Acid Res: 9, pp 133-148

J.S. McCaskill (1990), "The equilibrium partition function and base pair binding probabilities for RNA secondary structures", Biopolymers: 29, pp 1105-1119

I.L. Hofacker & P.F. Stadler (2006), "Memory Efficient Folding Algorithms for Circular RNA Secondary Structures", Bioinformatics

A.F. Bompfuenewerer, R. Backofen, S.H. Bernhart, J. Hertel, I.L. Hofacker, P.F. Stadler, S. Will (2007), "Variations on {RNA} Folding and Alignment: Lessons from Benasque", J. Math. Biol.

D. Adams (1979), "The hitchhiker’s guide to the galaxy", Pan Books, London

The calculation of mfe structures is based on dynamic programming algorithm originally developed by M. Zuker and P. Stiegler. The partition function algorithm is based on work by J.S. McCaskill.

The energy parameters are taken from:

D.H. Mathews, M.D. Disney, D. Matthew, J.L. Childs, S.J. Schroeder, J. Susan, M. Zuker, D.H. Turner (2004), "Incorporating chemical modification constraints into a dynamic programming algorithm for prediction of RNA secondary structure", Proc. Natl. Acad. Sci. USA: 101, pp 7287-7292

D.H Turner, D.H. Mathews (2009), "NNDB: The nearest neighbor parameter database for predicting stability of nucleic acid secondary structure", Nucleic Acids Research: 38, pp 280-282


If in doubt our program is right, nature is at fault.
Comments should be sent to