A comprehensive Python package for RNA structure visualization and analysis
Project description
RNAview
A Comprehensive Python Package for RNA Structure Visualization and Analysis
RNAview is a powerful, user-friendly Python library designed for researchers to visualize, analyze, and explore RNA secondary and tertiary structures. It provides seamless integration with established RNA structure prediction tools and includes gold-standard benchmark datasets for validation.
📸 Gallery
Multiple Visualization Layouts
RNAview supports radiate and circular layouts for both simple hairpins and complex structures like tRNA.
Arc Diagram Representations
Visualize RNA structures as arc diagrams - perfect for publications and showing base-pairing patterns clearly. Works seamlessly with hairpins, tRNA, and even complex pseudoknots.
Customizable Color Schemes
Choose from multiple color schemes including nucleotide-based, ViennaRNA-style, pastel, colorblind-friendly, monochrome, and publication-ready options.
Structure Comparison with Metrics
Compare predicted and reference structures with comprehensive accuracy metrics (Sensitivity, PPV, F1 Score, MCC).
RNA Modification Support
Full support for highlighting RNA modifications including m6A, m5C, pseudouridine, and 70+ other modifications.
Publication-Quality Figures
Create multi-panel publication-ready figures combining different visualization styles and RNA structures.
✨ Key Features
- 📊 Multiple Visualization Layouts: Radiate, circular, NAView, arc diagrams, and 3D views
- 🎨 Customizable Color Schemes: Nucleotide-based, colorblind-friendly, publication-ready
- 🧬 RNA Modifications: Full support for m6A, m5C, pseudouridine, and 70+ other modifications
- 📈 Comprehensive Analysis: Sensitivity, PPV, F1, MCC, and structural distance metrics
- 🔗 Tool Integration: ViennaRNA, LinearFold, CONTRAfold, and more
- 📁 Multiple File Formats: CT, BPSEQ, dot-bracket, PDB, mmCIF, FASTA, Stockholm
- 📚 Benchmark Datasets: Curated tRNA, 5S rRNA, and small RNA datasets
🚀 Installation
From PyPI
pip install rnaview
With Visualization Support
pip install rnaview[visualization]
Full Installation
pip install rnaview[full]
From Source
git clone https://github.com/kroy3/rnaview.git
cd rnaview
pip install -e .
📖 Quick Start
Creating and Visualizing an RNA Structure
import rnaview as rv
# Create from sequence and dot-bracket notation
rna = rv.RNAStructure(
sequence="GCGCUUAAGCGC",
dotbracket="((((....))))",
name="Simple_hairpin"
)
# Visualize in 2D
fig = rv.plot2d(rna, layout="radiate", color_scheme="nucleotide")
fig.savefig("structure.png")
# Print structure summary
print(rna.summary())
Loading from Files
import rnaview as rv
# Auto-detect format from extension
rna = rv.load_structure("structure.ct")
rna = rv.load_structure("structure.dbn")
rna = rv.load_structure("structure.pdb")
Structure Prediction
import rnaview as rv
# Predict structure (uses best available method)
sequence = "GCGCUUAAGCGC"
rna = rv.predict_structure(sequence)
# Use specific predictor
rna = rv.predict_structure(sequence, method="viennarna", temperature=37)
Creating Arc Diagrams
import rnaview as rv
rna = rv.load_structure("trna.ct")
# Create arc diagram
fig = rv.plot_arc(rna, show_sequence=True, color_scheme="nucleotide")
fig.savefig("trna_arc.png")
Adding RNA Modifications
import rnaview as rv
rna = rv.RNAStructure(
sequence="GCGCUUAAGCGC",
dotbracket="((((....))))"
)
# Add modifications
rna.add_modification(4, rv.Modification.m6A())
rna.add_modification(5, rv.Modification.pseudouridine())
# Visualize with modifications highlighted
fig = rv.plot2d(rna, show_modifications=True)
Comparing Structures
import rnaview as rv
reference = rv.load_structure("reference.ct")
predicted = rv.load_structure("predicted.ct")
# Calculate accuracy metrics
sensitivity = rv.sensitivity(reference, predicted)
ppv = rv.ppv(reference, predicted)
f1 = rv.f1_score(reference, predicted)
mcc = rv.mcc(reference, predicted)
print(f"Sensitivity: {sensitivity:.3f}")
print(f"PPV: {ppv:.3f}")
print(f"F1 Score: {f1:.3f}")
print(f"MCC: {mcc:.3f}")
# Visualize comparison
fig = rv.plot_comparison(reference, predicted)
fig.savefig("comparison.png")
📁 Supported File Formats
| Format | Extension | Read | Write | Description |
|---|---|---|---|---|
| Dot-bracket | .dbn, .db | ✅ | ✅ | Standard secondary structure notation |
| CT | .ct | ✅ | ✅ | Connectivity table format |
| BPSEQ | .bpseq | ✅ | ✅ | Base pair sequence format |
| PDB | .pdb | ✅ | ❌ | 3D structure format |
| mmCIF | .cif | ✅ | ❌ | Macromolecular CIF |
| FASTA | .fasta, .fa | ✅ | ✅ | Sequence format |
| Stockholm | .sto | ✅ | ❌ | Alignment format with structure |
🔌 Integration with Prediction Tools
| Tool | Type | Status |
|---|---|---|
| ViennaRNA (RNAfold) | Thermodynamic | ✅ Supported |
| LinearFold | Linear-time | ✅ Supported |
| CONTRAfold | Machine Learning | ✅ Supported |
| Fallback (built-in) | Basic DP | ✅ Always available |
🎨 Available Color Schemes
- nucleotide: Standard nucleotide colors (A=red, U=orange, G=green, C=blue)
- varna: ViennaRNA-style coloring
- pastel: Soft pastel colors for presentations
- colorblind: Colorblind-friendly palette
- monochrome: Grayscale for publications
- publication: High-contrast publication-ready colors
📚 Documentation
Full documentation is available at https://rnaview.readthedocs.io
See also the User Manual for comprehensive guides.
🤝 Contributing
Contributions are welcome! Please see our contributing guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
📖 Citation
If you use RNAview in your research, please cite:
@software{rnaview2025,
title = {RNAview: A Python Package for RNA Structure Visualization and Analysis},
author = {RNAview Development Team},
year = {2025},
url = {https://github.com/kroy3/rnaview}
}
🙏 Acknowledgments
- ViennaRNA package for thermodynamic calculations
- The RNA research community for valuable feedback
- Contributors and users who help improve RNAview
Made with ❤️ for the RNA research community
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters