{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## 02: Rescaled introns\n", "\n", "Make the plot prettier by rescaling introns into a smaller size" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import RNApysoforms as RNApy" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000270142
Feature Type: exon
Feature Number: 1
Chromosome: 21
Start: 31659693
End: 31659841
Size: 148
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "Transcript Structure Hue" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": true, "type": "scatter", "x": [ 29, 177, 177, 29, 29 ], "xaxis": "x", "y": [ -0.15, -0.15, 0.15, 0.15, -0.15 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000270142
Feature Type: exon
Feature Number: 2
Chromosome: 21
Start: 31663790
End: 31663886
Size: 96
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1431, 1527, 1527, 1431, 1431 ], "xaxis": "x", "y": [ -0.15, -0.15, 0.15, 0.15, -0.15 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000270142
Feature Type: exon
Feature Number: 3
Chromosome: 21
Start: 31666449
End: 31666518
Size: 69
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1628, 1697, 1697, 1628, 1628 ], "xaxis": "x", "y": [ -0.15, -0.15, 0.15, 0.15, -0.15 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000270142
Feature Type: exon
Feature Number: 4
Chromosome: 21
Start: 31667258
End: 31667375
Size: 117
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1798, 1915, 1915, 1798, 1798 ], "xaxis": "x", "y": [ -0.15, -0.15, 0.15, 0.15, -0.15 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000270142
Feature Type: exon
Feature Number: 5
Chromosome: 21
Start: 31668471
End: 31668931
Size: 460
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 2016, 2476, 2476, 2016, 2016 ], "xaxis": "x", "y": [ -0.15, -0.15, 0.15, 0.15, -0.15 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000389995
Feature Type: exon
Feature Number: 1
Chromosome: 21
Start: 31659666
End: 31659784
Size: 118
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 2, 120, 120, 2, 2 ], "xaxis": "x", "y": [ 0.85, 0.85, 1.15, 1.15, 0.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000389995
Feature Type: exon
Feature Number: 2
Chromosome: 21
Start: 31663790
End: 31663886
Size: 96
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1431, 1527, 1527, 1431, 1431 ], "xaxis": "x", "y": [ 0.85, 0.85, 1.15, 1.15, 0.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000389995
Feature Type: exon
Feature Number: 3
Chromosome: 21
Start: 31666449
End: 31666518
Size: 69
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1628, 1697, 1697, 1628, 1628 ], "xaxis": "x", "y": [ 0.85, 0.85, 1.15, 1.15, 0.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000389995
Feature Type: exon
Feature Number: 4
Chromosome: 21
Start: 31667258
End: 31667375
Size: 117
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1798, 1915, 1915, 1798, 1798 ], "xaxis": "x", "y": [ 0.85, 0.85, 1.15, 1.15, 0.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000389995
Feature Type: exon
Feature Number: 5
Chromosome: 21
Start: 31668471
End: 31668931
Size: 460
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 2016, 2476, 2476, 2016, 2016 ], "xaxis": "x", "y": [ 0.85, 0.85, 1.15, 1.15, 0.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#EF553B", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000470944
Feature Type: exon
Feature Number: 1
Chromosome: 21
Start: 31659709
End: 31660708
Size: 999
", "legendgroup": "protein_coding_CDS_not_defined", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding_CDS_not_defined", "opacity": 1, "showlegend": true, "type": "scatter", "x": [ 45, 1044, 1044, 45, 45 ], "xaxis": "x", "y": [ 1.85, 1.85, 2.15, 2.15, 1.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#EF553B", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000470944
Feature Type: exon
Feature Number: 2
Chromosome: 21
Start: 31663790
End: 31663886
Size: 96
", "legendgroup": "protein_coding_CDS_not_defined", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding_CDS_not_defined", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1431, 1527, 1527, 1431, 1431 ], "xaxis": "x", "y": [ 1.85, 1.85, 2.15, 2.15, 1.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#EF553B", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000470944
Feature Type: exon
Feature Number: 3
Chromosome: 21
Start: 31666449
End: 31666518
Size: 69
", "legendgroup": "protein_coding_CDS_not_defined", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding_CDS_not_defined", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1628, 1697, 1697, 1628, 1628 ], "xaxis": "x", "y": [ 1.85, 1.85, 2.15, 2.15, 1.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#EF553B", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000470944
Feature Type: exon
Feature Number: 4
Chromosome: 21
Start: 31667258
End: 31667375
Size: 117
", "legendgroup": "protein_coding_CDS_not_defined", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding_CDS_not_defined", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1798, 1915, 1915, 1798, 1798 ], "xaxis": "x", "y": [ 1.85, 1.85, 2.15, 2.15, 1.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#EF553B", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000470944
Feature Type: exon
Feature Number: 5
Chromosome: 21
Start: 31668471
End: 31668931
Size: 460
", "legendgroup": "protein_coding_CDS_not_defined", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding_CDS_not_defined", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 2016, 2476, 2476, 2016, 2016 ], "xaxis": "x", "y": [ 1.85, 1.85, 2.15, 2.15, 1.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#EF553B", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000476106
Feature Type: exon
Feature Number: 1
Chromosome: 21
Start: 31659693
End: 31659841
Size: 148
", "legendgroup": "protein_coding_CDS_not_defined", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding_CDS_not_defined", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 29, 177, 177, 29, 29 ], "xaxis": "x", "y": [ 2.85, 2.85, 3.15, 3.15, 2.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#EF553B", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000476106
Feature Type: exon
Feature Number: 2
Chromosome: 21
Start: 31661549
End: 31661734
Size: 185
", "legendgroup": "protein_coding_CDS_not_defined", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding_CDS_not_defined", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1145, 1330, 1330, 1145, 1145 ], "xaxis": "x", "y": [ 2.85, 2.85, 3.15, 3.15, 2.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#EF553B", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000476106
Feature Type: exon
Feature Number: 3
Chromosome: 21
Start: 31663790
End: 31663886
Size: 96
", "legendgroup": "protein_coding_CDS_not_defined", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding_CDS_not_defined", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1431, 1527, 1527, 1431, 1431 ], "xaxis": "x", "y": [ 2.85, 2.85, 3.15, 3.15, 2.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#EF553B", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000476106
Feature Type: exon
Feature Number: 4
Chromosome: 21
Start: 31666449
End: 31666518
Size: 69
", "legendgroup": "protein_coding_CDS_not_defined", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding_CDS_not_defined", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1628, 1697, 1697, 1628, 1628 ], "xaxis": "x", "y": [ 2.85, 2.85, 3.15, 3.15, 2.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#EF553B", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000476106
Feature Type: exon
Feature Number: 5
Chromosome: 21
Start: 31667258
End: 31667341
Size: 83
", "legendgroup": "protein_coding_CDS_not_defined", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding_CDS_not_defined", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1798, 1881, 1881, 1798, 1798 ], "xaxis": "x", "y": [ 2.85, 2.85, 3.15, 3.15, 2.85 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000270142
Feature Type: CDS
Feature Number: 1
Chromosome: 21
Start: 31659770
End: 31659841
Size: 71
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 106, 177, 177, 106, 106 ], "xaxis": "x", "y": [ -0.25, -0.25, 0.25, 0.25, -0.25 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000270142
Feature Type: CDS
Feature Number: 2
Chromosome: 21
Start: 31663790
End: 31663886
Size: 96
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1431, 1527, 1527, 1431, 1431 ], "xaxis": "x", "y": [ -0.25, -0.25, 0.25, 0.25, -0.25 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000270142
Feature Type: CDS
Feature Number: 3
Chromosome: 21
Start: 31666449
End: 31666518
Size: 69
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1628, 1697, 1697, 1628, 1628 ], "xaxis": "x", "y": [ -0.25, -0.25, 0.25, 0.25, -0.25 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000270142
Feature Type: CDS
Feature Number: 4
Chromosome: 21
Start: 31667258
End: 31667375
Size: 117
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1798, 1915, 1915, 1798, 1798 ], "xaxis": "x", "y": [ -0.25, -0.25, 0.25, 0.25, -0.25 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000270142
Feature Type: CDS
Feature Number: 5
Chromosome: 21
Start: 31668471
End: 31668575
Size: 104
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 2016, 2120, 2120, 2016, 2016 ], "xaxis": "x", "y": [ -0.25, -0.25, 0.25, 0.25, -0.25 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000389995
Feature Type: CDS
Feature Number: 1
Chromosome: 21
Start: 31659770
End: 31659784
Size: 14
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 106, 120, 120, 106, 106 ], "xaxis": "x", "y": [ 0.75, 0.75, 1.25, 1.25, 0.75 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000389995
Feature Type: CDS
Feature Number: 2
Chromosome: 21
Start: 31663790
End: 31663886
Size: 96
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1431, 1527, 1527, 1431, 1431 ], "xaxis": "x", "y": [ 0.75, 0.75, 1.25, 1.25, 0.75 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000389995
Feature Type: CDS
Feature Number: 3
Chromosome: 21
Start: 31666449
End: 31666518
Size: 69
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1628, 1697, 1697, 1628, 1628 ], "xaxis": "x", "y": [ 0.75, 0.75, 1.25, 1.25, 0.75 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000389995
Feature Type: CDS
Feature Number: 4
Chromosome: 21
Start: 31667258
End: 31667375
Size: 117
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1798, 1915, 1915, 1798, 1798 ], "xaxis": "x", "y": [ 0.75, 0.75, 1.25, 1.25, 0.75 ], "yaxis": "y" }, { "fill": "toself", "fillcolor": "#636EFA", "hoverlabel": { "namelength": -1 }, "hoveron": "fills+points", "hovertemplate": "transcript_id: ENST00000389995
Feature Type: CDS
Feature Number: 5
Chromosome: 21
Start: 31668471
End: 31668575
Size: 104
", "legendgroup": "protein_coding", "legendgrouptitle": { "text": "" }, "line": { "color": "black", "width": 0.25 }, "marker": { "opacity": 0 }, "mode": "lines+markers", "name": "protein_coding", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 2016, 2120, 2120, 2016, 2016 ], "xaxis": "x", "y": [ 0.75, 0.75, 1.25, 1.25, 0.75 ], "yaxis": "y" }, { "hoverinfo": "skip", "marker": { "color": "black", "size": 10, "symbol": "arrow-right" }, "mode": "markers", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 983.1428571428571 ], "xaxis": "x", "y": [ 0 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000270142
Feature Type: intron
Feature Number: 1
Chromosome: 21
Start: 31659841
End: 31663790
Size: 3949
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 177, 1431 ], "xaxis": "x", "y": [ 0, 0 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000270142
Feature Type: intron
Feature Number: 2
Chromosome: 21
Start: 31663886
End: 31666449
Size: 2563
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1527, 1628 ], "xaxis": "x", "y": [ 0, 0 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000270142
Feature Type: intron
Feature Number: 3
Chromosome: 21
Start: 31666518
End: 31667258
Size: 740
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1697, 1798 ], "xaxis": "x", "y": [ 0, 0 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000270142
Feature Type: intron
Feature Number: 4
Chromosome: 21
Start: 31667375
End: 31668471
Size: 1096
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1915, 2016 ], "xaxis": "x", "y": [ 0, 0 ], "yaxis": "y" }, { "hoverinfo": "skip", "marker": { "color": "black", "size": 10, "symbol": "arrow-right" }, "mode": "markers", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 962.7857142857142 ], "xaxis": "x", "y": [ 1 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000389995
Feature Type: intron
Feature Number: 1
Chromosome: 21
Start: 31659784
End: 31663790
Size: 4006
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 120, 1431 ], "xaxis": "x", "y": [ 1, 1 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000389995
Feature Type: intron
Feature Number: 2
Chromosome: 21
Start: 31663886
End: 31666449
Size: 2563
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1527, 1628 ], "xaxis": "x", "y": [ 1, 1 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000389995
Feature Type: intron
Feature Number: 3
Chromosome: 21
Start: 31666518
End: 31667258
Size: 740
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1697, 1798 ], "xaxis": "x", "y": [ 1, 1 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000389995
Feature Type: intron
Feature Number: 4
Chromosome: 21
Start: 31667375
End: 31668471
Size: 1096
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1915, 2016 ], "xaxis": "x", "y": [ 1, 1 ], "yaxis": "y" }, { "hoverinfo": "skip", "marker": { "color": "black", "size": 10, "symbol": "arrow-right" }, "mode": "markers", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1292.7857142857142 ], "xaxis": "x", "y": [ 2 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000470944
Feature Type: intron
Feature Number: 1
Chromosome: 21
Start: 31660708
End: 31663790
Size: 3082
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1044, 1431 ], "xaxis": "x", "y": [ 2, 2 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000470944
Feature Type: intron
Feature Number: 2
Chromosome: 21
Start: 31663886
End: 31666449
Size: 2563
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1527, 1628 ], "xaxis": "x", "y": [ 2, 2 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000470944
Feature Type: intron
Feature Number: 3
Chromosome: 21
Start: 31666518
End: 31667258
Size: 740
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1697, 1798 ], "xaxis": "x", "y": [ 2, 2 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000470944
Feature Type: intron
Feature Number: 4
Chromosome: 21
Start: 31667375
End: 31668471
Size: 1096
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1915, 2016 ], "xaxis": "x", "y": [ 2, 2 ], "yaxis": "y" }, { "hoverinfo": "skip", "marker": { "color": "black", "size": 10, "symbol": "arrow-right" }, "mode": "markers", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 799.2857142857142 ], "xaxis": "x", "y": [ 3 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000476106
Feature Type: intron
Feature Number: 1
Chromosome: 21
Start: 31659841
End: 31661549
Size: 1708
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 177, 1145 ], "xaxis": "x", "y": [ 3, 3 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000476106
Feature Type: intron
Feature Number: 2
Chromosome: 21
Start: 31661734
End: 31663790
Size: 2056
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1330, 1431 ], "xaxis": "x", "y": [ 3, 3 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000476106
Feature Type: intron
Feature Number: 3
Chromosome: 21
Start: 31663886
End: 31666449
Size: 2563
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1527, 1628 ], "xaxis": "x", "y": [ 3, 3 ], "yaxis": "y" }, { "hovertemplate": "transcript_id: ENST00000476106
Feature Type: intron
Feature Number: 4
Chromosome: 21
Start: 31666518
End: 31667258
Size: 740
", "line": { "color": "black", "width": 0.5 }, "mode": "lines", "opacity": 1, "showlegend": false, "type": "scatter", "x": [ 1697, 1798 ], "xaxis": "x", "y": [ 3, 3 ], "yaxis": "y" } ], "layout": { "annotations": [ { "font": { "size": 16 }, "showarrow": false, "text": "Transcript Structure", "x": 0.5, "xanchor": "center", "xref": "paper", "y": 1, "yanchor": "bottom", "yref": "paper" } ], "boxgap": 0.2, "boxgroupgap": 0.8, "boxmode": "group", "height": 500, "hoverlabel": { "font": { "size": 12 } }, "hovermode": "closest", "legend": { "font": { "size": 12 }, "grouptitlefont": { "size": 14 }, "tracegroupgap": 7 }, "margin": { "b": 50, "l": 100, "r": 50, "t": 100 }, "showlegend": true, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "white", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "white", "width": 0.5 }, "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "#C8D4E3", "linecolor": "#C8D4E3", "minorgridcolor": "#C8D4E3", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "#C8D4E3", "linecolor": "#C8D4E3", "minorgridcolor": "#C8D4E3", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "pattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "fillpattern": { "fillmode": "overlay", "size": 10, "solidity": 0.2 }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "white", "showlakes": true, "showland": true, "subunitcolor": "#C8D4E3" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "white", "polar": { "angularaxis": { "gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": "" }, "bgcolor": "white", "radialaxis": { "gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "white", "gridcolor": "#DFE8F3", "gridwidth": 2, "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", "zerolinecolor": "#EBF0F8" }, "yaxis": { "backgroundcolor": "white", "gridcolor": "#DFE8F3", "gridwidth": 2, "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", "zerolinecolor": "#EBF0F8" }, "zaxis": { "backgroundcolor": "white", "gridcolor": "#DFE8F3", "gridwidth": 2, "linecolor": "#EBF0F8", "showbackground": true, "ticks": "", "zerolinecolor": "#EBF0F8" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "ticks": "" }, "baxis": { "gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "ticks": "" }, "bgcolor": "white", "caxis": { "gridcolor": "#DFE8F3", "linecolor": "#A2B1C6", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "#EBF0F8", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "#EBF0F8", "linecolor": "#EBF0F8", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "#EBF0F8", "zerolinewidth": 2 } } }, "title": { "text": "" }, "violingap": 0.2, "violingroupgap": 0.8, "violinmode": "group", "width": 1200, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "showgrid": true, "showticklabels": false, "tickfont": { "size": 12 }, "title": { "text": "" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "range": [ -0.8, 3.8 ], "showgrid": true, "showticklabels": true, "tickfont": { "color": "black", "family": "DejaVu Sans", "size": 12 }, "ticktext": [ "ENST00000270142", "ENST00000389995", "ENST00000470944", "ENST00000476106" ], "tickvals": [ 0, 1, 2, 3 ], "title": { "text": "" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "## Path to your ENSEMBL GTF file\n", "ensembl_gtf_path = \"../dash_apps/RNApysoforms/tests/test_data/Homo_sapiens_chr21_and_Y.GRCh38.110.gtf\"\n", "\n", "\n", "## Read ENSEMBL gtf\n", "annotation = RNApy.read_ensembl_gtf(ensembl_gtf_path)\n", "\n", "\n", "## Filter gene name in annotation and counts matrix\n", "sod1_annotation = RNApy.gene_filtering(annotation=annotation, target_gene=\"SOD1\")\n", "\n", "\"\"\"\n", "Rescale introns (no need to run function \"to_intron\", shorten_gaps() already does this \n", "by default if introns aren't already included in annotation.\n", "\"\"\"\n", "sod1_annotation = RNApy.shorten_gaps(sod1_annotation)\n", "\n", "\n", "\"\"\"\n", "Create traces for plotting, make sure to pass x_start and x_end \n", "as \"rescaled_start\" and \"rescaled_end\" to get shortened introns.\n", "You can also change hover_start and hover_end to reflext the \n", "rescaled coordinates, but I find the original genomic coodrinates\n", "for start and end more informative for the hover display.\n", "\"\"\"\n", "traces = RNApy.make_traces(annotation=sod1_annotation, x_start=\"rescaled_start\", x_end=\"rescaled_end\",\n", " y='transcript_id', annotation_hue=\"transcript_biotype\",\n", " hover_start=\"start\", hover_end=\"end\")\n", "\n", "## Put traces into figure\n", "fig = RNApy.make_plot(traces = traces, subplot_titles = [\"Transcript Structure\"], width=1200, height=500)\n", "\n", "## Show figure\n", "fig.show()\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### You can click on the legend items to make figure elements appear and disappear.\n", "\n", "### 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).\n", "\n", "### The hovering for exons and CDS works best if you hover your mouse over the edges of the CDS/exon boxes." ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.5" } }, "nbformat": 4, "nbformat_minor": 2 }