add more cutoff distances
Browse files- Untitled.ipynb +76 -0
- data/pdbbind_with_contacts.parquet +2 -2
- pdbbind.ipynb +177 -317
- pdbbind.py +3 -2
- protein_ligand_contacts.py +3 -1
Untitled.ipynb
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 11,
|
| 6 |
+
"id": "7e0c5ceb-24ca-426a-a99b-5e5f63561246",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [],
|
| 9 |
+
"source": [
|
| 10 |
+
"from datasets import load_dataset"
|
| 11 |
+
]
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"cell_type": "code",
|
| 15 |
+
"execution_count": 15,
|
| 16 |
+
"id": "03a41685-5d16-4555-a24b-c87d72a233fe",
|
| 17 |
+
"metadata": {},
|
| 18 |
+
"outputs": [
|
| 19 |
+
{
|
| 20 |
+
"name": "stderr",
|
| 21 |
+
"output_type": "stream",
|
| 22 |
+
"text": [
|
| 23 |
+
"Using custom data configuration default\n",
|
| 24 |
+
"Reusing dataset protein_ligand_contacts (/ccs/home/glaser/.cache/huggingface/datasets/jglaser___protein_ligand_contacts/default/1.4.1/2aba91a819153bdd9a95ce28edf727166722133978758c388eb80b7d587ecce7)\n"
|
| 25 |
+
]
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"data": {
|
| 29 |
+
"application/vnd.jupyter.widget-view+json": {
|
| 30 |
+
"model_id": "66fc86548a21486fa95dd318a6dba0bd",
|
| 31 |
+
"version_major": 2,
|
| 32 |
+
"version_minor": 0
|
| 33 |
+
},
|
| 34 |
+
"text/plain": [
|
| 35 |
+
" 0%| | 0/1 [00:00<?, ?it/s]"
|
| 36 |
+
]
|
| 37 |
+
},
|
| 38 |
+
"metadata": {},
|
| 39 |
+
"output_type": "display_data"
|
| 40 |
+
}
|
| 41 |
+
],
|
| 42 |
+
"source": [
|
| 43 |
+
"ds = load_dataset('jglaser/protein_ligand_contacts')"
|
| 44 |
+
]
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"cell_type": "code",
|
| 48 |
+
"execution_count": null,
|
| 49 |
+
"id": "bae10159-fc53-4dd8-9c7d-07837103dee3",
|
| 50 |
+
"metadata": {},
|
| 51 |
+
"outputs": [],
|
| 52 |
+
"source": []
|
| 53 |
+
}
|
| 54 |
+
],
|
| 55 |
+
"metadata": {
|
| 56 |
+
"kernelspec": {
|
| 57 |
+
"display_name": "Python 3 (ipykernel)",
|
| 58 |
+
"language": "python",
|
| 59 |
+
"name": "python3"
|
| 60 |
+
},
|
| 61 |
+
"language_info": {
|
| 62 |
+
"codemirror_mode": {
|
| 63 |
+
"name": "ipython",
|
| 64 |
+
"version": 3
|
| 65 |
+
},
|
| 66 |
+
"file_extension": ".py",
|
| 67 |
+
"mimetype": "text/x-python",
|
| 68 |
+
"name": "python",
|
| 69 |
+
"nbconvert_exporter": "python",
|
| 70 |
+
"pygments_lexer": "ipython3",
|
| 71 |
+
"version": "3.9.6"
|
| 72 |
+
}
|
| 73 |
+
},
|
| 74 |
+
"nbformat": 4,
|
| 75 |
+
"nbformat_minor": 5
|
| 76 |
+
}
|
data/pdbbind_with_contacts.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3d715ac89988ff2b436c53390e408145d3e6d2a9dd6771d29b52d5a48f0cb29d
|
| 3 |
+
size 157147287
|
pdbbind.ipynb
CHANGED
|
@@ -123,43 +123,27 @@
|
|
| 123 |
{
|
| 124 |
"cell_type": "code",
|
| 125 |
"execution_count": 8,
|
| 126 |
-
"id": "
|
| 127 |
"metadata": {},
|
| 128 |
"outputs": [],
|
| 129 |
"source": [
|
| 130 |
-
"
|
| 131 |
]
|
| 132 |
},
|
| 133 |
{
|
| 134 |
"cell_type": "code",
|
| 135 |
"execution_count": 9,
|
| 136 |
-
"id": "
|
| 137 |
"metadata": {},
|
| 138 |
"outputs": [],
|
| 139 |
"source": [
|
| 140 |
-
"
|
| 141 |
-
"import dask.dataframe as dd\n",
|
| 142 |
-
"from dask.bag import from_delayed\n",
|
| 143 |
-
"from dask import delayed\n",
|
| 144 |
-
"import pyarrow as pa\n",
|
| 145 |
-
"import pyarrow.parquet as pq"
|
| 146 |
]
|
| 147 |
},
|
| 148 |
{
|
| 149 |
"cell_type": "code",
|
| 150 |
"execution_count": 10,
|
| 151 |
-
"id": "
|
| 152 |
-
"metadata": {},
|
| 153 |
-
"outputs": [],
|
| 154 |
-
"source": [
|
| 155 |
-
"contacts_dask = da.from_npy_stack('data/pdbbind_contacts')\n",
|
| 156 |
-
"contacts_dask = contacts_dask.reshape(-1,contacts_dask.shape[-2]*contacts_dask.shape[-1])"
|
| 157 |
-
]
|
| 158 |
-
},
|
| 159 |
-
{
|
| 160 |
-
"cell_type": "code",
|
| 161 |
-
"execution_count": 11,
|
| 162 |
-
"id": "0e773f9d-6555-49c0-b0af-202c5e19b2cc",
|
| 163 |
"metadata": {},
|
| 164 |
"outputs": [
|
| 165 |
{
|
|
@@ -191,33 +175,33 @@
|
|
| 191 |
" <tbody>\n",
|
| 192 |
" <tr>\n",
|
| 193 |
" <th>0</th>\n",
|
| 194 |
-
" <td>
|
| 195 |
-
" <td>
|
| 196 |
-
" <td>
|
| 197 |
" </tr>\n",
|
| 198 |
" <tr>\n",
|
| 199 |
" <th>1</th>\n",
|
| 200 |
-
" <td>
|
| 201 |
-
" <td>
|
| 202 |
-
" <td>
|
| 203 |
" </tr>\n",
|
| 204 |
" <tr>\n",
|
| 205 |
" <th>2</th>\n",
|
| 206 |
-
" <td>
|
| 207 |
-
" <td>
|
| 208 |
-
" <td>
|
| 209 |
" </tr>\n",
|
| 210 |
" <tr>\n",
|
| 211 |
" <th>3</th>\n",
|
| 212 |
-
" <td>
|
| 213 |
-
" <td>
|
| 214 |
-
" <td>
|
| 215 |
" </tr>\n",
|
| 216 |
" <tr>\n",
|
| 217 |
" <th>4</th>\n",
|
| 218 |
-
" <td>
|
| 219 |
-
" <td>
|
| 220 |
-
" <td>
|
| 221 |
" </tr>\n",
|
| 222 |
" </tbody>\n",
|
| 223 |
"</table>\n",
|
|
@@ -225,32 +209,58 @@
|
|
| 225 |
],
|
| 226 |
"text/plain": [
|
| 227 |
" name seq \\\n",
|
| 228 |
-
"0
|
| 229 |
-
"1
|
| 230 |
-
"2
|
| 231 |
-
"3
|
| 232 |
-
"4
|
| 233 |
"\n",
|
| 234 |
" smiles \n",
|
| 235 |
-
"0
|
| 236 |
-
"1
|
| 237 |
-
"2
|
| 238 |
-
"3
|
| 239 |
-
"4
|
| 240 |
]
|
| 241 |
},
|
| 242 |
-
"execution_count":
|
| 243 |
"metadata": {},
|
| 244 |
"output_type": "execute_result"
|
| 245 |
}
|
| 246 |
],
|
| 247 |
"source": [
|
| 248 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
]
|
| 250 |
},
|
| 251 |
{
|
| 252 |
"cell_type": "code",
|
| 253 |
"execution_count": 12,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
"id": "9c7c9849-2345-4baf-89e7-d412f52353b6",
|
| 255 |
"metadata": {},
|
| 256 |
"outputs": [
|
|
@@ -298,37 +308,106 @@
|
|
| 298 |
"dask.array<blocks, shape=(438, 1043460), dtype=float32, chunksize=(438, 1043460), chunktype=numpy.ndarray>"
|
| 299 |
]
|
| 300 |
},
|
| 301 |
-
"execution_count":
|
| 302 |
"metadata": {},
|
| 303 |
"output_type": "execute_result"
|
| 304 |
}
|
| 305 |
],
|
| 306 |
"source": [
|
| 307 |
-
"contacts_dask.blocks[1]"
|
| 308 |
]
|
| 309 |
},
|
| 310 |
{
|
| 311 |
"cell_type": "code",
|
| 312 |
-
"execution_count":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
"id": "42e95d84-ef27-4417-9479-8b356462b8c3",
|
| 314 |
"metadata": {},
|
| 315 |
"outputs": [],
|
| 316 |
"source": [
|
| 317 |
"import numpy as np\n",
|
| 318 |
-
"
|
| 319 |
-
"
|
| 320 |
-
"
|
| 321 |
-
"
|
| 322 |
-
"
|
|
|
|
|
|
|
| 323 |
"\n",
|
| 324 |
-
"partitions = [delayed(chunk_to_sparse)(b,k)\n",
|
| 325 |
-
"
|
| 326 |
-
"
|
|
|
|
| 327 |
]
|
| 328 |
},
|
| 329 |
{
|
| 330 |
"cell_type": "code",
|
| 331 |
-
"execution_count":
|
| 332 |
"id": "5520a925-693f-43f0-9e76-df2e128f272e",
|
| 333 |
"metadata": {},
|
| 334 |
"outputs": [
|
|
@@ -354,106 +433,87 @@
|
|
| 354 |
" <tr style=\"text-align: right;\">\n",
|
| 355 |
" <th></th>\n",
|
| 356 |
" <th>name</th>\n",
|
| 357 |
-
" <th>
|
| 358 |
-
" <th>smiles</th>\n",
|
| 359 |
-
" <th>contacts</th>\n",
|
| 360 |
" </tr>\n",
|
| 361 |
" </thead>\n",
|
| 362 |
" <tbody>\n",
|
| 363 |
" <tr>\n",
|
| 364 |
" <th>0</th>\n",
|
| 365 |
-
" <td>
|
| 366 |
-
" <td>
|
| 367 |
-
" <td>CCCCCCCCCCCCCCCCCCCC(=O)O</td>\n",
|
| 368 |
-
" <td>[1043, 2569, 2570, 2573, 2575, 6121, 6122, 612...</td>\n",
|
| 369 |
" </tr>\n",
|
| 370 |
" <tr>\n",
|
| 371 |
" <th>1</th>\n",
|
| 372 |
-
" <td>
|
| 373 |
-
" <td>
|
| 374 |
-
" <td>O=[N+]([O-])c1cccc(OC2OC(CO)C(O)C(O)C2O)c1</td>\n",
|
| 375 |
-
" <td>[513, 517, 519, 520, 521, 522, 524, 525, 545, ...</td>\n",
|
| 376 |
" </tr>\n",
|
| 377 |
" <tr>\n",
|
| 378 |
" <th>2</th>\n",
|
| 379 |
-
" <td>
|
| 380 |
-
" <td>
|
| 381 |
-
" <td>COc1ccc(-c2c(-c3cc(C(C)C)c(O)cc3O)noc2NC(=O)C2...</td>\n",
|
| 382 |
-
" <td>[520, 522, 525, 541, 543, 545, 546, 547, 1038,...</td>\n",
|
| 383 |
" </tr>\n",
|
| 384 |
" <tr>\n",
|
| 385 |
" <th>3</th>\n",
|
| 386 |
-
" <td>
|
| 387 |
-
" <td>
|
| 388 |
-
" <td>COC1C(O)C(n2ccc(=O)[nH]c2=O)OC1C(OC1OC(C(=O)NC...</td>\n",
|
| 389 |
-
" <td>[35195, 35197, 35199, 35201, 35205, 35210, 352...</td>\n",
|
| 390 |
" </tr>\n",
|
| 391 |
" <tr>\n",
|
| 392 |
" <th>4</th>\n",
|
| 393 |
-
" <td>
|
| 394 |
-
" <td>
|
| 395 |
-
" <td>CC1(C)Cc2ccccc2C(NC(Cc2ccccc2)C(=O)O)=N1</td>\n",
|
| 396 |
-
" <td>[36231, 36232, 36234, 36235, 36236, 36237, 362...</td>\n",
|
| 397 |
" </tr>\n",
|
| 398 |
" </tbody>\n",
|
| 399 |
"</table>\n",
|
| 400 |
"</div>"
|
| 401 |
],
|
| 402 |
"text/plain": [
|
| 403 |
-
" name
|
| 404 |
-
"0
|
| 405 |
-
"1
|
| 406 |
-
"2
|
| 407 |
-
"3
|
| 408 |
-
"4
|
| 409 |
-
"\n",
|
| 410 |
-
" smiles \\\n",
|
| 411 |
-
"0 CCCCCCCCCCCCCCCCCCCC(=O)O \n",
|
| 412 |
-
"1 O=[N+]([O-])c1cccc(OC2OC(CO)C(O)C(O)C2O)c1 \n",
|
| 413 |
-
"2 COc1ccc(-c2c(-c3cc(C(C)C)c(O)cc3O)noc2NC(=O)C2... \n",
|
| 414 |
-
"3 COC1C(O)C(n2ccc(=O)[nH]c2=O)OC1C(OC1OC(C(=O)NC... \n",
|
| 415 |
-
"4 CC1(C)Cc2ccccc2C(NC(Cc2ccccc2)C(=O)O)=N1 \n",
|
| 416 |
-
"\n",
|
| 417 |
-
" contacts \n",
|
| 418 |
-
"0 [1043, 2569, 2570, 2573, 2575, 6121, 6122, 612... \n",
|
| 419 |
-
"1 [513, 517, 519, 520, 521, 522, 524, 525, 545, ... \n",
|
| 420 |
-
"2 [520, 522, 525, 541, 543, 545, 546, 547, 1038,... \n",
|
| 421 |
-
"3 [35195, 35197, 35199, 35201, 35205, 35210, 352... \n",
|
| 422 |
-
"4 [36231, 36232, 36234, 36235, 36236, 36237, 362... "
|
| 423 |
]
|
| 424 |
},
|
| 425 |
-
"execution_count":
|
| 426 |
"metadata": {},
|
| 427 |
"output_type": "execute_result"
|
| 428 |
}
|
| 429 |
],
|
| 430 |
"source": [
|
| 431 |
-
"
|
| 432 |
]
|
| 433 |
},
|
| 434 |
{
|
| 435 |
"cell_type": "code",
|
| 436 |
-
"execution_count":
|
| 437 |
"id": "4982c3b1-5ce9-4f17-9834-a02c4e136bc2",
|
| 438 |
"metadata": {},
|
| 439 |
"outputs": [],
|
| 440 |
"source": [
|
| 441 |
-
"
|
| 442 |
]
|
| 443 |
},
|
| 444 |
{
|
| 445 |
"cell_type": "code",
|
| 446 |
-
"execution_count":
|
| 447 |
"id": "f6cdee43-33c6-445c-8619-ace20f90638c",
|
| 448 |
"metadata": {},
|
| 449 |
"outputs": [],
|
| 450 |
"source": [
|
| 451 |
-
"ddf_all =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 452 |
]
|
| 453 |
},
|
| 454 |
{
|
| 455 |
"cell_type": "code",
|
| 456 |
-
"execution_count":
|
| 457 |
"id": "8f49f871-76f6-4fb2-b2db-c0794d4c07bf",
|
| 458 |
"metadata": {},
|
| 459 |
"outputs": [
|
|
@@ -461,8 +521,8 @@
|
|
| 461 |
"name": "stdout",
|
| 462 |
"output_type": "stream",
|
| 463 |
"text": [
|
| 464 |
-
"CPU times: user
|
| 465 |
-
"Wall time:
|
| 466 |
]
|
| 467 |
}
|
| 468 |
],
|
|
@@ -473,7 +533,7 @@
|
|
| 473 |
},
|
| 474 |
{
|
| 475 |
"cell_type": "code",
|
| 476 |
-
"execution_count":
|
| 477 |
"id": "45e4b4fa-6338-4abe-bd6e-8aea46e2a09c",
|
| 478 |
"metadata": {},
|
| 479 |
"outputs": [],
|
|
@@ -483,17 +543,17 @@
|
|
| 483 |
},
|
| 484 |
{
|
| 485 |
"cell_type": "code",
|
| 486 |
-
"execution_count":
|
| 487 |
"id": "7c3db301-6565-4053-bbd4-139bb41dd1c4",
|
| 488 |
"metadata": {},
|
| 489 |
"outputs": [
|
| 490 |
{
|
| 491 |
"data": {
|
| 492 |
"text/plain": [
|
| 493 |
-
"(array([6.
|
| 494 |
]
|
| 495 |
},
|
| 496 |
-
"execution_count":
|
| 497 |
"metadata": {},
|
| 498 |
"output_type": "execute_result"
|
| 499 |
}
|
|
@@ -507,7 +567,7 @@
|
|
| 507 |
},
|
| 508 |
{
|
| 509 |
"cell_type": "code",
|
| 510 |
-
"execution_count":
|
| 511 |
"id": "c9d674bb-d6a2-4810-aa2b-e3bc3b4bbc98",
|
| 512 |
"metadata": {},
|
| 513 |
"outputs": [],
|
|
@@ -516,206 +576,6 @@
|
|
| 516 |
"df_all_contacts.drop(columns=['name','affinity_quantity']).astype({'affinity': 'float32','neg_log10_affinity_M': 'float32'}).to_parquet('data/pdbbind_with_contacts.parquet',index=False)"
|
| 517 |
]
|
| 518 |
},
|
| 519 |
-
{
|
| 520 |
-
"cell_type": "code",
|
| 521 |
-
"execution_count": 127,
|
| 522 |
-
"id": "ec1afbc1-8072-4818-a925-0a9a6ad04759",
|
| 523 |
-
"metadata": {},
|
| 524 |
-
"outputs": [],
|
| 525 |
-
"source": [
|
| 526 |
-
"df_all = df_complex.merge(df_filter,on='name').drop('affinity',axis=1)"
|
| 527 |
-
]
|
| 528 |
-
},
|
| 529 |
-
{
|
| 530 |
-
"cell_type": "code",
|
| 531 |
-
"execution_count": 128,
|
| 532 |
-
"id": "744f1e6e-a097-4b8f-8d4b-1a54f564dab8",
|
| 533 |
-
"metadata": {},
|
| 534 |
-
"outputs": [
|
| 535 |
-
{
|
| 536 |
-
"data": {
|
| 537 |
-
"text/html": [
|
| 538 |
-
"<div>\n",
|
| 539 |
-
"<style scoped>\n",
|
| 540 |
-
" .dataframe tbody tr th:only-of-type {\n",
|
| 541 |
-
" vertical-align: middle;\n",
|
| 542 |
-
" }\n",
|
| 543 |
-
"\n",
|
| 544 |
-
" .dataframe tbody tr th {\n",
|
| 545 |
-
" vertical-align: top;\n",
|
| 546 |
-
" }\n",
|
| 547 |
-
"\n",
|
| 548 |
-
" .dataframe thead th {\n",
|
| 549 |
-
" text-align: right;\n",
|
| 550 |
-
" }\n",
|
| 551 |
-
"</style>\n",
|
| 552 |
-
"<table border=\"1\" class=\"dataframe\">\n",
|
| 553 |
-
" <thead>\n",
|
| 554 |
-
" <tr style=\"text-align: right;\">\n",
|
| 555 |
-
" <th></th>\n",
|
| 556 |
-
" <th>name</th>\n",
|
| 557 |
-
" <th>seq</th>\n",
|
| 558 |
-
" <th>smiles</th>\n",
|
| 559 |
-
" <th>affinity_uM</th>\n",
|
| 560 |
-
" <th>affinity_quantity</th>\n",
|
| 561 |
-
" </tr>\n",
|
| 562 |
-
" </thead>\n",
|
| 563 |
-
" <tbody>\n",
|
| 564 |
-
" <tr>\n",
|
| 565 |
-
" <th>0</th>\n",
|
| 566 |
-
" <td>2lbv</td>\n",
|
| 567 |
-
" <td>MTVPDRSEIAGKWYVVALASNTEFFLREKDKMKMAMARISFLGEDE...</td>\n",
|
| 568 |
-
" <td>CCCCCCCCCCCCCCCCCCCC(=O)O</td>\n",
|
| 569 |
-
" <td>0.026</td>\n",
|
| 570 |
-
" <td>Kd</td>\n",
|
| 571 |
-
" </tr>\n",
|
| 572 |
-
" <tr>\n",
|
| 573 |
-
" <th>1</th>\n",
|
| 574 |
-
" <td>1lt6</td>\n",
|
| 575 |
-
" <td>APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE...</td>\n",
|
| 576 |
-
" <td>O=[N+]([O-])c1cccc(OC2OC(CO)C(O)C(O)C2O)c1</td>\n",
|
| 577 |
-
" <td>500.000</td>\n",
|
| 578 |
-
" <td>IC50</td>\n",
|
| 579 |
-
" </tr>\n",
|
| 580 |
-
" <tr>\n",
|
| 581 |
-
" <th>2</th>\n",
|
| 582 |
-
" <td>4lwi</td>\n",
|
| 583 |
-
" <td>VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE...</td>\n",
|
| 584 |
-
" <td>COc1ccc(-c2c(-c3cc(C(C)C)c(O)cc3O)noc2NC(=O)C2...</td>\n",
|
| 585 |
-
" <td>0.023</td>\n",
|
| 586 |
-
" <td>IC50</td>\n",
|
| 587 |
-
" </tr>\n",
|
| 588 |
-
" <tr>\n",
|
| 589 |
-
" <th>3</th>\n",
|
| 590 |
-
" <td>6oyz</td>\n",
|
| 591 |
-
" <td>VQLQESGGGLVQTGGSLTLSCATSGRSFSLYAMAWFRQAPGKEREF...</td>\n",
|
| 592 |
-
" <td>COC1C(O)C(n2ccc(=O)[nH]c2=O)OC1C(OC1OC(C(=O)NC...</td>\n",
|
| 593 |
-
" <td>0.185</td>\n",
|
| 594 |
-
" <td>IC50</td>\n",
|
| 595 |
-
" </tr>\n",
|
| 596 |
-
" <tr>\n",
|
| 597 |
-
" <th>4</th>\n",
|
| 598 |
-
" <td>4i11</td>\n",
|
| 599 |
-
" <td>GSFVEMVDNLRGKSGQGYYVEMTVGSPPQTLNILVDTGSSNFAVGA...</td>\n",
|
| 600 |
-
" <td>CC1(C)Cc2ccccc2C(NC(Cc2ccccc2)C(=O)O)=N1</td>\n",
|
| 601 |
-
" <td>27.200</td>\n",
|
| 602 |
-
" <td>IC50</td>\n",
|
| 603 |
-
" </tr>\n",
|
| 604 |
-
" <tr>\n",
|
| 605 |
-
" <th>...</th>\n",
|
| 606 |
-
" <td>...</td>\n",
|
| 607 |
-
" <td>...</td>\n",
|
| 608 |
-
" <td>...</td>\n",
|
| 609 |
-
" <td>...</td>\n",
|
| 610 |
-
" <td>...</td>\n",
|
| 611 |
-
" </tr>\n",
|
| 612 |
-
" <tr>\n",
|
| 613 |
-
" <th>20822</th>\n",
|
| 614 |
-
" <td>2bok</td>\n",
|
| 615 |
-
" <td>IVGGQECKDGECPWQALLINEENEGFCGGTILSEFYILTAAHCLYQ...</td>\n",
|
| 616 |
-
" <td>C[N+](C)(C)CCCN1C(=O)C2C(C1=O)C(c1ccc(C(=N)N)c...</td>\n",
|
| 617 |
-
" <td>0.280</td>\n",
|
| 618 |
-
" <td>Ki</td>\n",
|
| 619 |
-
" </tr>\n",
|
| 620 |
-
" <tr>\n",
|
| 621 |
-
" <th>20823</th>\n",
|
| 622 |
-
" <td>4j46</td>\n",
|
| 623 |
-
" <td>GTIYPRNPAMYSEEARLKSFQNWPDYAHLTPRELASAGLYYTGIGD...</td>\n",
|
| 624 |
-
" <td>CCC(C)C(NC(=O)C1CCCN1C(=O)C(NC(=O)C(C)[NH3+])C...</td>\n",
|
| 625 |
-
" <td>5.240</td>\n",
|
| 626 |
-
" <td>Ki</td>\n",
|
| 627 |
-
" </tr>\n",
|
| 628 |
-
" <tr>\n",
|
| 629 |
-
" <th>20824</th>\n",
|
| 630 |
-
" <td>4j46</td>\n",
|
| 631 |
-
" <td>GTIYPRNPAMYSEEARLKSFQNWPDYAHLTPRELASAGLYYTGIGD...</td>\n",
|
| 632 |
-
" <td>CCC(C)C(NC(=O)C1CCCN1C(=O)C(NC(=O)C(C)[NH3+])C...</td>\n",
|
| 633 |
-
" <td>5.240</td>\n",
|
| 634 |
-
" <td>Ki</td>\n",
|
| 635 |
-
" </tr>\n",
|
| 636 |
-
" <tr>\n",
|
| 637 |
-
" <th>20825</th>\n",
|
| 638 |
-
" <td>2c80</td>\n",
|
| 639 |
-
" <td>DHIKVIYFNGRGRAESIRMTLVAAGVNYEDERISFQDWPKIKPTIP...</td>\n",
|
| 640 |
-
" <td>CCCCCCSCC(NC(=O)CCC([NH3+])C(=O)O)C(=O)NCC(=O)O</td>\n",
|
| 641 |
-
" <td>4.700</td>\n",
|
| 642 |
-
" <td>Kd</td>\n",
|
| 643 |
-
" </tr>\n",
|
| 644 |
-
" <tr>\n",
|
| 645 |
-
" <th>20826</th>\n",
|
| 646 |
-
" <td>2c80</td>\n",
|
| 647 |
-
" <td>DHIKVIYFNGRGRAESIRMTLVAAGVNYEDERISFQDWPKIKPTIP...</td>\n",
|
| 648 |
-
" <td>CCCCCCSCC(NC(=O)CCC([NH3+])C(=O)O)C(=O)NCC(=O)O</td>\n",
|
| 649 |
-
" <td>4.700</td>\n",
|
| 650 |
-
" <td>Kd</td>\n",
|
| 651 |
-
" </tr>\n",
|
| 652 |
-
" </tbody>\n",
|
| 653 |
-
"</table>\n",
|
| 654 |
-
"<p>20827 rows × 5 columns</p>\n",
|
| 655 |
-
"</div>"
|
| 656 |
-
],
|
| 657 |
-
"text/plain": [
|
| 658 |
-
" name seq \\\n",
|
| 659 |
-
"0 2lbv MTVPDRSEIAGKWYVVALASNTEFFLREKDKMKMAMARISFLGEDE... \n",
|
| 660 |
-
"1 1lt6 APQTITELCSEYRNTQIYTINDKILSYTESMAGKREMVIITFKSGE... \n",
|
| 661 |
-
"2 4lwi VETFAFQAEIAQLMSLIINTFYSNKEIFLRELISNSSDALDKIRYE... \n",
|
| 662 |
-
"3 6oyz VQLQESGGGLVQTGGSLTLSCATSGRSFSLYAMAWFRQAPGKEREF... \n",
|
| 663 |
-
"4 4i11 GSFVEMVDNLRGKSGQGYYVEMTVGSPPQTLNILVDTGSSNFAVGA... \n",
|
| 664 |
-
"... ... ... \n",
|
| 665 |
-
"20822 2bok IVGGQECKDGECPWQALLINEENEGFCGGTILSEFYILTAAHCLYQ... \n",
|
| 666 |
-
"20823 4j46 GTIYPRNPAMYSEEARLKSFQNWPDYAHLTPRELASAGLYYTGIGD... \n",
|
| 667 |
-
"20824 4j46 GTIYPRNPAMYSEEARLKSFQNWPDYAHLTPRELASAGLYYTGIGD... \n",
|
| 668 |
-
"20825 2c80 DHIKVIYFNGRGRAESIRMTLVAAGVNYEDERISFQDWPKIKPTIP... \n",
|
| 669 |
-
"20826 2c80 DHIKVIYFNGRGRAESIRMTLVAAGVNYEDERISFQDWPKIKPTIP... \n",
|
| 670 |
-
"\n",
|
| 671 |
-
" smiles affinity_uM \\\n",
|
| 672 |
-
"0 CCCCCCCCCCCCCCCCCCCC(=O)O 0.026 \n",
|
| 673 |
-
"1 O=[N+]([O-])c1cccc(OC2OC(CO)C(O)C(O)C2O)c1 500.000 \n",
|
| 674 |
-
"2 COc1ccc(-c2c(-c3cc(C(C)C)c(O)cc3O)noc2NC(=O)C2... 0.023 \n",
|
| 675 |
-
"3 COC1C(O)C(n2ccc(=O)[nH]c2=O)OC1C(OC1OC(C(=O)NC... 0.185 \n",
|
| 676 |
-
"4 CC1(C)Cc2ccccc2C(NC(Cc2ccccc2)C(=O)O)=N1 27.200 \n",
|
| 677 |
-
"... ... ... \n",
|
| 678 |
-
"20822 C[N+](C)(C)CCCN1C(=O)C2C(C1=O)C(c1ccc(C(=N)N)c... 0.280 \n",
|
| 679 |
-
"20823 CCC(C)C(NC(=O)C1CCCN1C(=O)C(NC(=O)C(C)[NH3+])C... 5.240 \n",
|
| 680 |
-
"20824 CCC(C)C(NC(=O)C1CCCN1C(=O)C(NC(=O)C(C)[NH3+])C... 5.240 \n",
|
| 681 |
-
"20825 CCCCCCSCC(NC(=O)CCC([NH3+])C(=O)O)C(=O)NCC(=O)O 4.700 \n",
|
| 682 |
-
"20826 CCCCCCSCC(NC(=O)CCC([NH3+])C(=O)O)C(=O)NCC(=O)O 4.700 \n",
|
| 683 |
-
"\n",
|
| 684 |
-
" affinity_quantity \n",
|
| 685 |
-
"0 Kd \n",
|
| 686 |
-
"1 IC50 \n",
|
| 687 |
-
"2 IC50 \n",
|
| 688 |
-
"3 IC50 \n",
|
| 689 |
-
"4 IC50 \n",
|
| 690 |
-
"... ... \n",
|
| 691 |
-
"20822 Ki \n",
|
| 692 |
-
"20823 Ki \n",
|
| 693 |
-
"20824 Ki \n",
|
| 694 |
-
"20825 Kd \n",
|
| 695 |
-
"20826 Kd \n",
|
| 696 |
-
"\n",
|
| 697 |
-
"[20827 rows x 5 columns]"
|
| 698 |
-
]
|
| 699 |
-
},
|
| 700 |
-
"execution_count": 128,
|
| 701 |
-
"metadata": {},
|
| 702 |
-
"output_type": "execute_result"
|
| 703 |
-
}
|
| 704 |
-
],
|
| 705 |
-
"source": [
|
| 706 |
-
"df_all"
|
| 707 |
-
]
|
| 708 |
-
},
|
| 709 |
-
{
|
| 710 |
-
"cell_type": "code",
|
| 711 |
-
"execution_count": 14,
|
| 712 |
-
"id": "8f75499c-8895-4395-867e-7d9a9d394910",
|
| 713 |
-
"metadata": {},
|
| 714 |
-
"outputs": [],
|
| 715 |
-
"source": [
|
| 716 |
-
"df_all.to_parquet('data/pdbbind.parquet')"
|
| 717 |
-
]
|
| 718 |
-
},
|
| 719 |
{
|
| 720 |
"cell_type": "code",
|
| 721 |
"execution_count": null,
|
|
|
|
| 123 |
{
|
| 124 |
"cell_type": "code",
|
| 125 |
"execution_count": 8,
|
| 126 |
+
"id": "802cb9bc-2563-4d7f-9a76-3be2d9263a36",
|
| 127 |
"metadata": {},
|
| 128 |
"outputs": [],
|
| 129 |
"source": [
|
| 130 |
+
"cutoffs = [5,8,11]"
|
| 131 |
]
|
| 132 |
},
|
| 133 |
{
|
| 134 |
"cell_type": "code",
|
| 135 |
"execution_count": 9,
|
| 136 |
+
"id": "d6dda488-f709-4fe7-b372-080042cf7c66",
|
| 137 |
"metadata": {},
|
| 138 |
"outputs": [],
|
| 139 |
"source": [
|
| 140 |
+
"dfs_complex = {c: pd.read_parquet('data/pdbbind_complex_{}.parquet'.format(c)) for c in cutoffs}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
]
|
| 142 |
},
|
| 143 |
{
|
| 144 |
"cell_type": "code",
|
| 145 |
"execution_count": 10,
|
| 146 |
+
"id": "aebc6791-5bb0-4828-9697-79bc243f8992",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
"metadata": {},
|
| 148 |
"outputs": [
|
| 149 |
{
|
|
|
|
| 175 |
" <tbody>\n",
|
| 176 |
" <tr>\n",
|
| 177 |
" <th>0</th>\n",
|
| 178 |
+
" <td>10gs</td>\n",
|
| 179 |
+
" <td>PYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKASC...</td>\n",
|
| 180 |
+
" <td>[NH3+]C(CCC(=O)NC(CSCc1ccccc1)C(=O)NC(C(=O)O)c...</td>\n",
|
| 181 |
" </tr>\n",
|
| 182 |
" <tr>\n",
|
| 183 |
" <th>1</th>\n",
|
| 184 |
+
" <td>184l</td>\n",
|
| 185 |
+
" <td>MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL...</td>\n",
|
| 186 |
+
" <td>CC(C)Cc1ccccc1</td>\n",
|
| 187 |
" </tr>\n",
|
| 188 |
" <tr>\n",
|
| 189 |
" <th>2</th>\n",
|
| 190 |
+
" <td>186l</td>\n",
|
| 191 |
+
" <td>MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL...</td>\n",
|
| 192 |
+
" <td>CCCCc1ccccc1</td>\n",
|
| 193 |
" </tr>\n",
|
| 194 |
" <tr>\n",
|
| 195 |
" <th>3</th>\n",
|
| 196 |
+
" <td>187l</td>\n",
|
| 197 |
+
" <td>MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL...</td>\n",
|
| 198 |
+
" <td>Cc1ccc(C)cc1</td>\n",
|
| 199 |
" </tr>\n",
|
| 200 |
" <tr>\n",
|
| 201 |
" <th>4</th>\n",
|
| 202 |
+
" <td>188l</td>\n",
|
| 203 |
+
" <td>MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL...</td>\n",
|
| 204 |
+
" <td>Cc1ccccc1C</td>\n",
|
| 205 |
" </tr>\n",
|
| 206 |
" </tbody>\n",
|
| 207 |
"</table>\n",
|
|
|
|
| 209 |
],
|
| 210 |
"text/plain": [
|
| 211 |
" name seq \\\n",
|
| 212 |
+
"0 10gs PYTVVYFPVRGRCAALRMLLADQGQSWKEEVVTVETWQEGSLKASC... \n",
|
| 213 |
+
"1 184l MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL... \n",
|
| 214 |
+
"2 186l MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL... \n",
|
| 215 |
+
"3 187l MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL... \n",
|
| 216 |
+
"4 188l MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSEL... \n",
|
| 217 |
"\n",
|
| 218 |
" smiles \n",
|
| 219 |
+
"0 [NH3+]C(CCC(=O)NC(CSCc1ccccc1)C(=O)NC(C(=O)O)c... \n",
|
| 220 |
+
"1 CC(C)Cc1ccccc1 \n",
|
| 221 |
+
"2 CCCCc1ccccc1 \n",
|
| 222 |
+
"3 Cc1ccc(C)cc1 \n",
|
| 223 |
+
"4 Cc1ccccc1C "
|
| 224 |
]
|
| 225 |
},
|
| 226 |
+
"execution_count": 10,
|
| 227 |
"metadata": {},
|
| 228 |
"output_type": "execute_result"
|
| 229 |
}
|
| 230 |
],
|
| 231 |
"source": [
|
| 232 |
+
"list(dfs_complex.values())[0].head()"
|
| 233 |
+
]
|
| 234 |
+
},
|
| 235 |
+
{
|
| 236 |
+
"cell_type": "code",
|
| 237 |
+
"execution_count": 11,
|
| 238 |
+
"id": "ed3fe035-6035-4d39-b072-d12dc0a95857",
|
| 239 |
+
"metadata": {},
|
| 240 |
+
"outputs": [],
|
| 241 |
+
"source": [
|
| 242 |
+
"import dask.array as da\n",
|
| 243 |
+
"import dask.dataframe as dd\n",
|
| 244 |
+
"from dask.bag import from_delayed\n",
|
| 245 |
+
"from dask import delayed\n",
|
| 246 |
+
"import pyarrow as pa\n",
|
| 247 |
+
"import pyarrow.parquet as pq"
|
| 248 |
]
|
| 249 |
},
|
| 250 |
{
|
| 251 |
"cell_type": "code",
|
| 252 |
"execution_count": 12,
|
| 253 |
+
"id": "cd26125b-e68b-4fa3-846e-2b6e7f635fe0",
|
| 254 |
+
"metadata": {},
|
| 255 |
+
"outputs": [],
|
| 256 |
+
"source": [
|
| 257 |
+
"contacts_dask = [da.from_npy_stack('data/pdbbind_contacts_{}'.format(c)) for c in cutoffs]\n",
|
| 258 |
+
"contacts_dask = [c.reshape(-1,c.shape[-2]*c.shape[-1]) for c in contacts_dask]"
|
| 259 |
+
]
|
| 260 |
+
},
|
| 261 |
+
{
|
| 262 |
+
"cell_type": "code",
|
| 263 |
+
"execution_count": 13,
|
| 264 |
"id": "9c7c9849-2345-4baf-89e7-d412f52353b6",
|
| 265 |
"metadata": {},
|
| 266 |
"outputs": [
|
|
|
|
| 308 |
"dask.array<blocks, shape=(438, 1043460), dtype=float32, chunksize=(438, 1043460), chunktype=numpy.ndarray>"
|
| 309 |
]
|
| 310 |
},
|
| 311 |
+
"execution_count": 13,
|
| 312 |
"metadata": {},
|
| 313 |
"output_type": "execute_result"
|
| 314 |
}
|
| 315 |
],
|
| 316 |
"source": [
|
| 317 |
+
"contacts_dask[0].blocks[1]"
|
| 318 |
]
|
| 319 |
},
|
| 320 |
{
|
| 321 |
"cell_type": "code",
|
| 322 |
+
"execution_count": 14,
|
| 323 |
+
"id": "0bd8e9b9-9713-4572-bd7f-dc47da9fce91",
|
| 324 |
+
"metadata": {},
|
| 325 |
+
"outputs": [
|
| 326 |
+
{
|
| 327 |
+
"data": {
|
| 328 |
+
"text/plain": [
|
| 329 |
+
"[16206, 16181, 16172]"
|
| 330 |
+
]
|
| 331 |
+
},
|
| 332 |
+
"execution_count": 14,
|
| 333 |
+
"metadata": {},
|
| 334 |
+
"output_type": "execute_result"
|
| 335 |
+
}
|
| 336 |
+
],
|
| 337 |
+
"source": [
|
| 338 |
+
"[len(c) for c in contacts_dask]"
|
| 339 |
+
]
|
| 340 |
+
},
|
| 341 |
+
{
|
| 342 |
+
"cell_type": "code",
|
| 343 |
+
"execution_count": 15,
|
| 344 |
+
"id": "87493934-3839-476a-a975-7da057c320da",
|
| 345 |
+
"metadata": {},
|
| 346 |
+
"outputs": [
|
| 347 |
+
{
|
| 348 |
+
"data": {
|
| 349 |
+
"text/plain": [
|
| 350 |
+
"16206"
|
| 351 |
+
]
|
| 352 |
+
},
|
| 353 |
+
"execution_count": 15,
|
| 354 |
+
"metadata": {},
|
| 355 |
+
"output_type": "execute_result"
|
| 356 |
+
}
|
| 357 |
+
],
|
| 358 |
+
"source": [
|
| 359 |
+
"contacts_dask[0].shape[0]"
|
| 360 |
+
]
|
| 361 |
+
},
|
| 362 |
+
{
|
| 363 |
+
"cell_type": "code",
|
| 364 |
+
"execution_count": 16,
|
| 365 |
+
"id": "1f7815ec-cddf-4bae-b72c-89cdf56cc1f9",
|
| 366 |
+
"metadata": {},
|
| 367 |
+
"outputs": [
|
| 368 |
+
{
|
| 369 |
+
"data": {
|
| 370 |
+
"text/plain": [
|
| 371 |
+
"name 9lpr\n",
|
| 372 |
+
"seq ANIVGGIEYSINNASLCSVGFSVTRGATKGFVTAGHCGTVNATARI...\n",
|
| 373 |
+
"smiles CC(C)CC(NC(=O)C1CCCN1C(=O)C(C)NC(=O)C(C)[NH3+]...\n",
|
| 374 |
+
"Name: 16205, dtype: object"
|
| 375 |
+
]
|
| 376 |
+
},
|
| 377 |
+
"execution_count": 16,
|
| 378 |
+
"metadata": {},
|
| 379 |
+
"output_type": "execute_result"
|
| 380 |
+
}
|
| 381 |
+
],
|
| 382 |
+
"source": [
|
| 383 |
+
"dfs_complex[5].iloc[16205]"
|
| 384 |
+
]
|
| 385 |
+
},
|
| 386 |
+
{
|
| 387 |
+
"cell_type": "code",
|
| 388 |
+
"execution_count": 17,
|
| 389 |
"id": "42e95d84-ef27-4417-9479-8b356462b8c3",
|
| 390 |
"metadata": {},
|
| 391 |
"outputs": [],
|
| 392 |
"source": [
|
| 393 |
"import numpy as np\n",
|
| 394 |
+
"all_partitions = []\n",
|
| 395 |
+
"for c, cutoff in zip(contacts_dask,cutoffs):\n",
|
| 396 |
+
" def chunk_to_sparse(rcut, chunk, idx_chunk):\n",
|
| 397 |
+
" res = dfs_complex[rcut].iloc[idx_chunk][['name']].copy()\n",
|
| 398 |
+
" # pad to account for [CLS] and [SEP]\n",
|
| 399 |
+
" res['contacts_{}A'.format(rcut)] = [np.where(np.pad(a,pad_width=(1,1)))[0] for a in chunk]\n",
|
| 400 |
+
" return res\n",
|
| 401 |
"\n",
|
| 402 |
+
" partitions = [delayed(chunk_to_sparse)(cutoff,b,k)\n",
|
| 403 |
+
" for b,k in zip(c.blocks, da.arange(c.shape[0],chunks=c.chunks[0:1]).blocks)\n",
|
| 404 |
+
" ]\n",
|
| 405 |
+
" all_partitions.append(partitions)"
|
| 406 |
]
|
| 407 |
},
|
| 408 |
{
|
| 409 |
"cell_type": "code",
|
| 410 |
+
"execution_count": 18,
|
| 411 |
"id": "5520a925-693f-43f0-9e76-df2e128f272e",
|
| 412 |
"metadata": {},
|
| 413 |
"outputs": [
|
|
|
|
| 433 |
" <tr style=\"text-align: right;\">\n",
|
| 434 |
" <th></th>\n",
|
| 435 |
" <th>name</th>\n",
|
| 436 |
+
" <th>contacts_5A</th>\n",
|
|
|
|
|
|
|
| 437 |
" </tr>\n",
|
| 438 |
" </thead>\n",
|
| 439 |
" <tbody>\n",
|
| 440 |
" <tr>\n",
|
| 441 |
" <th>0</th>\n",
|
| 442 |
+
" <td>10gs</td>\n",
|
| 443 |
+
" <td>[1021, 1022, 1070, 1073, 1075, 3071, 3072, 307...</td>\n",
|
|
|
|
|
|
|
| 444 |
" </tr>\n",
|
| 445 |
" <tr>\n",
|
| 446 |
" <th>1</th>\n",
|
| 447 |
+
" <td>184l</td>\n",
|
| 448 |
+
" <td>[39279, 39280, 39281, 39282, 42332, 42334, 423...</td>\n",
|
|
|
|
|
|
|
| 449 |
" </tr>\n",
|
| 450 |
" <tr>\n",
|
| 451 |
" <th>2</th>\n",
|
| 452 |
+
" <td>186l</td>\n",
|
| 453 |
+
" <td>[39277, 39278, 39279, 42332, 42333, 42334, 423...</td>\n",
|
|
|
|
|
|
|
| 454 |
" </tr>\n",
|
| 455 |
" <tr>\n",
|
| 456 |
" <th>3</th>\n",
|
| 457 |
+
" <td>187l</td>\n",
|
| 458 |
+
" <td>[39271, 39272, 39281, 42331, 42332, 42334, 423...</td>\n",
|
|
|
|
|
|
|
| 459 |
" </tr>\n",
|
| 460 |
" <tr>\n",
|
| 461 |
" <th>4</th>\n",
|
| 462 |
+
" <td>188l</td>\n",
|
| 463 |
+
" <td>[39271, 39272, 39274, 39275, 42331, 42332, 423...</td>\n",
|
|
|
|
|
|
|
| 464 |
" </tr>\n",
|
| 465 |
" </tbody>\n",
|
| 466 |
"</table>\n",
|
| 467 |
"</div>"
|
| 468 |
],
|
| 469 |
"text/plain": [
|
| 470 |
+
" name contacts_5A\n",
|
| 471 |
+
"0 10gs [1021, 1022, 1070, 1073, 1075, 3071, 3072, 307...\n",
|
| 472 |
+
"1 184l [39279, 39280, 39281, 39282, 42332, 42334, 423...\n",
|
| 473 |
+
"2 186l [39277, 39278, 39279, 42332, 42333, 42334, 423...\n",
|
| 474 |
+
"3 187l [39271, 39272, 39281, 42331, 42332, 42334, 423...\n",
|
| 475 |
+
"4 188l [39271, 39272, 39274, 39275, 42331, 42332, 423..."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 476 |
]
|
| 477 |
},
|
| 478 |
+
"execution_count": 18,
|
| 479 |
"metadata": {},
|
| 480 |
"output_type": "execute_result"
|
| 481 |
}
|
| 482 |
],
|
| 483 |
"source": [
|
| 484 |
+
"all_partitions[0][0].compute().head()"
|
| 485 |
]
|
| 486 |
},
|
| 487 |
{
|
| 488 |
"cell_type": "code",
|
| 489 |
+
"execution_count": 19,
|
| 490 |
"id": "4982c3b1-5ce9-4f17-9834-a02c4e136bc2",
|
| 491 |
"metadata": {},
|
| 492 |
"outputs": [],
|
| 493 |
"source": [
|
| 494 |
+
"ddfs = [dd.from_delayed(p) for p in all_partitions]"
|
| 495 |
]
|
| 496 |
},
|
| 497 |
{
|
| 498 |
"cell_type": "code",
|
| 499 |
+
"execution_count": 20,
|
| 500 |
"id": "f6cdee43-33c6-445c-8619-ace20f90638c",
|
| 501 |
"metadata": {},
|
| 502 |
"outputs": [],
|
| 503 |
"source": [
|
| 504 |
+
"ddf_all = None\n",
|
| 505 |
+
"for d in ddfs:\n",
|
| 506 |
+
" if ddf_all is not None:\n",
|
| 507 |
+
" ddf_all = ddf_all.merge(d, on='name')\n",
|
| 508 |
+
" else:\n",
|
| 509 |
+
" ddf_all = d\n",
|
| 510 |
+
"ddf_all = ddf_all.merge(df_filter,on='name')\n",
|
| 511 |
+
"ddf_all = ddf_all.merge(list(dfs_complex.values())[0],on='name')"
|
| 512 |
]
|
| 513 |
},
|
| 514 |
{
|
| 515 |
"cell_type": "code",
|
| 516 |
+
"execution_count": 21,
|
| 517 |
"id": "8f49f871-76f6-4fb2-b2db-c0794d4c07bf",
|
| 518 |
"metadata": {},
|
| 519 |
"outputs": [
|
|
|
|
| 521 |
"name": "stdout",
|
| 522 |
"output_type": "stream",
|
| 523 |
"text": [
|
| 524 |
+
"CPU times: user 6min 9s, sys: 12min 7s, total: 18min 17s\n",
|
| 525 |
+
"Wall time: 7min 36s\n"
|
| 526 |
]
|
| 527 |
}
|
| 528 |
],
|
|
|
|
| 533 |
},
|
| 534 |
{
|
| 535 |
"cell_type": "code",
|
| 536 |
+
"execution_count": 22,
|
| 537 |
"id": "45e4b4fa-6338-4abe-bd6e-8aea46e2a09c",
|
| 538 |
"metadata": {},
|
| 539 |
"outputs": [],
|
|
|
|
| 543 |
},
|
| 544 |
{
|
| 545 |
"cell_type": "code",
|
| 546 |
+
"execution_count": 23,
|
| 547 |
"id": "7c3db301-6565-4053-bbd4-139bb41dd1c4",
|
| 548 |
"metadata": {},
|
| 549 |
"outputs": [
|
| 550 |
{
|
| 551 |
"data": {
|
| 552 |
"text/plain": [
|
| 553 |
+
"(array([6.35008182]), array([3.56554195]))"
|
| 554 |
]
|
| 555 |
},
|
| 556 |
+
"execution_count": 23,
|
| 557 |
"metadata": {},
|
| 558 |
"output_type": "execute_result"
|
| 559 |
}
|
|
|
|
| 567 |
},
|
| 568 |
{
|
| 569 |
"cell_type": "code",
|
| 570 |
+
"execution_count": 24,
|
| 571 |
"id": "c9d674bb-d6a2-4810-aa2b-e3bc3b4bbc98",
|
| 572 |
"metadata": {},
|
| 573 |
"outputs": [],
|
|
|
|
| 576 |
"df_all_contacts.drop(columns=['name','affinity_quantity']).astype({'affinity': 'float32','neg_log10_affinity_M': 'float32'}).to_parquet('data/pdbbind_with_contacts.parquet',index=False)"
|
| 577 |
]
|
| 578 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 579 |
{
|
| 580 |
"cell_type": "code",
|
| 581 |
"execution_count": null,
|
pdbbind.py
CHANGED
|
@@ -90,6 +90,7 @@ if __name__ == '__main__':
|
|
| 90 |
|
| 91 |
filenames = glob.glob('data/pdbbind/v2020-other-PL/*')
|
| 92 |
filenames.extend(glob.glob('data/pdbbind/refined-set/*'))
|
|
|
|
| 93 |
comm = MPI.COMM_WORLD
|
| 94 |
with MPICommExecutor(comm, root=0) as executor:
|
| 95 |
if executor is not None:
|
|
@@ -103,5 +104,5 @@ if __name__ == '__main__':
|
|
| 103 |
import pandas as pd
|
| 104 |
df = pd.DataFrame({'name': names, 'seq': seqs, 'smiles': all_smiles})
|
| 105 |
all_contacts = da.from_array(all_contacts, chunks=chunk_size)
|
| 106 |
-
da.to_npy_stack('data/
|
| 107 |
-
df.to_parquet('data/
|
|
|
|
| 90 |
|
| 91 |
filenames = glob.glob('data/pdbbind/v2020-other-PL/*')
|
| 92 |
filenames.extend(glob.glob('data/pdbbind/refined-set/*'))
|
| 93 |
+
filenames = sorted(filenames)
|
| 94 |
comm = MPI.COMM_WORLD
|
| 95 |
with MPICommExecutor(comm, root=0) as executor:
|
| 96 |
if executor is not None:
|
|
|
|
| 104 |
import pandas as pd
|
| 105 |
df = pd.DataFrame({'name': names, 'seq': seqs, 'smiles': all_smiles})
|
| 106 |
all_contacts = da.from_array(all_contacts, chunks=chunk_size)
|
| 107 |
+
da.to_npy_stack('data/pdbbind_contacts_{}/'.format(cutoff), all_contacts)
|
| 108 |
+
df.to_parquet('data/pdbbind_complex_{}.parquet'.format(cutoff))
|
protein_ligand_contacts.py
CHANGED
|
@@ -78,7 +78,9 @@ class ProteinLigandContacts(datasets.ArrowBasedBuilder):
|
|
| 78 |
"affinity_uM": datasets.Value("float"),
|
| 79 |
"neg_log10_affinity_M": datasets.Value("float"),
|
| 80 |
"affinity": datasets.Value("float"),
|
| 81 |
-
"
|
|
|
|
|
|
|
| 82 |
# These are the features of your dataset like images, labels ...
|
| 83 |
}
|
| 84 |
)
|
|
|
|
| 78 |
"affinity_uM": datasets.Value("float"),
|
| 79 |
"neg_log10_affinity_M": datasets.Value("float"),
|
| 80 |
"affinity": datasets.Value("float"),
|
| 81 |
+
"contacts_5A": datasets.Sequence(datasets.Value('int64')),
|
| 82 |
+
"contacts_8A": datasets.Sequence(datasets.Value('int64')),
|
| 83 |
+
"contacts_11A": datasets.Sequence(datasets.Value('int64')),
|
| 84 |
# These are the features of your dataset like images, labels ...
|
| 85 |
}
|
| 86 |
)
|