{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Displaying Surfaces\n", "py3Dmol supports the following surface types:\n", "\n", "* VDW - van der Waals surface\n", "* MS - molecular surface\n", "* SES - solvent excluded surface\n", "* SAS - solvent accessible surface" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import py3Dmol" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Add surface\n", "In the structure below (HLA complex with antigen peptide pVR), we add a solvent excluded surface (SES) to the heavy chain to highlight the binding pocket for the antigen peptide (rendered as spheres)." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n jupyter labextension install jupyterlab_3dmol

\n
\n", "text/html": [ "
\n", "

You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n", " jupyter labextension install jupyterlab_3dmol

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "viewer = py3Dmol.view(query='pdb:5XS3')\n", "\n", "heavychain = {'chain':'A'}\n", "lightchain = {'chain':'B'}\n", "antigen = {'chain':'C'}\n", "\n", "viewer.setStyle(heavychain,{'cartoon':{'color':'blue'}})\n", "viewer.setStyle(lightchain,{'cartoon':{'color':'yellow'}})\n", "viewer.setStyle(antigen,{'sphere':{'colorscheme':'orangeCarbon'}})\n", "\n", "viewer.addSurface(py3Dmol.SES,{'opacity':0.9,'color':'lightblue'}, heavychain)\n", "viewer.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "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.7.7" } }, "nbformat": 4, "nbformat_minor": 2 }