01: Basic usage (quick start)

Make a basic RNA transcript structure plot

[18]:
import RNApysoforms as RNApy
[19]:
## Path to your ENSEMBL GTF file
ensembl_gtf_path = "../dash_apps/RNApysoforms/tests/test_data/Homo_sapiens_chr21_and_Y.GRCh38.110.gtf"


## Read ENSEMBL gtf
annotation = RNApy.read_ensembl_gtf(ensembl_gtf_path)


## Filter gene name in annotation and counts matrix
sod1_annotation = RNApy.gene_filtering(annotation=annotation, target_gene="SOD1")

sod1_annotation.head()
[19]:
shape: (5, 11)
gene_idgene_nametranscript_idtranscript_nametranscript_biotypeseqnamesstrandtypestartendexon_number
strstrstrstrstrstrstrstri64i64i64
"ENSG00000142168""SOD1""ENST00000389995""SOD1-202""protein_coding""21""+""exon"31659666316597841
"ENSG00000142168""SOD1""ENST00000389995""SOD1-202""protein_coding""21""+""CDS"31659770316597841
"ENSG00000142168""SOD1""ENST00000389995""SOD1-202""protein_coding""21""+""exon"31663790316638862
"ENSG00000142168""SOD1""ENST00000389995""SOD1-202""protein_coding""21""+""CDS"31663790316638862
"ENSG00000142168""SOD1""ENST00000389995""SOD1-202""protein_coding""21""+""exon"31666449316665183
[20]:
## Make introns
sod1_annotation = RNApy.to_intron(sod1_annotation)

sod1_annotation.head()
[20]:
shape: (5, 11)
gene_idgene_nametranscript_idtranscript_nametranscript_biotypeseqnamesstrandtypestartendexon_number
strstrstrstrstrstrstrstri64i64i64
"ENSG00000142168""SOD1""ENST00000270142""SOD1-201""protein_coding""21""+""exon"31659693316598411
"ENSG00000142168""SOD1""ENST00000270142""SOD1-201""protein_coding""21""+""CDS"31659770316598411
"ENSG00000142168""SOD1""ENST00000270142""SOD1-201""protein_coding""21""+""intron"31659841316637901
"ENSG00000142168""SOD1""ENST00000270142""SOD1-201""protein_coding""21""+""CDS"31663790316638862
"ENSG00000142168""SOD1""ENST00000270142""SOD1-201""protein_coding""21""+""exon"31663790316638862
[21]:
## Create traces for plotting
traces = RNApy.make_traces(annotation=sod1_annotation, y='transcript_id', annotation_hue="transcript_biotype")

## Put traces into figure
fig = RNApy.make_plot(traces = traces, subplot_titles = ["Transcript Structure"], width=1200, height=500)

## Show figure
fig.show()

You can click on the legend items to make figure elements appear and disappear.

The legend title will get grayed out when clicking on the first legend item. I could not find a workaround for that with the current plotly release (version 5).

The hovering for exons and CDS works best if you hover your mouse over the edges of the CDS/exon boxes.