{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Solution-1\n", "Visualize a PDB structure, set styles, and add labels." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import py3Dmol" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### TODO-1\n", "Instantiate py3Dmol viewer with PDB structure 1NCA (Neuraminidase-FAB complex)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

You appear to be running in JupyterLab. 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. 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:1NCA')\n", "viewer.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### TODO-2\n", "Apply the following styles to this structure:\n", "* chain N (Neuraminidase): orange cartoon\n", "* chain H (Heavy chain): blue sphere\n", "* chain L (Light chain): lightblue sphere\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

You appear to be running in JupyterLab. 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. You need to install the 3dmol extension:
\n", " jupyter labextension install jupyterlab_3dmol

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "viewer.setStyle({'chain':'N'},{'cartoon': {'color': 'orange'}})\n", "viewer.setStyle({'chain':'H'},{'sphere': {'color': 'blue'}})\n", "viewer.setStyle({'chain':'L'},{'sphere': {'color': 'lightblue'}})\n", "viewer.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### TODO-3: Add text labels to the three chains" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

You appear to be running in JupyterLab. 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. You need to install the 3dmol extension:
\n", " jupyter labextension install jupyterlab_3dmol

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "viewer.addLabel('Neuraminidase', {'fontColor':'orange', 'backgroundColor':'lightgray'}, \n", " {'chain': 'N'})\n", "viewer.addLabel('Heavy chain', {'fontColor':'blue', 'backgroundColor':'lightgray'},\n", " {'chain': 'H'})\n", "viewer.addLabel('Light chain', {'fontColor':'blue', 'backgroundColor':'lightgray'},\n", " {'chain': 'L'})\n", "viewer.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Bonus: Set the style for sugar residues MAN, BMA, and NAG to stick and color by a greenCarbon colorscheme." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "application/3dmoljs_load.v0": "
\n

You appear to be running in JupyterLab. 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. You need to install the 3dmol extension:
\n", " jupyter labextension install jupyterlab_3dmol

\n", "
\n", "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "viewer.setStyle({'resn': ['MAN', 'BMA', 'NAG']}, {'stick':{'colorscheme': 'greenCarbon'}})\n", "viewer.show()" ] } ], "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.6.3" } }, "nbformat": 4, "nbformat_minor": 2 }