Skip to content

kroy3/rnaview

Repository files navigation

RNAview

A Comprehensive Python Package for RNA Structure Visualization and Analysis

PyPI version 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.

πŸ”— Google Colab notebook: https://colab.research.google.com/drive/1cPzGUo8tK8F6tX7aTd6WlOMl-yY0iDIi?usp=sharing

πŸ“Έ 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 = {Kushal Raj Roy},
  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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors