{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# RNArtistCore demo\n", "\n", "-----\n", "\n", "
\n", "

If you haven't used one of these notebooks before, they're basically web pages in which you can write, edit, and run live code. They're meant to encourage experimentation, so don't feel nervous. Just try running a few cells and see what happens!.

\n", "\n", "

\n", " Some tips:\n", "

\n", "

\n", "
\n", "\n", "----\n", "\n", "#### Your environment\n", "\n", "* [RNArtistCore](https://github.com/fjossinet/RNArtistCore) is installed and configured in the directory ~/RNArtistCore\n", "* The [RNAVIEW](http://ndbserver.rutgers.edu/ndbmodule/services/download/rnaview.html) algorithm is installed and configured in the directory ~/RNAVIEW" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# first we create a directory to store the scripts and output files\n", "%mkdir binder_tests" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### RNA 2D described from scratch in the script file" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "s = '''rnartist {\n", "\n", " svg {\n", " path = \"binder_tests/\"\n", " }\n", "\n", " ss {\n", " bn {\n", " seq = \"UCUUUCGUUUAUCAGGUCCGUCGCUGGGCUUUCCGUAAGAUUCUCACGUCGAAUGGUGUUCGGAGACUGAACUUUUUUAGCUUUAUGAGGGGGGUUACAGACUUCCGUCUGCUACGUGCGGGGGAACCGUACCACUGUCGGAUGUGGUCCCUUGCGCUCAAGGUGCUGCGACGCGCAGGUGCGUGAUCCAGAUAGGCAACACCCAUAUCAAUGCUAUCUGGAGGUAGUAUUGAUAGCCGUGGCUGGCUAUGUGUUUUGUGCUGAUAACCAUCAGACGGUGCCGGU\"\n", " value = \"(((..(((..(((..(((((....))))).(((..(((..(((..(((((....)))))..)))..(((((....)))))..)))...))).)))..(((((....)))))..)))...)))...(((..(((.(((..(((..(((..(((((....)))))..)))..(((((....)))))..)))...)))...(((..(((..(((..(((((....)))))..)))..(((((....)))))..)))...))).(((((....)))))..)))...)))\"\n", " name = \"rna1\"\n", " }\n", " }\n", " theme {\n", " details_lvl = 5\n", " color {\n", " value = \"#800080\"\n", " type = \"R\"\n", " }\n", " color {\n", " value = \"#ffcc80\"\n", " type = \"Y\"\n", " }\n", " color {\n", " value = \"#000000\"\n", " type = \"y\"\n", " }\n", " color {\n", " value = \"#99cc99\"\n", " location {\n", " 145 to 168\n", " }\n", " }\n", " color {\n", " value = \"#b31a1a\"\n", " location {\n", " 199 to 235\n", " 248 to 259\n", " }\n", " }\n", " hide {\n", " location {\n", " 38 to 83\n", " }\n", " type = \"N n\"\n", " }\n", " hide {\n", " location {\n", " 98 to 111\n", " }\n", " type = \"R r\"\n", " }\n", " hide {\n", " location {\n", " 235 to 239\n", " 244 to 248\n", " }\n", " type = \"N n\"\n", " }\n", " hide {\n", " location {\n", " 145 to 168\n", " }\n", " type = \"helix junction\"\n", " }\n", " hide {\n", " location {\n", " 199 to 235\n", " 248 to 259\n", " }\n", " type = \"N n interaction_symbol\"\n", " }\n", " line {\n", " type = \"phosphodiester_bond\"\n", " value = 2.2\n", " }\n", " line {\n", " location {\n", " 145 to 168\n", " }\n", " value = 5.0\n", " }\n", " line {\n", " location {\n", " 199 to 235\n", " 248 to 259\n", " }\n", " type = \"secondary_interaction phosphodiester_bond interaction_symbol\"\n", " value = 5.0\n", " }\n", " }\n", " layout {\n", " junction {\n", " type = 3\n", " out_ids = \"wnw n\"\n", " }\n", " junction {\n", " location {\n", " 206 to 209\n", " 232 to 235\n", " 248 to 251\n", " }\n", " out_ids = \"n e\"\n", " }\n", " }\n", "}\n", "'''" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%store s >binder_tests/demo1.kts" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# we ask rnartistcore to draw the 2D as described in the script file" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%bash\n", "java -jar RNArtistCore/target/rnartistcore_with-dependencies.jar binder_tests/demo1.kts" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "#we display the 2D saved in an SVG file\n", "from IPython.core.display import SVG #<-- this line only needs to be run once per notebook\n", "# the output file name is like: filename defined in the script + molecular chain name (default name is 'A'). \n", "SVG(filename='binder_tests/rna1.svg')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### RNA 2D described in a vienna file" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "s = '''rnartist {\n", " svg {\n", " path = \"binder_tests/\"\n", " }\n", " ss {\n", " vienna {\n", " file = \"RNArtistCore/samples/rna.vienna\"\n", " }\n", " }\n", " theme {\n", " details_lvl = 5\n", "\n", " color {\n", " type = \"A\"\n", " value = \"#A0ECF5\"\n", " }\n", "\n", " color {\n", " type = \"a\"\n", " value = \"black\"\n", " }\n", "\n", " color {\n", " type = \"U\"\n", " value = \"#9157E5\"\n", " }\n", "\n", " color {\n", " type = \"G\"\n", " value = \"darkgreen\"\n", " }\n", "\n", " color {\n", " type = \"C\"\n", " value = \"#E557E5\"\n", " }\n", "\n", " }\n", "}\n", "'''" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%store s >binder_tests/demo2.kts" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%bash\n", "java -jar RNArtistCore/target/rnartistcore_with-dependencies.jar binder_tests/demo2.kts" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "SVG(filename='binder_tests/A.svg')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### RNA 2D inferred from a 3D structure described in a PDB file (PDBID: 1GID)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "s = '''rnartist {\n", " svg {\n", " path = \"binder_tests/\"\n", " }\n", " ss {\n", " pdb {\n", " name = \"B\"\n", " file = \"RNArtistCore/samples/1gid.pdb\"\n", " }\n", " }\n", " theme {\n", " details_lvl = 5\n", "\n", " color {\n", " type = \"A\"\n", " value = \"#A0ECF5\"\n", " }\n", "\n", " color {\n", " type = \"a\"\n", " value = \"black\"\n", " }\n", "\n", " color {\n", " type = \"U\"\n", " value = \"#9157E5\"\n", " }\n", "\n", " color {\n", " type = \"G\"\n", " value = \"darkgreen\"\n", " }\n", "\n", " color {\n", " type = \"C\"\n", " value = \"#E557E5\"\n", " }\n", "\n", " }\n", "}\n", "'''" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "%store s >binder_tests/demo3.kts" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "%%bash\n", "java -jar RNArtistCore/target/rnartistcore_with-dependencies.jar binder_tests/demo3.kts" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "SVG(filename='binder_tests/B.svg')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.8.5" } }, "nbformat": 4, "nbformat_minor": 5 }