Skip to main content

A comprehensive Python package for RNA structure visualization and analysis

Project description

RNAview

A Comprehensive Python Package for RNA Structure Visualization and Analysis

PyPI version Python versions License


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

Layout Comparison

RNAview supports radiate and circular layouts for both simple hairpins and complex structures like tRNA.

Arc Diagram Representations

Arc Diagrams

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

Color Schemes

Choose from multiple color schemes including nucleotide-based, ViennaRNA-style, pastel, colorblind-friendly, monochrome, and publication-ready options.

Structure Comparison with Metrics

Structure Comparison

Compare predicted and reference structures with comprehensive accuracy metrics (Sensitivity, PPV, F1 Score, MCC).

RNA Modification Support

RNA Modifications

Full support for highlighting RNA modifications including m6A, m5C, pseudouridine, and 70+ other modifications.

Publication-Quality Figures

Publication Figure

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.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rnaview-1.0.1.tar.gz (74.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rnaview-1.0.1-py3-none-any.whl (72.1 kB view details)

Uploaded Python 3

File details

Details for the file rnaview-1.0.1.tar.gz.

File metadata

  • Download URL: rnaview-1.0.1.tar.gz
  • Upload date:
  • Size: 74.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for rnaview-1.0.1.tar.gz
Algorithm Hash digest
SHA256 727262b63a78b4f0775ef75eb56a70403b0873c8da9581947f1d3a750392baaa
MD5 bbdb901097aad08c94cca7edaea50778
BLAKE2b-256 8e4011062cff7cf1460332aeaee52e1bcb87cdadab0b659789e65d8e3a6811dd

See more details on using hashes here.

File details

Details for the file rnaview-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: rnaview-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 72.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for rnaview-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7355cbf99999c26606a6f851721f11ad9bcceabe425a37d191f6cbe217c9ff97
MD5 ea05fc48989db9c6dc8e847e0651cde8
BLAKE2b-256 b95d36f878f3d29a5a62f9bba550733fbbdeac6f1be08d54bfca5acf3c7a1325

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page