{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Barnase-Barstar Alascan 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 Alascan example](https://aesop.readthedocs.io/en/latest/alascan.html#example-case-barnase-barstar).The sample code below imports the relevant classes and functions to run an alanine scan and output the 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": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from aesop import Alascan, 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 = 'alascan'\n", "pdbfile = 'barnase_barstar.pdb'\n", "\n", "selstr = ['chain A', 'chain B']\n", "\n", "alascan = Alascan(pdb=pdbfile,\n", " pdb2pqr_exe=path_pdb2pqr,\n", " apbs_exe=path_apbs,\n", " coulomb_exe=path_coulomb,\n", " jobname=jobname,\n", " selstr=selstr,\n", " minim=False)\n", "\n", "alascan = Alascan(pdb=pdbfile, jobname=jobname, selstr=selstr)\n", "alascan.run()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Once Alascan 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(alascan,display_output='notebook')\n", "#If you are not using a notebook to run your code then use the code below instead:\n", "#plotScan_interactive(alascan)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": false }, "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(alascan,display_output='notebook')\n", "#If you are not using a notebook to run your code then use the code below instead:\n", "#plotNetwork_interactive(alascan)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [] } ], "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 }