{
"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": [
""
]
},
{
"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": "
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
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