{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import py3Dmol" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p = py3Dmol.view(query='pdb:1ycr')\n", "p.setStyle({'cartoon': {'color':'spectrum'}})\n", "p.show()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [], "source": [ "xyz = '''4\n", "* (null), Energy -1000.0000000\n", "N 0.000005 0.019779 -0.000003 -0.157114 0.000052 -0.012746\n", "H 0.931955 -0.364989 0.000003 1.507100 -0.601158 -0.004108\n", "H -0.465975 -0.364992 0.807088 0.283368 0.257996 -0.583024\n", "H -0.465979 -0.364991 -0.807088 0.392764 0.342436 0.764260\n", "'''" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "" ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "xyzview = py3Dmol.view(width=400,height=400,js='localhost/3Dmol/build/3Dmol-min.js')\n", "xyzview.addModel(xyz,'xyz',{'vibrate': {'frames':10,'amplitude':1}})\n", "xyzview.setStyle({'stick':{}})\n", "xyzview.setBackgroundColor('0xeeeeee')\n", "xyzview.animate({'loop': 'backAndForth'})\n", "xyzview.zoomTo()\n", "xyzview.show()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "" ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "view = py3Dmol.view(query='pdb:1dc9')\n", "view.setViewStyle({'style':'outline','color':'black','width':0.1})\n", "view.setStyle({'cartoon':{'arrows':True, 'tubes':True, 'style':'oval', 'color':'white'}})\n", "view" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "" ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "view = py3Dmol.view(query='pdb:1ycr')\n", "chA = {'chain':'A'}\n", "chB = {'chain':'B'}\n", "view.setStyle(chA,{'cartoon': {'color':'spectrum'}})\n", "view.addSurface(py3Dmol.VDW,{'opacity':0.7,'color':'white'}, chA)\n", "view.setStyle(chB,{'stick':{}})\n", "view.show()" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "" ], "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "view = py3Dmol.view(query='pdb:5ire',options={'doAssembly':True})\n", "view.setStyle({'cartoon':{'color':'spectrum'}})\n", "view" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "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.6" }, "widgets": { "state": {}, "version": "1.1.1" } }, "nbformat": 4, "nbformat_minor": 0 }