Skip to main content
License: ViennaRNA is licensed under Custom (ViennaRNA Package License) and may require explicit attribution when utilized. Please refer to the license for full terms.

Proto is not affiliated with TBI Vienna. This toolkit is open source and builds on the implementation produced by this organization. Product names, logos, and trademarks are the property of their respective owners.


ViennaRNA/ViennaRNA
ViennaRNA/ViennaRNA
The ViennaRNA Package
393 stars
View repo
ViennaRNA Package 2.0
Ronny Lorenz, Stephan H Bernhart, … Ivo L Hofacker
Algorithms for Molecular Biology (2011)
Read paper
@article{lorenz2011viennarna,
  title={ViennaRNA Package 2.0},
  author={Lorenz, Ronny and Bernhart, Stephan H and H{\"o}ner zu Siederdissen, Christian and Tafer, Hakim and Flamm, Christoph and Stadler, Peter F and Hofacker, Ivo L},
  journal={Algorithms for Molecular Biology},
  volume={6},
  number={1},
  pages={26},
  year={2011},
  publisher={BioMed Central},
  doi={10.1186/1748-7188-6-26}
}
Copy citation
proto-bio/proto-tools/proto_tools/tools/structure_prediction/viennarna
View source
Open Notebook
Open notebook
FunctionDescription
run_viennarna()RNA secondary structure prediction using ViennaRNA MFE folding Docs Source

Background

ViennaRNA (Lorenz et al., 2011) predicts the secondary structure of a nucleic-acid sequence: the set of intramolecular base pairs that form within a single strand. Secondary structure sits between sequence and three-dimensional shape and governs how many functional RNAs behave, so predicting it from sequence alone is a core step in RNA analysis and design. Internally, ViennaRNA folds each sequence with the minimum-free-energy dynamic program at the core of RNAfold (cubic in the sequence length) under a nearest-neighbor thermodynamic model. RNA sequences use the Turner 2004 parameters. Selecting the DNA option instead loads the Mathews 2004 DNA parameters. The predicted structure is returned in dot-bracket notation together with its minimum free energy in kcal/mol, where a more negative value indicates a more stable predicted fold. Because it is a thermodynamic rather than a learned method, it is deterministic, runs on CPU, and predicts secondary structure only, not three-dimensional coordinates. The reference implementation is the ViennaRNA Package, maintained by TBI Vienna at ViennaRNA/ViennaRNA.

Learning Resources

Tools

ViennaRNA Secondary Structure Prediction (viennarna-prediction)

Folds each input sequence to its minimum-free-energy secondary structure, returning the structure in dot-bracket notation and the minimum free energy in kcal/mol for every sequence.

API Reference

Source
sequences
List[string]
required
List of RNA sequences to fold. Each sequence should contain only valid RNA nucleotides (A, U, G, C) or DNA nucleotides (A, T, G, C) which will be automatically converted to RNA (T -> U). Lowercase letters are also accepted.
Source
temperature
number
default:"37.0"
Temperature in Celsius for energy calculations. Affects the thermodynamic parameters used in folding. Default: 37.0 (physiological temperature).
use_dna_params
boolean
default:"False"
Whether to use DNA energy parameters instead of RNA parameters. When True, loads DNA_Mathews2004 parameters.
no_lonely_pairs
boolean
default:"False"
Disallow lonely base pairs (helices of length 1). This can reduce artifacts in structure prediction. Default: False.
dangles
enum
default:"2"
Dangling-end treatment.Available options: 0, 1, 2, 3
circ
boolean
default:"False"
Treat as circular RNA. Default False.
max_bp_span
integer
default:"-1"
Max base-pair span; positive values forbid long-range pairing.
verbose
integer
default:"0"
Verbosity level (0=quiet, 1=info, 2=debug, 3=raw subprocess stderr). True is coerced to 1 and False to 0.
device
string
default:"cpu"
Device to run the tool on.
timeout
integer
default:"600"
Maximum execution time in seconds. None waits indefinitely.
seed
integer
Random seed. When set, tools run reproducibly up to small GPU float noise (see BaseToolOutput.approx_equal), and the seed participates in cache keys. When None, cacheable seed-sensitive tools skip cache until seeded.
Source
results
List[ViennaRNAResult]
required
List of fold results, one per input sequence. Each result contains the sequence, predicted structure in dot-bracket notation, and the minimum free energy.

Applications

Use this to predict the base-pairing of mRNAs, non-coding RNAs, riboswitches, aptamers, or designed RNA constructs from sequence alone, for example to check whether a designed UTR or guide RNA folds as intended, or to rank candidate sequences by the stability of their predicted fold.

Usage Tips

  • temperature (default 37.0, degrees Celsius) sets the folding temperature. The energy model is temperature-dependent, so the predicted structure and free energy change with it. Keep the default for physiological predictions and change it to model other conditions.
  • use_dna_params (default False) also changes how the input is read. When False, any T in a sequence is converted to U and the sequence is folded as RNA with the Turner 2004 parameters. Set it True to fold the sequence as DNA with the Mathews 2004 DNA parameters and no T-to-U conversion.
  • Set circ to True for circular molecules. Plasmids, viroids, and circular RNAs fold differently from linear strands, and the default treats the sequence as linear.
  • no_lonely_pairs (default False) forbids isolated base pairs. Enabling it removes length-one helices, which often yields more physically realistic structures.
  • max_bp_span (default -1, unlimited) caps the base-pair span. Set a positive value to forbid long-range pairs, which is useful for very long sequences or local-structure analysis.

Toolkit Notes

These apply to every ViennaRNA tool in this toolkit (viennarna-prediction).
  • Runs on CPU. ViennaRNA is a fast C package and does not use a GPU. Folding is near-instant for typical sequences, and runtime grows as the cube of sequence length, so very long inputs are slower.
  • Predicts secondary structure only. The output is a base-pairing pattern and a free energy, not three-dimensional atomic coordinates; use a tertiary-structure method when 3D is needed.
Example notebook: See the full working example for a copy-paste-ready walkthrough.

Infrastructure Guides

The following guides cover how to run tools efficiently and at scale.

Tool Persistence

Keep a tool’s model warm across calls instead of reloading it every invocation.

Device Management

How GPUs are allocated to tools and how to target specific devices.

Parallel Execution

Fan a batch of inputs out across multiple GPUs.

Cloud Inference

Run tools on managed cloud infrastructure with no local setup.