{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "gnina.ipynb", "provenance": [], "collapsed_sections": [], "include_colab_link": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "accelerator": "GPU" }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "\"Open" ] }, { "cell_type": "markdown", "metadata": { "id": "ipfXU7luj9bS" }, "source": [ "We've configured colab to use a GPU (Runtme->Change runtime type->Hardware Accelerator=GPU)" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "APMfSF1IIMTr", "outputId": "55798dca-b3ec-4973-a3d4-2652ef881a93" }, "source": [ "!nvidia-smi" ], "execution_count": null, "outputs": [ { "output_type": "stream", "text": [ "Sat Mar 27 23:02:43 2021 \n", "+-----------------------------------------------------------------------------+\n", "| NVIDIA-SMI 460.56 Driver Version: 460.32.03 CUDA Version: 11.2 |\n", "|-------------------------------+----------------------+----------------------+\n", "| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n", "| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n", "| | | MIG M. |\n", "|===============================+======================+======================|\n", "| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |\n", "| N/A 43C P8 11W / 70W | 0MiB / 15109MiB | 0% Default |\n", "| | | N/A |\n", "+-------------------------------+----------------------+----------------------+\n", " \n", "+-----------------------------------------------------------------------------+\n", "| Processes: |\n", "| GPU GI CI PID Type Process name GPU Memory |\n", "| ID ID Usage |\n", "|=============================================================================|\n", "| No running processes found |\n", "+-----------------------------------------------------------------------------+\n" ], "name": "stdout" } ] }, { "cell_type": "markdown", "metadata": { "id": "-UjnC9f-kMl2" }, "source": [ "Download the linux binary and make it executable." ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "KLUI3VHLIPRe", "outputId": "7e18c06e-6bcb-4640-be86-3048626f8d18" }, "source": [ "!wget https://github.com/gnina/gnina/releases/download/v1.0.1/gnina" ], "execution_count": null, "outputs": [ { "output_type": "stream", "text": [ "--2021-03-27 23:02:44-- https://github.com/gnina/gnina/releases/download/v1.0.1/gnina\n", "Resolving github.com (github.com)... 140.82.114.3\n", "Connecting to github.com (github.com)|140.82.114.3|:443... connected.\n", "HTTP request sent, awaiting response... 302 Found\n", "Location: https://github-releases.githubusercontent.com/45548146/47de2300-8bd4-11eb-8355-430c51e07fae?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210327%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210327T230244Z&X-Amz-Expires=300&X-Amz-Signature=edc8678d76d575d204dc3e06b2b38a64b2344cc67ef9c7b8accf904d3bf557ad&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=45548146&response-content-disposition=attachment%3B%20filename%3Dgnina&response-content-type=application%2Foctet-stream [following]\n", "--2021-03-27 23:02:44-- https://github-releases.githubusercontent.com/45548146/47de2300-8bd4-11eb-8355-430c51e07fae?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210327%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210327T230244Z&X-Amz-Expires=300&X-Amz-Signature=edc8678d76d575d204dc3e06b2b38a64b2344cc67ef9c7b8accf904d3bf557ad&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=45548146&response-content-disposition=attachment%3B%20filename%3Dgnina&response-content-type=application%2Foctet-stream\n", "Resolving github-releases.githubusercontent.com (github-releases.githubusercontent.com)... 185.199.108.154, 185.199.109.154, 185.199.111.154, ...\n", "Connecting to github-releases.githubusercontent.com (github-releases.githubusercontent.com)|185.199.108.154|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 562802104 (537M) [application/octet-stream]\n", "Saving to: ‘gnina’\n", "\n", "gnina 100%[===================>] 536.73M 85.6MB/s in 6.2s \n", "\n", "2021-03-27 23:02:50 (87.2 MB/s) - ‘gnina’ saved [562802104/562802104]\n", "\n" ], "name": "stdout" } ] }, { "cell_type": "code", "metadata": { "id": "3nWRPH0BIYFd" }, "source": [ "!chmod +x gnina" ], "execution_count": null, "outputs": [] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "wWBjgurSlmkN", "outputId": "04f6d9b4-0550-4658-f20a-9cc4105bf308" }, "source": [ "!./gnina --version" ], "execution_count": null, "outputs": [ { "output_type": "stream", "text": [ "gnina v1.0.1 HEAD:aa41230 Built Mar 23 2021.\n" ], "name": "stdout" } ] }, { "cell_type": "markdown", "metadata": { "id": "Qk-XSJyukWJE" }, "source": [ "Get a pdb and extract the receptor and ligand." ] }, { "cell_type": "code", "metadata": { "id": "EWmvr7W8IbPi", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "3b61cd3e-4220-4a03-ed37-78df4918dbcf" }, "source": [ "!wget http://files.rcsb.org/download/3ERK.pdb" ], "execution_count": null, "outputs": [ { "output_type": "stream", "text": [ "--2021-03-27 23:02:56-- http://files.rcsb.org/download/3ERK.pdb\n", "Resolving files.rcsb.org (files.rcsb.org)... 128.6.158.70\n", "Connecting to files.rcsb.org (files.rcsb.org)|128.6.158.70|:80... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: unspecified [application/octet-stream]\n", "Saving to: ‘3ERK.pdb’\n", "\n", "\r3ERK.pdb [<=> ] 0 --.-KB/s \r3ERK.pdb [ <=> ] 270.37K --.-KB/s in 0.03s \n", "\n", "2021-03-27 23:02:56 (8.65 MB/s) - ‘3ERK.pdb’ saved [276858]\n", "\n" ], "name": "stdout" } ] }, { "cell_type": "code", "metadata": { "id": "6B5cdMnmIffy" }, "source": [ "!grep ATOM 3ERK.pdb > rec.pdb" ], "execution_count": null, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "z2Ep6undhGq9" }, "source": [ "!grep SB4 3ERK.pdb > lig.pdb" ], "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "metadata": { "id": "R_TooV5OkuI3" }, "source": [ "Redock the cognate ligand. Set random seed for reproducibility.\n", "\n", "Affinity is the Vina score of the pose. CNN pose score is a probability calculated by a convolutional neural network that the pose is a low RMSD pose. CNN affinity is the CNN's prediction of the pK (higher is better, e.g. 9 is nanomolar, 6 is micromolar).\n", "\n", "This particular ligand has an experimental affinity of 18$\\mu$M so the prediction is pretty close." ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "wbfj-hvzkrBi", "outputId": "8c809056-2660-48b1-8d68-d9c4048dddd2" }, "source": [ "!./gnina -r rec.pdb -l lig.pdb --autobox_ligand lig.pdb -o docked.sdf --seed 0" ], "execution_count": null, "outputs": [ { "output_type": "stream", "text": [ " _ \n", " (_) \n", " __ _ _ __ _ _ __ __ _ \n", " / _` | '_ \\| | '_ \\ / _` |\n", " | (_| | | | | | | | | (_| |\n", " \\__, |_| |_|_|_| |_|\\__,_|\n", " __/ | \n", " |___/ \n", "\n", "gnina v1.0.1 HEAD:aa41230 Built Mar 23 2021.\n", "gnina is based on smina and AutoDock Vina.\n", "Please cite appropriately.\n", "\n", "Commandline: ./gnina -r rec.pdb -l lig.pdb --autobox_ligand lig.pdb -o docked.sdf --seed 0\n", "==============================\n", "*** Open Babel Warning in PerceiveBondOrders\n", " Failed to kekulize aromatic bonds in OBMol::PerceiveBondOrders\n", "\n", "Using random seed: 0\n", "\n", "0% 10 20 30 40 50 60 70 80 90 100%\n", "|----|----|----|----|----|----|----|----|----|----|\n", "***************************************************\n", "\n", "mode | affinity | CNN | CNN\n", " | (kcal/mol) | pose score | affinity\n", "-----+------------+------------+----------\n", " 1 -8.50 0.8963 6.783\n", " 2 -8.08 0.6049 6.600\n", " 3 -8.31 0.4536 6.456\n", " 4 -6.59 0.2824 6.080\n", " 5 -6.75 0.2072 5.836\n", " 6 -6.78 0.1711 5.776\n", " 7 -6.20 0.1659 5.529\n", " 8 -5.98 0.1544 5.666\n", " 9 -6.11 0.1473 5.319\n" ], "name": "stdout" } ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "sMTknhigk2GT", "outputId": "65e5530c-fcba-4a97-b2fb-38c1c481a56a" }, "source": [ "!pip install py3Dmol" ], "execution_count": null, "outputs": [ { "output_type": "stream", "text": [ "Collecting py3Dmol\n", " Downloading https://files.pythonhosted.org/packages/dd/19/dd527b0db65e730e20c3d5e5a7efbb7fbbf8d98f9debfb47962c13f479d6/py3Dmol-0.9.1-py2.py3-none-any.whl\n", "Installing collected packages: py3Dmol\n", "Successfully installed py3Dmol-0.9.1\n" ], "name": "stdout" } ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 514 }, "id": "WctyMpdMluFN", "outputId": "37e1f5df-1333-45b5-afd6-ea6e5114ef5e" }, "source": [ "import py3Dmol\n", "\n", "v = py3Dmol.view()\n", "v.addModel(open('rec.pdb').read())\n", "v.setStyle({'cartoon':{},'stick':{'radius':.1}})\n", "v.addModel(open('lig.pdb').read())\n", "v.setStyle({'model':1},{'stick':{'colorscheme':'dimgrayCarbon','radius':.125}})\n", "v.addModelsAsFrames(open('docked.sdf').read())\n", "v.setStyle({'model':2},{'stick':{'colorscheme':'greenCarbon'}})\n", "v.animate({'interval':1000})\n", "\n", "v.zoomTo({'model':1})\n", "v.rotate(90)" ], "execution_count": null, "outputs": [ { "output_type": "display_data", "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": { "tags": [] } }, { "output_type": "execute_result", "data": { "text/plain": [ "" ] }, "metadata": { "tags": [] }, "execution_count": 10 } ] }, { "cell_type": "code", "metadata": { "id": "KGx4yPa7T9-1", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "0fd89cba-7acf-4f7d-a9e7-63802619926e" }, "source": [ "!apt install openbabel" ], "execution_count": null, "outputs": [ { "output_type": "stream", "text": [ "Reading package lists... Done\n", "Building dependency tree \n", "Reading state information... Done\n", "The following additional packages will be installed:\n", " libopenbabel4v5\n", "The following NEW packages will be installed:\n", " libopenbabel4v5 openbabel\n", "0 upgraded, 2 newly installed, 0 to remove and 30 not upgraded.\n", "Need to get 2,766 kB of archives.\n", "After this operation, 11.8 MB of additional disk space will be used.\n", "Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libopenbabel4v5 amd64 2.3.2+dfsg-3build1 [2,664 kB]\n", "Get:2 http://archive.ubuntu.com/ubuntu bionic/universe amd64 openbabel amd64 2.3.2+dfsg-3build1 [102 kB]\n", "Fetched 2,766 kB in 1s (3,349 kB/s)\n", "Selecting previously unselected package libopenbabel4v5.\n", "(Reading database ... 160980 files and directories currently installed.)\n", "Preparing to unpack .../libopenbabel4v5_2.3.2+dfsg-3build1_amd64.deb ...\n", "Unpacking libopenbabel4v5 (2.3.2+dfsg-3build1) ...\n", "Selecting previously unselected package openbabel.\n", "Preparing to unpack .../openbabel_2.3.2+dfsg-3build1_amd64.deb ...\n", "Unpacking openbabel (2.3.2+dfsg-3build1) ...\n", "Setting up libopenbabel4v5 (2.3.2+dfsg-3build1) ...\n", "Setting up openbabel (2.3.2+dfsg-3build1) ...\n", "Processing triggers for man-db (2.8.3-2ubuntu0.1) ...\n", "Processing triggers for libc-bin (2.27-3ubuntu1.2) ...\n", "/sbin/ldconfig.real: /usr/local/lib/python3.7/dist-packages/ideep4py/lib/libmkldnn.so.0 is not a symbolic link\n", "\n" ], "name": "stdout" } ] }, { "cell_type": "markdown", "metadata": { "id": "rLCnxKc8kuPM" }, "source": [ "The top ranked pose is \\<2A from the crystal pose" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "sZZP-zefkd5X", "outputId": "71e5f5ed-a927-4542-f96c-32bacb069de1" }, "source": [ "!obrms -firstonly lig.pdb docked.sdf" ], "execution_count": null, "outputs": [ { "output_type": "stream", "text": [ "RMSD 1.44189\n", "RMSD 6.42444\n", "RMSD 6.55838\n", "RMSD 6.46875\n", "RMSD 4.70466\n", "RMSD 4.7103\n", "RMSD 6.62497\n", "RMSD 2.96928\n", "RMSD 5.50917\n" ], "name": "stdout" } ] }, { "cell_type": "code", "metadata": { "id": "hc6314Cikk_2" }, "source": [ "" ], "execution_count": null, "outputs": [] } ] }