{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Barnase-Barstar Directed Mutagenesis Interactive Plotting Demo" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This notebook showcases some of the interactive plotting functions `plotScan_interactive` and `plotNetwork_interactive` in AESOP using the [Barnase-Barstar Directed Mutagenesis example](https://aesop.readthedocs.io/en/latest/directmutagenesis.html#example-case-barnase-barstar).The sample code below imports the relevant classes and functions to perform user specified mutations and output the electrostatic analysis results using interactive plots.\n", "\n", "Before proceeding, make sure you have the python packages `plotly` and `networkx` installed as described in the [documentation](https://aesop.readthedocs.io/en/latest/installation.html)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from aesop import DirectedMutagenesis, plotScan_interactive, plotNetwork_interactive\n", "\n", "path_apbs = 'path\\to\\executable\\apbs'\n", "path_coulomb = 'path\\to\\executable\\coulomb'\n", "path_pdb2pqr = 'path\\to\\executable\\pdb2pqr'\n", "\n", "jobname = 'directedscan'\n", "pdbfile = 'barnase_barstar.pdb'\n", "\n", "selstr = ['chain A', 'chain B']\n", "\n", "target = ['resnum 27', 'resnum 73', 'resnum 83', 'resnum 87', # mutations in chain A\n", " 'resnum 145', 'resnum 149', 'resnum 164', 'resnum 186'] # mutations in chain B\n", "\n", "mutation = ['ASP', 'LYS', 'GLU', 'GLU', # mutations in chain A\n", " 'ARG', 'ARG', 'ASP', 'LYS'] # mutations in chain B\n", "\n", "mutscan = DirectedMutagenesis(pdb=pdbfile,\n", " pdb2pqr_exe=path_pdb2pqr,\n", " apbs_exe=path_apbs,\n", " coulomb_exe=path_coulomb,\n", " jobname=jobname,\n", " selstr=selstr,\n", " target=target,\n", " mutation=mutation,\n", " minim=True)\n", "mutscan.run()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Once DirectedMutagenesis is instantiated and finished running, we can plot the results. The `plotScan_interactive` function by default, outputs the results in an html file and opens it up in your browser. However, if you are using a [notebook](https://jupyter.org/) to view it, you can display the plot inline by passing the argument `display_output='notebook'` to the function. Here we display it in the notebook so that it's easier to view alongside the code." ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "This is the format of your plot grid:\n", "[ (1,1) x1,y1 ]\n", "[ (2,1) x2,y2 ]\n", "\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plotScan_interactive(mutscan,display_output='notebook')\n", "#If you are not using a notebook to run your code then use the code below instead:\n", "#plotScan_interactive(mutscan)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The `plotScan_interactive` function displays a bar plot similar to `plotScan` but now hovering over specific bars displays the corresponding asssociation/solvation free energy values. Additionally, clicking and dragging in the plot allows you to zoom in a subset of values. The plotly modebar in the top right has additional options such as zoom, autoscale and saving as a static image.\n", "\n", "\n", "\n", "`plotNetwork_interactive` provides similar functionality but for network plots." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "@> 3159 atoms and 1 coordinate sets were parsed in 0.03s.\n", "DEBUG:.prody:3159 atoms and 1 coordinate sets were parsed in 0.03s.\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plotNetwork_interactive(mutscan,display_output='notebook')\n", "#If you are not using a notebook to run your code then use the code below instead:\n", "#plotNetwork_interactive(mutscan)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.11" } }, "nbformat": 4, "nbformat_minor": 0 }