This Tool creates a visualization for any working inter- and intramolecular structure and sequence involving one or two molecules, using FornaC.
Example interaction between the molecule MicF and IpxR, displayed in this paper also generated using vaRRI
./rna_to_img.py -o=example.svg --startIndex1=67 --sequence="GCCAGUAGCCUUGCUAUUUCAGUGGCGAAUGAUGAUGCAGGU&GCUAUCAUCAUUAACUUUAUUUAU" --structure="...(((((............(((....(((((((((((....&)).))))))))).))))))))..." --accessibility1="RNAplfold" --accessibility2="RNAplfold"
We need to install
- playwright (tested and developed with v1.57.0)
- chromium browser (install via playwright)
# install dependencies
python3 -m pip install playwright==1.57.0
python3 -m playwright install chromium
# check version
python3 -m playwright --version
--structure Specifies the RNA secondary structure in dot-bracket notation.
| Notation |
Meaning |
( ) |
Base pair |
[ ] |
Alternative bracket pair |
< > |
Alternative bracket pair |
{ } |
Alternative bracket pair |
. |
Unpaired nucleotide |
& |
Separator between two molecules (intermolecular interaction) |
intramolecular:
rna_to_img.py \
-u="((...))...." \
-e="NNNNNNNNNNN"
|
|
intermolecular:
rna_to_img.py \
-u="((...))..<<..&...>>.." \
-e="NNNNNNNNNNNNN&NNNNNNN"
|
|
Hybrid Input Format (Advanced)
The hybrid input format provides a convenient way to specify intermolecular base pairing interactions using position indices instead of dot-bracket notation.
Format:
<start_pos_1><pipes_and_dots>&<start_pos_2><pipes_and_dots>
Where:
<start_pos>: Starting position (index, can be negative, can not be 0)
|: Represents a base pair in the intermolecular interaction
.: Represents an unpaired position within the interaction region
How it works:
- Both molecules must have the same number of
| characters (representing the same number of base pairs)
- Interaction positions are defined relative to your sequence start Index
- The tool automatically converts hybrid input to standard dot-bracket notation
Example (simple interaction):
Two sequences with interaction starting at position 5 (seq1) and position 3 (seq2) and each has 3 intermolecular base pairs
./rna_to_img.py \
-u="5|||..&3|||.." \
-e="NNNNNNNNNNNNN&NNNNNNN"
|
|
Example (with custom start Index)
Start indexing from position 10 (seq1) and 100 (seq2)
Interaction starts at position 15 (seq1) and 102 (seq2)
rna_to_img.py \
-u="15|||..&102|||.." \
-e="NNNNNNNNNNNNN&NNNNNNN" \
-i1=10 \
-i2=100
|
|
Example (negative positions):
start indexing form -10 (seq1) and 1 (seq2)
Interaction starts at position -5 (seq1) and 3 (seq2)
rna_to_img.py \
-u="-5|||..&3|||.." \
-e="NNNNNNNNNNNNN&NNNNNNN" \
-i1=-10 \
-i2=1
|
|
Hybrid vs. Dot-Bracket Comparison:
These two commands are equivalent:
Hybrid format:
rna_to_img.py \
-u="5|||..&3|||" \
-e="NNNNNNNNNNNNNN&NNNNN"
|
|
Equivalent dot-bracket format:
rna_to_img.py \
-u="....(((......&..))).." \
-e="NNNNNNNNNNNNN&NNNNNNN"
|
|
--sequence Specifies the RNA sequence using IUPAC nucleotide codes (see also --fastafile)
| Code |
Nucleotide |
Code |
Nucleotide |
A |
Adenosine |
N |
Any nucleotide |
C |
Cytidine |
W |
Adenosine or Uridine |
G |
Guanosine |
S |
Cytidine or Guanosine |
U |
Uridine |
K |
Guanosine or Uridine |
|
|
& |
Separator between two molecules |
Example:
rna_to_img.py -u=".((...))." -e="AACGAGUGA"
|
|
-o/ --output Specifies the output file name and format
| Value |
Description |
STDOUT (default) |
Print SVG to standard output |
filename |
Save as SVG with given name |
filename.png |
Save as PNG with given name |
Examples:
# Output to stdout
rna_to_img.py -u="((...))." -e="ACGAGUGA" > output.svg
# Save as SVG file
rna_to_img.py -u="((...))." -e="ACGAGUGA" -o=structure
# Save as PNG file
rna_to_img.py -u="((...))." -e="ACGAGUGA" -o=structure.png
-c/ --coloring Defines how nucleotides should be colored
| Option |
Description |
Example |
loop |
Standard fornac coloring scheme |
|
strand (default) |
Each molecule receives its own color |
 |
