MultiStructRNA is a unified Python interface for RNA secondary structure prediction using multiple state-of-the-art algorithms. It provides a consistent API for predicting RNA secondary structures, calculating thermodynamic properties, and visualizing results.
- Unified API: Single interface for multiple prediction algorithms
- Multiple Algorithms: Support for LinearFold, LinearPartition, ViennaRNA, and RNAstructure
- SHAPE Support: Incorporate experimental SHAPE reactivity data
- Visualization: Generate publication-ready structure plots
- Metrics: Calculate thermodynamic properties and structural metrics
- CLI: Command-line interface for quick predictions
| Algorithm | Type | Description |
|---|---|---|
linearfold |
MFE | Fast linear-time MFE structure prediction |
linearpartition |
Partition | Fast linear-time partition function calculation |
viennafold |
MFE | ViennaRNA MFE structure prediction |
viennapartition |
Partition | ViennaRNA partition function calculation |
rnastructurefold |
MFE | RNAstructure MFE prediction |
rnastructurepartition |
Partition | RNAstructure partition function |
pixi install
pixi run setup-deps # Install external binariespip install multistructrna
multistructrna setup # Install external binariesuv pip install multistructrnagit clone https://github.com/modernatx/multistructrna.git
cd multistructrna
pip install -e ".[dev]"Some algorithms require external binaries. Run the setup command to install them:
multistructrna setupThis will install:
- LinearFold/LinearPartition: Cloned and compiled from GitHub
- ViennaRNA: Check installation (install via conda:
conda install -c bioconda viennarna) - RNAstructure: Instructions for manual installation
MXFold2 is optional. For the most stable baseline setup:
multistructrna setup --no-mxfold2If you need MXFold2 later, follow the dedicated environment instructions in
docs/howto/installation.md.
from multistructrna import MSRNA
# Create an RNA object
rna = MSRNA(seq="GUCACUAGUCCCAUUUCCUUGGCCUGAAAUGGUUUGUGAGGAGUCCGCGU", name="my_sequence")
# Predict structure using LinearPartition
rna.predict(algorithm="linearpartition", output_dir="/tmp")
# Access results
print(f"Structure: {rna.dotbracket}")
print(f"Free Energy of Ensemble: {rna.fee} kcal/mol")
print(f"Average Unpaired Probability: {rna.aup:.4f}")
print(f"Maximum Ladder Distance: {rna.mld}")
# Visualize the structure
rna.plot(plot_type="secondary_structure", output_dir="./output", show=True)# Predict with SHAPE reactivity constraints
rna.predict(
algorithm="linearpartition",
output_dir="/tmp",
shape="/path/to/shape_file.shape",
)# Predict structure
multistructrna predict AUGCUAGCUAGCUAGC --algorithm linearfold
# Predict with options
multistructrna predict AUGCUAGCUAGCUAGC \
--algorithm linearpartition \
--name my_sequence \
--output-dir ./results \
--temperature 37.0
# Show version
multistructrna versionDepending on the algorithm, MultiStructRNA provides:
| Metric | Description | Algorithms |
|---|---|---|
dotbracket |
Secondary structure in dot-bracket notation | All |
mfe |
Minimum Free Energy (kcal/mol) | Fold algorithms |
fee |
Free Energy of Ensemble (kcal/mol) | Partition algorithms |
aup |
Average Unpaired Probability | Partition algorithms |
mld |
Maximum Ladder Distance | All |
bpps_matrix |
Base Pair Probability Matrix | Partition algorithms |
avg_shannon_entropy |
Average Shannon Entropy | Partition algorithms |
For full documentation, visit the docs directory or run:
mkdocs serve# Using pixi
pixi install -e dev
pixi run test
# Using pip
pip install -e ".[dev]"
pytest tests/pytest tests/ -v# Format code
black multistructrna tests
# Lint code
ruff check multistructrna tests
# Type checking
mypy multistructrnaIf you use MultiStructRNA in your research, please cite:
@software{multistructrna,
title = {MultiStructRNA: A Unified Interface for RNA Secondary Structure Prediction},
author = {Jadeja, Yashrajsinh},
year = {2024},
url = {https://github.com/modernatx/multistructrna}
}Please also cite the underlying tools you use:
- LinearFold/LinearPartition: Huang et al., 2019
- ViennaRNA: Lorenz et al., 2011
- RNAstructure: Mathews Lab
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- LinearFold/LinearPartition: Liang Huang Lab
- ViennaRNA: TBI Vienna
- RNAstructure: Mathews Lab, University of Rochester
- RiboGraphViz: Das Lab, Stanford
- RNAvigate: Weeks Lab, UNC Chapel Hill