{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Visualizing data\n", "================\n", "\n", "With your data loaded using an RNAvigate `Sample` object, you can start\n", "creating visualizations and analyses. This document will show you what types of\n", "plots can be created and where to find more information.\n", "\n", "Contents:\n", "\n", "- [Alignment plots](#alignment-plots)\n", "- [Skyline plots](#skyline-plots)\n", "- [Profile plots](#profile-plots)\n", "- [Arc plots](#arc-plots)\n", "- [Arc comparison plots](#arc-compare-plots)\n", "- [Circle plots](#circle-plots)\n", "- [Secondary structure diagrams](#secondary-structure-diagrams)\n", "- [Interactive 3d molecule renderings](#interactive-3d-molecule-renderings)\n", "- [Distance distribution histograms](#distance-distribution-histograms)\n", "- [Heatmaps and contour maps](#heatmaps-and-contour-maps)\n", "- [Linear regression plots](#linear-regression-plots)\n", "- [Receiver operator characteristic curves](#receiver-operator-characteristic-curves)\n", "- [Shapemapper2 quality control plots](#shapemapper2-quality-control-plots)\n", "- [Shapemapper2 profiles](#shapemapper2-profiles)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import rnavigate as rnav\n", "from rnavigate.examples import tpp, rnasep_1, rnasep_2, rnasep_3\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Alignment plots\n", "--------------------------------------------------\n", "\n", "[full guide](../plot_options/alignment.ipynb)\n", "\n", "Alignment plots visualize how two sets data will be positionally aligned in\n", "RNAvigate plots. It is a good idea to check the automatic alignment if two\n", "sequences differ significantly. For the most part, this is not necessary for\n", "deletion or point mutants or subsequences.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot = rnav.plot_alignment(\n", " data1=(tpp, \"dmsmap\"),\n", " data2=(tpp, \"pdb\"),\n", " )\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Skyline plots\n", "----------------------------------------------\n", "\n", "[full guide](../plot_options/skyline.ipynb)\n", "\n", "Skyline plots flexibly display and compare per-nucleotide data sets.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot = rnav.plot_skyline(\n", " samples=[tpp],\n", " profile=\"dmsmap\",\n", " columns=[\"Modified_rate\", \"Untreated_rate\"])\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Profile plots\n", "----------------------------------------------\n", "\n", "[full guide](../plot_options/profile.ipynb)\n", "\n", "Profile plots display per-nucleotide data as colored bar graphs similar to ShapeMapper style bar graphs, but very flexible.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot = rnav.plot_profile(\n", " samples=[tpp],\n", " profile=\"dmsmap\",\n", " )\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Arc plots\n", "--------------------------------------\n", "\n", "[full guide](../plot_options/arc.ipynb)\n", "\n", "Arc plots flexibly display inter-nucleotide relationships and secondary\n", "structures as arcs. Per-nucleotide measurements and sequence annotations can\n", "also be displayed without over-crowding.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot = rnav.plot_arcs(\n", " samples=[tpp],\n", " sequence=\"pdb\",\n", " structure=\"ss\",\n", " profile=\"dmsmap\",\n", " profile_scale_factor=5,\n", " )\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Arc compare plots\n", "------------------------------------------------------\n", "\n", "[full guide](../plot_options/arc_compare.ipynb)\n", "\n", "Arc compare plots are the same as arc plots above, but compare two samples\n", "on the same axes.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot = rnav.plot_arcs_compare(\n", " samples=[rnasep_1, rnasep_2],\n", " sequence=\"pdb\",\n", " interactions=\"ringmap\",\n", ")\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Circle plots\n", "--------------------------------------------\n", "\n", "[full guide](../plot_options/circle.ipynb)\n", "\n", "Circle plots are similar to arc plots, but display nucleotides in a circle so\n", "that any size RNA fits in a square area.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot = rnav.plot_circle(\n", " samples=[tpp],\n", " sequence=\"pdb\",\n", " structure=\"ss\",\n", " profile=\"dmsmap\",\n", " colors={\"sequence\": \"contrast\",\n", " \"nucleotides\": \"profile\"},\n", " )\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Secondary structure diagrams\n", "--------------------------------------------------------\n", "\n", "[full guide](../plot_options/ss.ipynb)\n", "\n", "Secondary structure diagrams display per-nucleotide and inter-nucleotide\n", "measurements and sequence annotations on a secondary structure diagram.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plots = rnav.plot_ss(\n", " samples=[tpp],\n", " structure=\"ss\",\n", " profile=\"dmsmap\",\n", " colors={\"nucleotides\": \"profile\"},\n", " nt_ticks=20\n", " )\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Interactive 3D molecule renderings\n", "---------------------------------------------------------------\n", "\n", "[full guide](../plot_options/mol.ipynb)\n", "\n", "These renderings display per-nucleotide and inter-nucleotide data on\n", "3D RNA molecular structures.\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot = rnav.plot_mol(\n", " samples=[tpp],\n", " structure=\"pdb\",\n", " colors=\"sequence\",\n", " rotation={'x': -110, 'z': -30, 'y':-10},\n", " )\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Distance distribution histograms\n", "------------------------------------------------------------------\n", "\n", "[full guide](../plot_options/disthist.ipynb)\n", "\n", "Distance distribution histograms display the 3D distance distribution of sets\n", "of inter-nucleotide measurements.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot = rnav.plot_disthist(\n", " samples=[tpp],\n", " structure=\"pdb\",\n", " interactions=\"ringmap\"\n", " )\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Heatmaps and contour maps\n", "----------------------------------------------------------\n", "\n", "[full guide](../plot_options/heatmap.ipynb)\n", "\n", "Heatmaps and contour maps are useful for displaying dense inter-nucleotide\n", "measurements or inter-nucleotide data density while highlighting defined\n", "regions such as helices or 3D interactions.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot = rnav.plot_heatmap(\n", " samples=[tpp],\n", " sequence=\"ss\",\n", " structure=\"ss\",\n", " interactions=\"ringmap\",\n", " )\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Linear regression plots\n", "-------------------------------------------------------\n", "\n", "[full guide](../plot_options/linreg.ipynb)\n", "\n", "Linear regression plots quickly compare multiple sets of per-nucleotide data\n", "and display slope, R^2, and density.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot = rnav.plot_linreg(\n", " samples=[rnasep_1, rnasep_2, rnasep_3],\n", " profile=\"shapemap\",\n", " scale=\"log\",\n", " )\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Receiver operator characteristic curves\n", "--------------------------------------------------------------------\n", "\n", "[full guide](../plot_options/roc.ipynb)\n", "\n", "ROC curves are a way to determine how well per-nucleotide data predict a\n", "classifier, such as base-paired vs. unpaired status.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot = rnav.plot_roc(\n", " samples=[rnasep_1, rnasep_2, rnasep_3],\n", " profile=\"shapemap\",\n", " structure=\"ss_ct\",\n", " )\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ShapeMapper2 quality control plots\n", "--------------------------------------------------------------\n", "\n", "[full guide](../plot_options/qc.ipynb)\n", "\n", "ShapeMapper2 QC plots display useful quality control metrics from ShapeMapper2\n", "analyses.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot = rnav.plot_qc(\n", " samples=[rnasep_1],\n", " profile=\"shapemap\")\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ShapeMapper2 profiles\n", "-------------------------------------------------\n", "\n", "[full guide](../plot_options/sm.ipynb)\n", "\n", "ShapeMapper2 profiles display normalized SHAPE profiles, mutation rates, and/or\n", "read depths in ShapeMapper2's default layout.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plot = rnav.plot_shapemapper(\n", " sample=rnasep_1,\n", " profile=\"shapemap\",\n", " )\n" ] } ], "metadata": { "kernelspec": { "display_name": "RNAvigate", "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.9.2" } }, "nbformat": 4, "nbformat_minor": 2 }