fix two indexing bugs
Browse files- README.md +1 -1
- data/pdbbind_with_contacts.parquet +2 -2
- pdbbind.ipynb +86 -170
- pdbbind.py +2 -1
README.md
CHANGED
@@ -17,7 +17,7 @@ It can be used for fine-tuning a language model.
|
|
17 |
|
18 |
The data solely uses data from PDBind-cn.
|
19 |
|
20 |
-
Contacts are calculated at
|
21 |
|
22 |
### Use the already preprocessed data
|
23 |
|
|
|
17 |
|
18 |
The data solely uses data from PDBind-cn.
|
19 |
|
20 |
+
Contacts are calculated at four cut-off distances: 5, 8, 11A and 15A.
|
21 |
|
22 |
### Use the already preprocessed data
|
23 |
|
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:904aa3f182745b92c36d97fdc8a4b14a7a19bfe2f88cf05be38ea35f2287d6c3
|
3 |
+
size 366634766
|
pdbbind.ipynb
CHANGED
@@ -111,7 +111,7 @@
|
|
111 |
},
|
112 |
{
|
113 |
"cell_type": "code",
|
114 |
-
"execution_count":
|
115 |
"id": "aa358835-55f3-4551-9217-e76a15de4fe8",
|
116 |
"metadata": {},
|
117 |
"outputs": [],
|
@@ -122,18 +122,18 @@
|
|
122 |
},
|
123 |
{
|
124 |
"cell_type": "code",
|
125 |
-
"execution_count":
|
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":
|
136 |
-
"id": "
|
137 |
"metadata": {},
|
138 |
"outputs": [],
|
139 |
"source": [
|
@@ -142,99 +142,7 @@
|
|
142 |
},
|
143 |
{
|
144 |
"cell_type": "code",
|
145 |
-
"execution_count":
|
146 |
-
"id": "aebc6791-5bb0-4828-9697-79bc243f8992",
|
147 |
-
"metadata": {},
|
148 |
-
"outputs": [
|
149 |
-
{
|
150 |
-
"data": {
|
151 |
-
"text/html": [
|
152 |
-
"<div>\n",
|
153 |
-
"<style scoped>\n",
|
154 |
-
" .dataframe tbody tr th:only-of-type {\n",
|
155 |
-
" vertical-align: middle;\n",
|
156 |
-
" }\n",
|
157 |
-
"\n",
|
158 |
-
" .dataframe tbody tr th {\n",
|
159 |
-
" vertical-align: top;\n",
|
160 |
-
" }\n",
|
161 |
-
"\n",
|
162 |
-
" .dataframe thead th {\n",
|
163 |
-
" text-align: right;\n",
|
164 |
-
" }\n",
|
165 |
-
"</style>\n",
|
166 |
-
"<table border=\"1\" class=\"dataframe\">\n",
|
167 |
-
" <thead>\n",
|
168 |
-
" <tr style=\"text-align: right;\">\n",
|
169 |
-
" <th></th>\n",
|
170 |
-
" <th>name</th>\n",
|
171 |
-
" <th>seq</th>\n",
|
172 |
-
" <th>smiles</th>\n",
|
173 |
-
" </tr>\n",
|
174 |
-
" </thead>\n",
|
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",
|
208 |
-
"</div>"
|
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": [],
|
@@ -249,18 +157,27 @@
|
|
249 |
},
|
250 |
{
|
251 |
"cell_type": "code",
|
252 |
-
"execution_count":
|
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 |
-
"
|
|
|
259 |
]
|
260 |
},
|
261 |
{
|
262 |
"cell_type": "code",
|
263 |
-
"execution_count":
|
264 |
"id": "9c7c9849-2345-4baf-89e7-d412f52353b6",
|
265 |
"metadata": {},
|
266 |
"outputs": [
|
@@ -275,40 +192,63 @@
|
|
275 |
" <tr><td> </td><th> Array </th><th> Chunk </th></tr>\n",
|
276 |
" </thead>\n",
|
277 |
" <tbody>\n",
|
278 |
-
" <tr><th> Bytes </th><td>
|
279 |
-
" <tr><th> Shape </th><td> (
|
280 |
-
" <tr><th> Count </th><td>
|
281 |
" <tr><th> Type </th><td> float32 </td><td> numpy.ndarray </td></tr>\n",
|
282 |
" </tbody>\n",
|
283 |
"</table>\n",
|
284 |
"</td>\n",
|
285 |
"<td>\n",
|
286 |
-
"<svg width=\"
|
287 |
"\n",
|
288 |
" <!-- Horizontal lines -->\n",
|
289 |
-
" <line x1=\"
|
290 |
-
" <line x1=\"
|
291 |
"\n",
|
292 |
" <!-- Vertical lines -->\n",
|
293 |
-
" <line x1=\"
|
294 |
-
" <line x1=\"
|
295 |
"\n",
|
296 |
" <!-- Colored Rectangle -->\n",
|
297 |
-
" <polygon points=\"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
"\n",
|
299 |
" <!-- Text -->\n",
|
300 |
-
" <text x=\"
|
301 |
-
" <text x=\"
|
|
|
302 |
"</svg>\n",
|
303 |
"</td>\n",
|
304 |
"</tr>\n",
|
305 |
"</table>"
|
306 |
],
|
307 |
"text/plain": [
|
308 |
-
"dask.array<blocks, shape=(
|
309 |
]
|
310 |
},
|
311 |
-
"execution_count":
|
312 |
"metadata": {},
|
313 |
"output_type": "execute_result"
|
314 |
}
|
@@ -319,17 +259,17 @@
|
|
319 |
},
|
320 |
{
|
321 |
"cell_type": "code",
|
322 |
-
"execution_count":
|
323 |
"id": "0bd8e9b9-9713-4572-bd7f-dc47da9fce91",
|
324 |
"metadata": {},
|
325 |
"outputs": [
|
326 |
{
|
327 |
"data": {
|
328 |
"text/plain": [
|
329 |
-
"[
|
330 |
]
|
331 |
},
|
332 |
-
"execution_count":
|
333 |
"metadata": {},
|
334 |
"output_type": "execute_result"
|
335 |
}
|
@@ -340,17 +280,17 @@
|
|
340 |
},
|
341 |
{
|
342 |
"cell_type": "code",
|
343 |
-
"execution_count":
|
344 |
"id": "87493934-3839-476a-a975-7da057c320da",
|
345 |
"metadata": {},
|
346 |
"outputs": [
|
347 |
{
|
348 |
"data": {
|
349 |
"text/plain": [
|
350 |
-
"
|
351 |
]
|
352 |
},
|
353 |
-
"execution_count":
|
354 |
"metadata": {},
|
355 |
"output_type": "execute_result"
|
356 |
}
|
@@ -361,31 +301,7 @@
|
|
361 |
},
|
362 |
{
|
363 |
"cell_type": "code",
|
364 |
-
"execution_count":
|
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": [],
|
@@ -396,7 +312,7 @@
|
|
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",
|
@@ -407,7 +323,7 @@
|
|
407 |
},
|
408 |
{
|
409 |
"cell_type": "code",
|
410 |
-
"execution_count":
|
411 |
"id": "5520a925-693f-43f0-9e76-df2e128f272e",
|
412 |
"metadata": {},
|
413 |
"outputs": [
|
@@ -440,27 +356,27 @@
|
|
440 |
" <tr>\n",
|
441 |
" <th>0</th>\n",
|
442 |
" <td>10gs</td>\n",
|
443 |
-
" <td>[
|
444 |
" </tr>\n",
|
445 |
" <tr>\n",
|
446 |
" <th>1</th>\n",
|
447 |
" <td>184l</td>\n",
|
448 |
-
" <td>[
|
449 |
" </tr>\n",
|
450 |
" <tr>\n",
|
451 |
" <th>2</th>\n",
|
452 |
" <td>186l</td>\n",
|
453 |
-
" <td>[
|
454 |
" </tr>\n",
|
455 |
" <tr>\n",
|
456 |
" <th>3</th>\n",
|
457 |
" <td>187l</td>\n",
|
458 |
-
" <td>[
|
459 |
" </tr>\n",
|
460 |
" <tr>\n",
|
461 |
" <th>4</th>\n",
|
462 |
" <td>188l</td>\n",
|
463 |
-
" <td>[
|
464 |
" </tr>\n",
|
465 |
" </tbody>\n",
|
466 |
"</table>\n",
|
@@ -468,14 +384,14 @@
|
|
468 |
],
|
469 |
"text/plain": [
|
470 |
" name contacts_5A\n",
|
471 |
-
"0 10gs [
|
472 |
-
"1 184l [
|
473 |
-
"2 186l [
|
474 |
-
"3 187l [
|
475 |
-
"4 188l [
|
476 |
]
|
477 |
},
|
478 |
-
"execution_count":
|
479 |
"metadata": {},
|
480 |
"output_type": "execute_result"
|
481 |
}
|
@@ -486,7 +402,7 @@
|
|
486 |
},
|
487 |
{
|
488 |
"cell_type": "code",
|
489 |
-
"execution_count":
|
490 |
"id": "4982c3b1-5ce9-4f17-9834-a02c4e136bc2",
|
491 |
"metadata": {},
|
492 |
"outputs": [],
|
@@ -496,7 +412,7 @@
|
|
496 |
},
|
497 |
{
|
498 |
"cell_type": "code",
|
499 |
-
"execution_count":
|
500 |
"id": "f6cdee43-33c6-445c-8619-ace20f90638c",
|
501 |
"metadata": {},
|
502 |
"outputs": [],
|
@@ -513,7 +429,7 @@
|
|
513 |
},
|
514 |
{
|
515 |
"cell_type": "code",
|
516 |
-
"execution_count":
|
517 |
"id": "8f49f871-76f6-4fb2-b2db-c0794d4c07bf",
|
518 |
"metadata": {},
|
519 |
"outputs": [
|
@@ -521,8 +437,8 @@
|
|
521 |
"name": "stdout",
|
522 |
"output_type": "stream",
|
523 |
"text": [
|
524 |
-
"CPU times: user
|
525 |
-
"Wall time:
|
526 |
]
|
527 |
}
|
528 |
],
|
@@ -533,7 +449,7 @@
|
|
533 |
},
|
534 |
{
|
535 |
"cell_type": "code",
|
536 |
-
"execution_count":
|
537 |
"id": "45e4b4fa-6338-4abe-bd6e-8aea46e2a09c",
|
538 |
"metadata": {},
|
539 |
"outputs": [],
|
@@ -543,17 +459,17 @@
|
|
543 |
},
|
544 |
{
|
545 |
"cell_type": "code",
|
546 |
-
"execution_count":
|
547 |
"id": "7c3db301-6565-4053-bbd4-139bb41dd1c4",
|
548 |
"metadata": {},
|
549 |
"outputs": [
|
550 |
{
|
551 |
"data": {
|
552 |
"text/plain": [
|
553 |
-
"(array([6.
|
554 |
]
|
555 |
},
|
556 |
-
"execution_count":
|
557 |
"metadata": {},
|
558 |
"output_type": "execute_result"
|
559 |
}
|
@@ -567,7 +483,7 @@
|
|
567 |
},
|
568 |
{
|
569 |
"cell_type": "code",
|
570 |
-
"execution_count":
|
571 |
"id": "c9d674bb-d6a2-4810-aa2b-e3bc3b4bbc98",
|
572 |
"metadata": {},
|
573 |
"outputs": [],
|
@@ -579,7 +495,7 @@
|
|
579 |
{
|
580 |
"cell_type": "code",
|
581 |
"execution_count": null,
|
582 |
-
"id": "
|
583 |
"metadata": {},
|
584 |
"outputs": [],
|
585 |
"source": []
|
|
|
111 |
},
|
112 |
{
|
113 |
"cell_type": "code",
|
114 |
+
"execution_count": 22,
|
115 |
"id": "aa358835-55f3-4551-9217-e76a15de4fe8",
|
116 |
"metadata": {},
|
117 |
"outputs": [],
|
|
|
122 |
},
|
123 |
{
|
124 |
"cell_type": "code",
|
125 |
+
"execution_count": 23,
|
126 |
"id": "802cb9bc-2563-4d7f-9a76-3be2d9263a36",
|
127 |
"metadata": {},
|
128 |
"outputs": [],
|
129 |
"source": [
|
130 |
+
"cutoffs = [5,8,11,15]"
|
131 |
]
|
132 |
},
|
133 |
{
|
134 |
"cell_type": "code",
|
135 |
+
"execution_count": 24,
|
136 |
+
"id": "d8e71a8c-11a3-41f0-ab61-3ddc57e10961",
|
137 |
"metadata": {},
|
138 |
"outputs": [],
|
139 |
"source": [
|
|
|
142 |
},
|
143 |
{
|
144 |
"cell_type": "code",
|
145 |
+
"execution_count": 25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
"id": "ed3fe035-6035-4d39-b072-d12dc0a95857",
|
147 |
"metadata": {},
|
148 |
"outputs": [],
|
|
|
157 |
},
|
158 |
{
|
159 |
"cell_type": "code",
|
160 |
+
"execution_count": 26,
|
161 |
"id": "cd26125b-e68b-4fa3-846e-2b6e7f635fe0",
|
162 |
"metadata": {},
|
163 |
+
"outputs": [
|
164 |
+
{
|
165 |
+
"name": "stdout",
|
166 |
+
"output_type": "stream",
|
167 |
+
"text": [
|
168 |
+
"(2046, 510)\n"
|
169 |
+
]
|
170 |
+
}
|
171 |
+
],
|
172 |
"source": [
|
173 |
"contacts_dask = [da.from_npy_stack('data/pdbbind_contacts_{}'.format(c)) for c in cutoffs]\n",
|
174 |
+
"shape = contacts_dask[0][0].shape\n",
|
175 |
+
"print(shape)"
|
176 |
]
|
177 |
},
|
178 |
{
|
179 |
"cell_type": "code",
|
180 |
+
"execution_count": 27,
|
181 |
"id": "9c7c9849-2345-4baf-89e7-d412f52353b6",
|
182 |
"metadata": {},
|
183 |
"outputs": [
|
|
|
192 |
" <tr><td> </td><th> Array </th><th> Chunk </th></tr>\n",
|
193 |
" </thead>\n",
|
194 |
" <tbody>\n",
|
195 |
+
" <tr><th> Bytes </th><td> 2.72 GiB </td> <td> 2.72 GiB </td></tr>\n",
|
196 |
+
" <tr><th> Shape </th><td> (700, 2046, 510) </td> <td> (700, 2046, 510) </td></tr>\n",
|
197 |
+
" <tr><th> Count </th><td> 25 Tasks </td><td> 1 Chunks </td></tr>\n",
|
198 |
" <tr><th> Type </th><td> float32 </td><td> numpy.ndarray </td></tr>\n",
|
199 |
" </tbody>\n",
|
200 |
"</table>\n",
|
201 |
"</td>\n",
|
202 |
"<td>\n",
|
203 |
+
"<svg width=\"128\" height=\"195\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n",
|
204 |
"\n",
|
205 |
" <!-- Horizontal lines -->\n",
|
206 |
+
" <line x1=\"10\" y1=\"0\" x2=\"35\" y2=\"25\" style=\"stroke-width:2\" />\n",
|
207 |
+
" <line x1=\"10\" y1=\"120\" x2=\"35\" y2=\"145\" style=\"stroke-width:2\" />\n",
|
208 |
"\n",
|
209 |
" <!-- Vertical lines -->\n",
|
210 |
+
" <line x1=\"10\" y1=\"0\" x2=\"10\" y2=\"120\" style=\"stroke-width:2\" />\n",
|
211 |
+
" <line x1=\"35\" y1=\"25\" x2=\"35\" y2=\"145\" style=\"stroke-width:2\" />\n",
|
212 |
"\n",
|
213 |
" <!-- Colored Rectangle -->\n",
|
214 |
+
" <polygon points=\"10.0,0.0 35.86269549127143,25.86269549127143 35.86269549127143,145.86269549127144 10.0,120.0\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
215 |
+
"\n",
|
216 |
+
" <!-- Horizontal lines -->\n",
|
217 |
+
" <line x1=\"10\" y1=\"0\" x2=\"52\" y2=\"0\" style=\"stroke-width:2\" />\n",
|
218 |
+
" <line x1=\"35\" y1=\"25\" x2=\"78\" y2=\"25\" style=\"stroke-width:2\" />\n",
|
219 |
+
"\n",
|
220 |
+
" <!-- Vertical lines -->\n",
|
221 |
+
" <line x1=\"10\" y1=\"0\" x2=\"35\" y2=\"25\" style=\"stroke-width:2\" />\n",
|
222 |
+
" <line x1=\"52\" y1=\"0\" x2=\"78\" y2=\"25\" style=\"stroke-width:2\" />\n",
|
223 |
+
"\n",
|
224 |
+
" <!-- Colored Rectangle -->\n",
|
225 |
+
" <polygon points=\"10.0,0.0 52.88780092952726,0.0 78.7504964207987,25.86269549127143 35.86269549127143,25.86269549127143\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
226 |
+
"\n",
|
227 |
+
" <!-- Horizontal lines -->\n",
|
228 |
+
" <line x1=\"35\" y1=\"25\" x2=\"78\" y2=\"25\" style=\"stroke-width:2\" />\n",
|
229 |
+
" <line x1=\"35\" y1=\"145\" x2=\"78\" y2=\"145\" style=\"stroke-width:2\" />\n",
|
230 |
+
"\n",
|
231 |
+
" <!-- Vertical lines -->\n",
|
232 |
+
" <line x1=\"35\" y1=\"25\" x2=\"35\" y2=\"145\" style=\"stroke-width:2\" />\n",
|
233 |
+
" <line x1=\"78\" y1=\"25\" x2=\"78\" y2=\"145\" style=\"stroke-width:2\" />\n",
|
234 |
+
"\n",
|
235 |
+
" <!-- Colored Rectangle -->\n",
|
236 |
+
" <polygon points=\"35.86269549127143,25.86269549127143 78.7504964207987,25.86269549127143 78.7504964207987,145.86269549127144 35.86269549127143,145.86269549127144\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
|
237 |
"\n",
|
238 |
" <!-- Text -->\n",
|
239 |
+
" <text x=\"57.306596\" y=\"165.862695\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >510</text>\n",
|
240 |
+
" <text x=\"98.750496\" y=\"85.862695\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(-90,98.750496,85.862695)\">2046</text>\n",
|
241 |
+
" <text x=\"12.931348\" y=\"152.931348\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(45,12.931348,152.931348)\">700</text>\n",
|
242 |
"</svg>\n",
|
243 |
"</td>\n",
|
244 |
"</tr>\n",
|
245 |
"</table>"
|
246 |
],
|
247 |
"text/plain": [
|
248 |
+
"dask.array<blocks, shape=(700, 2046, 510), dtype=float32, chunksize=(700, 2046, 510), chunktype=numpy.ndarray>"
|
249 |
]
|
250 |
},
|
251 |
+
"execution_count": 27,
|
252 |
"metadata": {},
|
253 |
"output_type": "execute_result"
|
254 |
}
|
|
|
259 |
},
|
260 |
{
|
261 |
"cell_type": "code",
|
262 |
+
"execution_count": 28,
|
263 |
"id": "0bd8e9b9-9713-4572-bd7f-dc47da9fce91",
|
264 |
"metadata": {},
|
265 |
"outputs": [
|
266 |
{
|
267 |
"data": {
|
268 |
"text/plain": [
|
269 |
+
"[16221, 16201, 16193, 16189]"
|
270 |
]
|
271 |
},
|
272 |
+
"execution_count": 28,
|
273 |
"metadata": {},
|
274 |
"output_type": "execute_result"
|
275 |
}
|
|
|
280 |
},
|
281 |
{
|
282 |
"cell_type": "code",
|
283 |
+
"execution_count": 29,
|
284 |
"id": "87493934-3839-476a-a975-7da057c320da",
|
285 |
"metadata": {},
|
286 |
"outputs": [
|
287 |
{
|
288 |
"data": {
|
289 |
"text/plain": [
|
290 |
+
"16221"
|
291 |
]
|
292 |
},
|
293 |
+
"execution_count": 29,
|
294 |
"metadata": {},
|
295 |
"output_type": "execute_result"
|
296 |
}
|
|
|
301 |
},
|
302 |
{
|
303 |
"cell_type": "code",
|
304 |
+
"execution_count": 30,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
"id": "42e95d84-ef27-4417-9479-8b356462b8c3",
|
306 |
"metadata": {},
|
307 |
"outputs": [],
|
|
|
312 |
" def chunk_to_sparse(rcut, chunk, idx_chunk):\n",
|
313 |
" res = dfs_complex[rcut].iloc[idx_chunk][['name']].copy()\n",
|
314 |
" # pad to account for [CLS] and [SEP]\n",
|
315 |
+
" res['contacts_{}A'.format(rcut)] = [np.where(np.pad(a,pad_width=(1,1)).flatten())[0] for a in chunk]\n",
|
316 |
" return res\n",
|
317 |
"\n",
|
318 |
" partitions = [delayed(chunk_to_sparse)(cutoff,b,k)\n",
|
|
|
323 |
},
|
324 |
{
|
325 |
"cell_type": "code",
|
326 |
+
"execution_count": 31,
|
327 |
"id": "5520a925-693f-43f0-9e76-df2e128f272e",
|
328 |
"metadata": {},
|
329 |
"outputs": [
|
|
|
356 |
" <tr>\n",
|
357 |
" <th>0</th>\n",
|
358 |
" <td>10gs</td>\n",
|
359 |
+
" <td>[1025, 1026, 1074, 1077, 1079, 3083, 3084, 308...</td>\n",
|
360 |
" </tr>\n",
|
361 |
" <tr>\n",
|
362 |
" <th>1</th>\n",
|
363 |
" <td>184l</td>\n",
|
364 |
+
" <td>[39945, 39946, 39947, 39948, 43010, 43012, 430...</td>\n",
|
365 |
" </tr>\n",
|
366 |
" <tr>\n",
|
367 |
" <th>2</th>\n",
|
368 |
" <td>186l</td>\n",
|
369 |
+
" <td>[39943, 39944, 39945, 43010, 43011, 43012, 430...</td>\n",
|
370 |
" </tr>\n",
|
371 |
" <tr>\n",
|
372 |
" <th>3</th>\n",
|
373 |
" <td>187l</td>\n",
|
374 |
+
" <td>[39937, 39938, 39947, 43009, 43010, 43012, 430...</td>\n",
|
375 |
" </tr>\n",
|
376 |
" <tr>\n",
|
377 |
" <th>4</th>\n",
|
378 |
" <td>188l</td>\n",
|
379 |
+
" <td>[39937, 39938, 39940, 39941, 43009, 43010, 430...</td>\n",
|
380 |
" </tr>\n",
|
381 |
" </tbody>\n",
|
382 |
"</table>\n",
|
|
|
384 |
],
|
385 |
"text/plain": [
|
386 |
" name contacts_5A\n",
|
387 |
+
"0 10gs [1025, 1026, 1074, 1077, 1079, 3083, 3084, 308...\n",
|
388 |
+
"1 184l [39945, 39946, 39947, 39948, 43010, 43012, 430...\n",
|
389 |
+
"2 186l [39943, 39944, 39945, 43010, 43011, 43012, 430...\n",
|
390 |
+
"3 187l [39937, 39938, 39947, 43009, 43010, 43012, 430...\n",
|
391 |
+
"4 188l [39937, 39938, 39940, 39941, 43009, 43010, 430..."
|
392 |
]
|
393 |
},
|
394 |
+
"execution_count": 31,
|
395 |
"metadata": {},
|
396 |
"output_type": "execute_result"
|
397 |
}
|
|
|
402 |
},
|
403 |
{
|
404 |
"cell_type": "code",
|
405 |
+
"execution_count": 32,
|
406 |
"id": "4982c3b1-5ce9-4f17-9834-a02c4e136bc2",
|
407 |
"metadata": {},
|
408 |
"outputs": [],
|
|
|
412 |
},
|
413 |
{
|
414 |
"cell_type": "code",
|
415 |
+
"execution_count": 33,
|
416 |
"id": "f6cdee43-33c6-445c-8619-ace20f90638c",
|
417 |
"metadata": {},
|
418 |
"outputs": [],
|
|
|
429 |
},
|
430 |
{
|
431 |
"cell_type": "code",
|
432 |
+
"execution_count": 34,
|
433 |
"id": "8f49f871-76f6-4fb2-b2db-c0794d4c07bf",
|
434 |
"metadata": {},
|
435 |
"outputs": [
|
|
|
437 |
"name": "stdout",
|
438 |
"output_type": "stream",
|
439 |
"text": [
|
440 |
+
"CPU times: user 8min 48s, sys: 12min 3s, total: 20min 52s\n",
|
441 |
+
"Wall time: 3min 20s\n"
|
442 |
]
|
443 |
}
|
444 |
],
|
|
|
449 |
},
|
450 |
{
|
451 |
"cell_type": "code",
|
452 |
+
"execution_count": 35,
|
453 |
"id": "45e4b4fa-6338-4abe-bd6e-8aea46e2a09c",
|
454 |
"metadata": {},
|
455 |
"outputs": [],
|
|
|
459 |
},
|
460 |
{
|
461 |
"cell_type": "code",
|
462 |
+
"execution_count": 36,
|
463 |
"id": "7c3db301-6565-4053-bbd4-139bb41dd1c4",
|
464 |
"metadata": {},
|
465 |
"outputs": [
|
466 |
{
|
467 |
"data": {
|
468 |
"text/plain": [
|
469 |
+
"(array([6.34974652]), array([3.56691843]))"
|
470 |
]
|
471 |
},
|
472 |
+
"execution_count": 36,
|
473 |
"metadata": {},
|
474 |
"output_type": "execute_result"
|
475 |
}
|
|
|
483 |
},
|
484 |
{
|
485 |
"cell_type": "code",
|
486 |
+
"execution_count": 37,
|
487 |
"id": "c9d674bb-d6a2-4810-aa2b-e3bc3b4bbc98",
|
488 |
"metadata": {},
|
489 |
"outputs": [],
|
|
|
495 |
{
|
496 |
"cell_type": "code",
|
497 |
"execution_count": null,
|
498 |
+
"id": "8e5f99f3-4aa6-44c9-afd8-9c62bdef9d5f",
|
499 |
"metadata": {},
|
500 |
"outputs": [],
|
501 |
"source": []
|
pdbbind.py
CHANGED
@@ -71,7 +71,8 @@ def parse_complex(fn):
|
|
71 |
neighbor_search = NeighborSearch(atoms)
|
72 |
|
73 |
close_residues = [neighbor_search.search(center=t, level='R', radius=cutoff) for t in token_pos]
|
74 |
-
|
|
|
75 |
|
76 |
# contact map
|
77 |
contact_map = np.zeros((max_seq, max_smiles),dtype=np.float32)
|
|
|
71 |
neighbor_search = NeighborSearch(atoms)
|
72 |
|
73 |
close_residues = [neighbor_search.search(center=t, level='R', radius=cutoff) for t in token_pos]
|
74 |
+
first_residue = next(structure.get_residues()).get_id()[1]
|
75 |
+
residue_id = [[c.get_id()[1]-first_residue for c in query] for query in close_residues] # zero-based
|
76 |
|
77 |
# contact map
|
78 |
contact_map = np.zeros((max_seq, max_smiles),dtype=np.float32)
|