Example:
rna_to_img.py \
-u="((...))..<<..&...>>.." \
-e="NNNNNNNNNNNNN&NNNNNNN" \
-c=strand
|
|
-H/ --highlighting Specifies the highlighting mode for intermolecular structures
|
Option
|
Example Image
|
nothing: no sepcial highlighting
rna_to_img.py \
-u="((...))..<<....<<..&..>>...>>.." \
-e="NNNNNNNNNNNNNNNNNNN&NNNNNNNNNNN" \
-H=nothing \
-c=loop
|
|
basepairs: Highlights only individual intermolecular base pairs
rna_to_img.py \
-u="((...))..<<....<<..&..>>...>>.." \
-e="NNNNNNNNNNNNNNNNNNN&NNNNNNNNNNN" \
-H=basepairs
|
|
region(default): Highlights entire intermolecular interaction region
rna_to_img.py \
-u="((...))..<<....<<..&..>>...>>.." \
-e="NNNNNNNNNNNNNNNNNNN&NNNNNNNNNNN" \
-H=region
|
|
-bH/ --backgroundhighlighting Specifies the background highlighting mode for intermolecular interactions
| Option |
Description |
nothing |
no background highlighting |
basepairs (default) |
highlights intermolecular basepair stacking |
region |
highlights the full intermolecular interaction region |
rna_to_img.py \
--structure="((...))..<<..&...>>.." \
--sequence="NNNNNNNNNNNNN&NNNNNNN" \
-bH=region
-i1/ --startIndex1, -i2/ --startIndex2 Sets the starting index for each molecule
| Parameter |
Constraint |
| Default |
1 |
| Restriction |
Cannot be 0 |
Example: Indexing starts with 10
rna_to_img.py \
-u="..((...))." \
-e="AAACGAGUGA" \
-i1=10
|
|
Example: Both molecules have different start indicies
rna_to_img.py \
-u="((...))..<<..&...>>.." \
-e="NNNNNNNNNNNNN&NNNNNNN" \
-i1=5 \
-i2=100
|
|
-v/ --verbose
Enables detailed logging output for debugging and troubleshooting
./rna_to_img.py -u="((...))." -e="ACGAGUGA" -v
-l/ --labelInterval Defines how often labels with indices are displayed
| Option |
Description |
| n |
Shows index labels every n nucleotides |
10 |
default |
rna_to_img.py \
-u="((...))....((...))" \
-e="ACGAGUGAACGAGUGA" \
-l=5
--crop, --crop1, --crop2 Crops sequences around the intermolecular interaction region
| Parameter |
Description |
--crop |
Applies cropping to both molecules |
--crop1 |
Crops only the first molecule |
--crop2 |
Crops only the second molecule |
rna_to_img.py \
-u="((...))..<<..&...>>.." \
-e="NNNNNNNNNNNNN&NNNNNNN" \
--crop=5
--highlightSubseq1, --highlightSubseq2 Highlights specific subsequences
| Parameter |
Description |
--highlightSubseq1 |
Subsequences in first molecule |
--highlightSubseq2 |
Subsequences in second molecule |
rna_to_img.py \
-u="((...))..<<..&...>>.." \
-e="NNNNNNNNNNNNN&NNNNNNN" \
--highlightSubseq1="1:2,5:10"
--guBasepairs Controls visualization of G-U base pairs
| Option |
Description |
| Enabled (default) |
G-U basepairs shown as dashed lines |
| Disabled |
No special visualization |
rna_to_img.py \
-u="((...))" \
-e="GUGUGUGU" \
--guBasepairs
--fastafile Load one or two sequences from a FASTA file
rna_to_img.py \
--fastafile=example.fasta \
-u="((...))"
--predictStructure1, --predictStructure2 Enable intramolecular structure prediction
| Flag Option |
Description |
| Enabled |
Predict intramolecular structure for each molecule. Using RNAfold with constraints: --structure given Basepairs |
| Disabled (default) |
No structure prediction |
rna_to_img.py \
-e="ACGAGUGA" \
--predictStructure1
--animation Activates fornac’s force-directed layout animation
rna_to_img.py \
-u="((...))" \
-e="ACGAGUGA" \
--animation
--accessibility1, --accessibility2 Visualize nucleotide accessibility
| Option |
Description |
None (default) |
No visualization |
RNAplfold |
Predict accessibility using RNAplfold |
path/to/file |
Use precomputed lunp file |
rna_to_img.py \
-u="((...))" \
-e="ACGAGUGA" \
--accessibility1="RNAplfold"
--RNAfold Pass custom parameters to RNAfold
rna_to_img.py \
-e="ACGAGUGA" \
--predictStructure1 \
--RNAfold="-T20"
--RNAplfold Pass custom parameters to RNAplfold
rna_to_img.py \
-e="ACGAGUGA" \
--accessibility1="RNAplfold" \
--RNAplfold="-T20"
Simple Intramolecular Structure
Visualization of a single RNA molecule with one hairpin loop:
rna_to_img.py -u=".((...))." -e="AACGAGUGA" > hairpin.svg
|
|
Intermolecular Interaction with Distinct Coloring
Two molecules interacting where each molecule has its own color:
rna_to_img.py \
-u="((...))..<<..&...>>.." \
-e="NNNNNNNNNNNNN&NNNNNNN" \
-c=strand \
-o=interaction.svg
|
|
Custom Indexing
Start numbering from different positions for each molecule:
rna_to_img.py \
-u="((...))..<<..&...>>.." \
-e="NNNNNNNNNNNNN&NNNNNNN" \
-i1=5 -i2=100 \
-o=custom_index.svg
|
|
Pseudoknot Structure (Simple)
A basic pseudoknot involving two interacting molecules:
rna_to_img.py \
-u="<<<..((..>>>&<<<..))..>>>" \
-e="NNNNNNNNNNN&NNNNNNNNNNNN" \
-c=strand \
-o=pseudoknot_simple.svg
|
|
Pseudoknot Structure (Complex - Kissing Hairpins)
Two molecules forming a complex kissing hairpin interaction:
rna_to_img.py \
-u="<<<..(((..>>>...<<<..(((..>>>..&<<<..)))..>>>...<<<..)))..>>>.." \
-e="NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN&NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN" \
-c=strand \
-o=kissing_hairpins.svg
|
|