Spaces:
Sleeping
Sleeping
gravelcompbio
commited on
Commit
•
6ced301
1
Parent(s):
36c85cd
Update README.md
Browse files
README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
---
|
2 |
title: Phosformer ST
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
colorTo: pink
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.38.0
|
@@ -10,4 +10,739 @@ pinned: false
|
|
10 |
license: cc-by-nc-nd-4.0
|
11 |
---
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
title: Phosformer ST
|
3 |
+
emoji: 🐢
|
4 |
+
colorFrom: gray
|
5 |
colorTo: pink
|
6 |
sdk: gradio
|
7 |
sdk_version: 3.38.0
|
|
|
10 |
license: cc-by-nc-nd-4.0
|
11 |
---
|
12 |
|
13 |
+
|
14 |
+
|
15 |
+
<!-- This Github was Made By Nathan Gravel and tested with help of Mariah Salcedo-->
|
16 |
+
|
17 |
+
# Phosformer-ST <img src="https://github.com/gravelCompBio/Phosformer-ST/assets/75225868/f375e377-b639-4b8c-9792-6d8e5e9e6c39" width="60">
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
## Introduction
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
This repository contains the code to run Phosformer-ST locally from the manuscript "Phosformer-ST: explainable machine learning
|
38 |
+
|
39 |
+
uncovers the kinase-substrate interaction landscape" . This readme should also give you the specific versions for all packages used to run Phosformer-ST in a local environment.
|
40 |
+
|
41 |
+
The model was created by Zhongliang Zhou and Wayland Yeung. The Phos-ST webtool is found from this link (https://phosformer.netlify.app/) and was generated by Saber Soleymani.
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
+
</br>
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
## Quick overview of the dependencies
|
50 |
+
|
51 |
+
![Python](https://img.shields.io/badge/Python-FFD43B?style=for-the-badge&logo=python&logoColor=blue)
|
52 |
+
![Anaconda](https://img.shields.io/badge/Anaconda-%2344A833.svg?style=for-the-badge&logo=anaconda&logoColor=white)
|
53 |
+
![Jupyter](https://img.shields.io/badge/Jupyter-F37626.svg?&style=for-the-badge&logo=Jupyter&logoColor=white)
|
54 |
+
![PyTorch](https://img.shields.io/badge/PyTorch-EE4C2C?style=for-the-badge&logo=pytorch&logoColor=white)
|
55 |
+
|
56 |
+
|
57 |
+
|
58 |
+
![Numpy](https://img.shields.io/badge/Numpy-777BB4?style=for-the-badge&logo=numpy&logoColor=white)
|
59 |
+
![Pandas](https://img.shields.io/badge/Pandas-2C2D72?style=for-the-badge&logo=pandas&logoColor=white)
|
60 |
+
![Matplotlib](https://img.shields.io/badge/Matplotlib-%23ffffff.svg?style=for-the-badge&logo=Matplotlib&logoColor=black)
|
61 |
+
![scikit-learn](https://img.shields.io/badge/scikit--learn-%23F7931E.svg?style=for-the-badge&logo=scikit-learn&logoColor=white)
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
|
67 |
+
</br>
|
68 |
+
|
69 |
+
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
## Included in this repository are the following:
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
- `phos-ST_Example_Code.ipynb`: Jupyter File with example code to run Phosformer-ST
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
- `modeling_esm.py`: Python file that has the architecture of Phosformer-ST
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
- `configuration_esm.py`: Python file that has configuration/parameters of Phosformer-ST
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
- `tokenization_esm.py`: Python file that contains code for the tokenizer
|
94 |
+
|
95 |
+
|
96 |
+
|
97 |
+
|
98 |
+
|
99 |
+
- `multitask_MHA_esm2_t30_150M_UR50D_neg_ratio_8+8_shift_30_mask_0.2_2023-03-25_90.txt`: this txt file contains a link to a zenodo repository to download the proper folder
|
100 |
+
|
101 |
+
|
102 |
+
|
103 |
+
- This folder holds the files that contained the training weights for Phosformer-ST to run as advertised
|
104 |
+
|
105 |
+
- See section below (Downloading this repository) to be shown how to download this folder and where to put it
|
106 |
+
|
107 |
+
|
108 |
+
|
109 |
+
- `phosST.yml`: This file is used to help create an environment for Phos-ST to work
|
110 |
+
|
111 |
+
|
112 |
+
|
113 |
+
- `README.md`: You're reading it right now
|
114 |
+
|
115 |
+
|
116 |
+
|
117 |
+
- `LICENSE`: Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License
|
118 |
+
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
|
124 |
+
|
125 |
+
|
126 |
+
|
127 |
+
</br>
|
128 |
+
|
129 |
+
|
130 |
+
|
131 |
+
</br>
|
132 |
+
|
133 |
+
|
134 |
+
|
135 |
+
|
136 |
+
|
137 |
+
|
138 |
+
|
139 |
+
## Installing dependencies with version info
|
140 |
+
|
141 |
+
|
142 |
+
|
143 |
+
|
144 |
+
|
145 |
+
### From conda:
|
146 |
+
|
147 |
+
|
148 |
+
|
149 |
+
![python=3.9.16](https://img.shields.io/badge/Python-3.9.16-green)
|
150 |
+
|
151 |
+
|
152 |
+
|
153 |
+
![jupyterlab=4.0.0](https://img.shields.io/badge/jupyterlab-4.0.0-blue)
|
154 |
+
|
155 |
+
|
156 |
+
|
157 |
+
Python == 3.9.16
|
158 |
+
|
159 |
+
|
160 |
+
|
161 |
+
|
162 |
+
|
163 |
+
|
164 |
+
|
165 |
+
### From pip:
|
166 |
+
|
167 |
+
|
168 |
+
|
169 |
+
|
170 |
+
|
171 |
+
|
172 |
+
|
173 |
+
![numpy=1.24.3](https://img.shields.io/badge/numpy-1.24.3-blue)
|
174 |
+
|
175 |
+
|
176 |
+
|
177 |
+
![pandas=2.0.2](https://img.shields.io/badge/pandas-2.0.2-blue)
|
178 |
+
|
179 |
+
|
180 |
+
|
181 |
+
![matplotlib=3.7.1](https://img.shields.io/badge/matplotlib-3.7.1-blue)
|
182 |
+
|
183 |
+
|
184 |
+
|
185 |
+
![scikit-learn=1.2.2](https://img.shields.io/badge/scikitlearn-1.2.2-blue)
|
186 |
+
|
187 |
+
|
188 |
+
|
189 |
+
![tqdm=4.65.0](https://img.shields.io/badge/tqdm-4.64.1-blue)
|
190 |
+
|
191 |
+
|
192 |
+
|
193 |
+
![fair-esm=2.0.0](https://img.shields.io/pypi/v/fair-esm?label=fair-esm)
|
194 |
+
|
195 |
+
|
196 |
+
|
197 |
+
![transformers=4.31.0](https://img.shields.io/badge/transformers-4.31.0-blue)
|
198 |
+
|
199 |
+
|
200 |
+
|
201 |
+
![torch=2.0.1](https://img.shields.io/badge/torch-2.0.1-blue)
|
202 |
+
|
203 |
+
|
204 |
+
|
205 |
+
### For torch/PyTorch
|
206 |
+
|
207 |
+
|
208 |
+
|
209 |
+
Make sure you go to this website https://pytorch.org/get-started/locally/
|
210 |
+
|
211 |
+
|
212 |
+
|
213 |
+
Follow along with its recommendation
|
214 |
+
|
215 |
+
|
216 |
+
|
217 |
+
Installing torch can be the most complex part
|
218 |
+
|
219 |
+
|
220 |
+
|
221 |
+
|
222 |
+
|
223 |
+
</br>
|
224 |
+
|
225 |
+
|
226 |
+
|
227 |
+
|
228 |
+
|
229 |
+
|
230 |
+
|
231 |
+
|
232 |
+
|
233 |
+
### The computer specs that we know that this model can run on (with gpu acceleration)
|
234 |
+
|
235 |
+
|
236 |
+
|
237 |
+
</br>
|
238 |
+
|
239 |
+
|
240 |
+
|
241 |
+
**Computer 1**
|
242 |
+
|
243 |
+
|
244 |
+
|
245 |
+
Ubuntu 22.04.2 LTS
|
246 |
+
|
247 |
+
|
248 |
+
|
249 |
+
Intel(R) Xeon(R) Bronze 3204 CPU @ 1.90GHz (6 cores) x (1 thread per core)
|
250 |
+
|
251 |
+
|
252 |
+
|
253 |
+
64 GB ram
|
254 |
+
|
255 |
+
|
256 |
+
|
257 |
+
NVIDIA Quadro RTX 5000 (16 GB vRAM)(CUDA Version: 12.1)
|
258 |
+
|
259 |
+
|
260 |
+
|
261 |
+
</br>
|
262 |
+
|
263 |
+
|
264 |
+
|
265 |
+
**Computer 2**
|
266 |
+
|
267 |
+
|
268 |
+
|
269 |
+
Ubuntu 20.04.6 LTS
|
270 |
+
|
271 |
+
|
272 |
+
|
273 |
+
Intel(R) Xeon(R) Bronze 3204 CPU @ 1.90GHz (6 cores) x (1 thread per core)
|
274 |
+
|
275 |
+
|
276 |
+
|
277 |
+
64 GB ram
|
278 |
+
|
279 |
+
|
280 |
+
|
281 |
+
NVIDIA RTX A4000 (16 GB vRAM)(CUDA Version: 12.2)
|
282 |
+
|
283 |
+
|
284 |
+
|
285 |
+
|
286 |
+
|
287 |
+
|
288 |
+
|
289 |
+
</br>
|
290 |
+
|
291 |
+
|
292 |
+
|
293 |
+
</br>
|
294 |
+
|
295 |
+
|
296 |
+
|
297 |
+
|
298 |
+
|
299 |
+
|
300 |
+
|
301 |
+
## Downloading this repository
|
302 |
+
|
303 |
+
|
304 |
+
|
305 |
+
```
|
306 |
+
git clone https://huggingface.co/gravelcompbio/Phosformer-ST_with_trainging_weights
|
307 |
+
```
|
308 |
+
|
309 |
+
|
310 |
+
|
311 |
+
```
|
312 |
+
cd Phosformer-ST_with_trainging_weights
|
313 |
+
```
|
314 |
+
|
315 |
+
|
316 |
+
|
317 |
+
|
318 |
+
|
319 |
+
The `Phosformer-ST_with_trainging_weights` folder should have the following files/folder in it
|
320 |
+
|
321 |
+
|
322 |
+
|
323 |
+
- file 1 `phos-ST_Example_Code.ipynb`
|
324 |
+
|
325 |
+
|
326 |
+
|
327 |
+
- file 2 `modeling_esm.py`
|
328 |
+
|
329 |
+
|
330 |
+
|
331 |
+
- file 3 `configuration_esm.py`
|
332 |
+
|
333 |
+
|
334 |
+
|
335 |
+
- file 4 `tokenization_esm.py`
|
336 |
+
|
337 |
+
|
338 |
+
|
339 |
+
- file 5 `multitask_MHA_esm2_t30_150M_UR50D_neg_ratio_8+8_shift_30_mask_0.2_2023-03-25_90.txt`
|
340 |
+
|
341 |
+
|
342 |
+
|
343 |
+
- file 6 `phosST.yml`
|
344 |
+
|
345 |
+
|
346 |
+
|
347 |
+
- file 7 `Readme.md`
|
348 |
+
|
349 |
+
|
350 |
+
|
351 |
+
- file 8 `LICENSE`
|
352 |
+
|
353 |
+
|
354 |
+
|
355 |
+
- folder 1 `multitask_MHA_esm2_t30_150M_UR50D_neg_ratio_8+8_shift_30_mask_0.2_2023-03-25_90` (make sure it is unzipped)
|
356 |
+
|
357 |
+
|
358 |
+
|
359 |
+
- zipped folder 2 `multitask_MHA_esm2_t30_150M_UR50D_neg_ratio_8+8_shift_30_mask_0.2_2023-03-25_90.zip`
|
360 |
+
|
361 |
+
|
362 |
+
|
363 |
+
|
364 |
+
Once you have a folder with the files/folder above in it you have done all the downloading needed
|
365 |
+
|
366 |
+
|
367 |
+
|
368 |
+
|
369 |
+
|
370 |
+
</br>
|
371 |
+
|
372 |
+
|
373 |
+
|
374 |
+
</br>
|
375 |
+
|
376 |
+
|
377 |
+
|
378 |
+
|
379 |
+
|
380 |
+
|
381 |
+
|
382 |
+
## ![Anaconda](https://img.shields.io/badge/Anaconda-%2344A833.svg?style=for-the-badge&logo=anaconda&logoColor=white) Installing dependencies with conda
|
383 |
+
|
384 |
+
|
385 |
+
|
386 |
+
### PICK ONE of the options below
|
387 |
+
|
388 |
+
### Option 1) Utilizing the PhosformerST.yml file
|
389 |
+
|
390 |
+
here is a step-by-step guide to set up the environment with the yml file
|
391 |
+
|
392 |
+
|
393 |
+
|
394 |
+
Just type these lines of code into the terminal after you download this repository (this assumes you have anaconda already installed)
|
395 |
+
|
396 |
+
|
397 |
+
|
398 |
+
```
|
399 |
+
conda env create -f phosST.yml -n PhosST
|
400 |
+
```
|
401 |
+
|
402 |
+
```
|
403 |
+
conda deactivate
|
404 |
+
```
|
405 |
+
|
406 |
+
```
|
407 |
+
conda activate phosST
|
408 |
+
```
|
409 |
+
|
410 |
+
|
411 |
+
|
412 |
+
### Option 2) Creating this environment without yml file
|
413 |
+
|
414 |
+
(This is if torch is being weird with your version of cuda or any other problem)
|
415 |
+
|
416 |
+
Just type these lines of code into the terminal after you download this repository (this assumes you have anaconda already installed)
|
417 |
+
|
418 |
+
```
|
419 |
+
conda create -n phosST python=3.9
|
420 |
+
```
|
421 |
+
|
422 |
+
```
|
423 |
+
conda deactivate
|
424 |
+
```
|
425 |
+
|
426 |
+
```
|
427 |
+
conda activate phosST
|
428 |
+
```
|
429 |
+
|
430 |
+
```
|
431 |
+
conda install -c conda-forge jupyterlab
|
432 |
+
```
|
433 |
+
|
434 |
+
```
|
435 |
+
pip3 install numpy==1.24.3
|
436 |
+
```
|
437 |
+
|
438 |
+
```
|
439 |
+
pip3 install pandas==2.0.2
|
440 |
+
```
|
441 |
+
|
442 |
+
```
|
443 |
+
pip3 install matplotlib==3.7.1
|
444 |
+
```
|
445 |
+
|
446 |
+
```
|
447 |
+
pip3 install scikit-learn==1.2.2
|
448 |
+
```
|
449 |
+
|
450 |
+
```
|
451 |
+
pip3 install tqdm==4.65.0
|
452 |
+
```
|
453 |
+
|
454 |
+
```
|
455 |
+
pip3 install fair-esm==2.0.0
|
456 |
+
```
|
457 |
+
|
458 |
+
```
|
459 |
+
pip3 install transformers==4.31.0
|
460 |
+
```
|
461 |
+
|
462 |
+
### **For torch you will have to download to the torch's specification if you want gpu acceleration from this website** https://pytorch.org/get-started/locally/
|
463 |
+
|
464 |
+
|
465 |
+
|
466 |
+
```
|
467 |
+
pip3 install torch torchvision torchaudio
|
468 |
+
```
|
469 |
+
|
470 |
+
|
471 |
+
|
472 |
+
### the terminal line above might look different for you
|
473 |
+
|
474 |
+
|
475 |
+
|
476 |
+
We provided code to test Phos-ST (see section below)
|
477 |
+
|
478 |
+
|
479 |
+
|
480 |
+
|
481 |
+
|
482 |
+
</br>
|
483 |
+
|
484 |
+
|
485 |
+
|
486 |
+
</br>
|
487 |
+
|
488 |
+
|
489 |
+
|
490 |
+
|
491 |
+
|
492 |
+
|
493 |
+
|
494 |
+
## Utilizing the Model with our example
|
495 |
+
|
496 |
+
All the following code examples is done inside of the `phos-ST_Example_Code.ipynb` file using jupyter lab
|
497 |
+
|
498 |
+
|
499 |
+
|
500 |
+
Once you have your environment resolved just use jupyter lab to access the example code by typing the comand below in your terminal (when you're in the `Phosformer-ST` folder)
|
501 |
+
|
502 |
+
```
|
503 |
+
|
504 |
+
jupyter lab
|
505 |
+
|
506 |
+
```
|
507 |
+
|
508 |
+
Once you open the notebook on your browser, run each cell of notebook
|
509 |
+
|
510 |
+
|
511 |
+
|
512 |
+
</br>
|
513 |
+
|
514 |
+
|
515 |
+
|
516 |
+
### Testing Phos-ST with the example code
|
517 |
+
|
518 |
+
There should be a positive control and a negative control example code at bottom of the `phos-ST_Example_Code.ipynb` file. This is here just to sanity check that the model is working. The positive and negative control is running the same code with known examples where Phos-ST should give an answered close to 1 (positive control) or 0 (negative control).
|
519 |
+
|
520 |
+
|
521 |
+
|
522 |
+
**Positive Example**
|
523 |
+
|
524 |
+
```Python
|
525 |
+
|
526 |
+
# P17612 KAPCA_HUMAN
|
527 |
+
|
528 |
+
kinDomain="FERIKTLGTGSFGRVMLVKHKETGNHYAMKILDKQKVVKLKQIEHTLNEKRILQAVNFPFLVKLEFSFKDNSNLYMVMEYVPGGEMFSHLRRIGRFSEPHARFYAAQIVLTFEYLHSLDLIYRDLKPENLLIDQQGYIQVTDFGFAKRVKGRTWTLCGTPEYLAPEIILSKGYNKAVDWWALGVLIYEMAAGYPPFFADQPIQIYEKIVSGKVRFPSHFSSDLKDLLRNLLQVDLTKRFGNLKNGVNDIKNHKWF"
|
529 |
+
|
530 |
+
# P53602_S96_LARKRRNSRDGDPLP
|
531 |
+
|
532 |
+
substrate="LARKRRNSRDGDPLP"
|
533 |
+
|
534 |
+
|
535 |
+
|
536 |
+
phosST(kinDomain,substrate).to_csv('PostiveExample.csv')
|
537 |
+
|
538 |
+
```
|
539 |
+
|
540 |
+
|
541 |
+
|
542 |
+
|
543 |
+
|
544 |
+
**Negative Example**
|
545 |
+
|
546 |
+
```Python
|
547 |
+
|
548 |
+
# P17612 KAPCA_HUMAN
|
549 |
+
|
550 |
+
kinDomain="FERIKTLGTGSFGRVMLVKHKETGNHYAMKILDKQKVVKLKQIEHTLNEKRILQAVNFPFLVKLEFSFKDNSNLYMVMEYVPGGEMFSHLRRIGRFSEPHARFYAAQIVLTFEYLHSLDLIYRDLKPENLLIDQQGYIQVTDFGFAKRVKGRTWTLCGTPEYLAPEIILSKGYNKAVDWWALGVLIYEMAAGYPPFFADQPIQIYEKIVSGKVRFPSHFSSDLKDLLRNLLQVDLTKRFGNLKNGVNDIKNHKWF"
|
551 |
+
|
552 |
+
# Q01831_T169_PVEIEIETPEQAKTR
|
553 |
+
|
554 |
+
substrate="PVEIEIETPEQAKTR"
|
555 |
+
|
556 |
+
|
557 |
+
|
558 |
+
phosST(kinDomain,substrate).to_csv('NegitiveExample.csv')
|
559 |
+
|
560 |
+
```
|
561 |
+
|
562 |
+
Both scores should show up in a csv file in the same folder of this code
|
563 |
+
|
564 |
+
|
565 |
+
|
566 |
+
</br>
|
567 |
+
|
568 |
+
|
569 |
+
|
570 |
+
### Inputting your own data for novel predictions
|
571 |
+
|
572 |
+
One can simply take the code from above and modify the string variables `kinDomain` and `substrate` to your prediction of interest
|
573 |
+
|
574 |
+
|
575 |
+
|
576 |
+
**Formatting of the `kinDomain` and `substrate` for input for phos-ST are as followed:**
|
577 |
+
|
578 |
+
|
579 |
+
|
580 |
+
- `kinDomain` should just be the kinase domain (instead of the full sequence), preferably human, and a Serine/Threonine kinases
|
581 |
+
|
582 |
+
|
583 |
+
|
584 |
+
- `substrate` should be a 15mer with the center residue/char being the Serine or Threonine being phosphorylated
|
585 |
+
|
586 |
+
|
587 |
+
|
588 |
+
Not following these rules will still give you and output at time but does not guarantee a prediction with the accuracy advertised
|
589 |
+
|
590 |
+
|
591 |
+
|
592 |
+
|
593 |
+
|
594 |
+
</br>
|
595 |
+
|
596 |
+
|
597 |
+
|
598 |
+
### How to interoperate Phosformer-ST's output
|
599 |
+
|
600 |
+
This model was trained to use the cutoff of 0.5 as the difference between positive prediction and negative prediction
|
601 |
+
|
602 |
+
|
603 |
+
|
604 |
+
If your custom prediction is above 0.5, the model is predicting the kinase-substrate pair is a positive prediction for a phosphorylation event
|
605 |
+
|
606 |
+
|
607 |
+
|
608 |
+
Though the training data is ultimately based on a positional scanning peptide array, this model only takes into account kinase binding preference.
|
609 |
+
|
610 |
+
|
611 |
+
|
612 |
+
Combining with other special, temporal, or other biologically relevant filters might be more accurate when modeling protein kinase.
|
613 |
+
|
614 |
+
|
615 |
+
|
616 |
+
</br>
|
617 |
+
|
618 |
+
|
619 |
+
|
620 |
+
|
621 |
+
|
622 |
+
|
623 |
+
|
624 |
+
|
625 |
+
|
626 |
+
### Modifying the code to take in a list of kinase domains and substrates
|
627 |
+
|
628 |
+
Currenly, we have it only predicting one kinase domain + one substrate at a time. One can simply swap out the `helper function to use Phos-ST` code-block with the code-block below. The input arguments now require a list of strings for both the kinase domains and substrates. Make sure the list of both kinases and substrates are the same length and conserve the same format specified in the "Inputting your own data for novel predictions" section of the readme
|
629 |
+
|
630 |
+
```Python
|
631 |
+
|
632 |
+
# P17612 KAPCA_HUMAN listed twice
|
633 |
+
|
634 |
+
kinDomains=["FERIKTLGTGSFGRVMLVKHKETGNHYAMKILDKQKVVKLKQIEHTLNEKRILQAVNFPFLVKLEFSFKDNSNLYMVMEYVPGGEMFSHLRRIGRFSEPHARFYAAQIVLTFEYLHSLDLIYRDLKPENLLIDQQGYIQVTDFGFAKRVKGRTWTLCGTPEYLAPEIILSKGYNKAVDWWALGVLIYEMAAGYPPFFADQPIQIYEKIVSGKVRFPSHFSSDLKDLLRNLLQVDLTKRFGNLKNGVNDIKNHKWF","FERIKTLGTGSFGRVMLVKHKETGNHYAMKILDKQKVVKLKQIEHTLNEKRILQAVNFPFLVKLEFSFKDNSNLYMVMEYVPGGEMFSHLRRIGRFSEPHARFYAAQIVLTFEYLHSLDLIYRDLKPENLLIDQQGYIQVTDFGFAKRVKGRTWTLCGTPEYLAPEIILSKGYNKAVDWWALGVLIYEMAAGYPPFFADQPIQIYEKIVSGKVRFPSHFSSDLKDLLRNLLQVDLTKRFGNLKNGVNDIKNHKWF"]
|
635 |
+
|
636 |
+
|
637 |
+
|
638 |
+
# P53602_S96_LARKRRNSRDGDPLP listed first and Q01831_T169_PVEIEIETPEQAKTR listed second
|
639 |
+
|
640 |
+
substrates=["LARKRRNSRDGDPLP","PVEIEIETPEQAKTR"]
|
641 |
+
|
642 |
+
|
643 |
+
|
644 |
+
|
645 |
+
|
646 |
+
def phosST(kinaseDomainSeqs,substrate15mers):
|
647 |
+
|
648 |
+
job = run_model(
|
649 |
+
|
650 |
+
substrate15mers,
|
651 |
+
|
652 |
+
kinaseDomainSeqs,
|
653 |
+
|
654 |
+
model=model,
|
655 |
+
|
656 |
+
tokenizer=tokenizer,
|
657 |
+
|
658 |
+
device='cuda',
|
659 |
+
|
660 |
+
batch_size=10,
|
661 |
+
|
662 |
+
output_hidden_states=False,
|
663 |
+
|
664 |
+
output_attentions=False,
|
665 |
+
|
666 |
+
)
|
667 |
+
|
668 |
+
|
669 |
+
|
670 |
+
#total = dataset.shape[0]
|
671 |
+
|
672 |
+
results = {
|
673 |
+
|
674 |
+
'kinase' : [],
|
675 |
+
|
676 |
+
'peptide' : [],
|
677 |
+
|
678 |
+
'prob' : [],
|
679 |
+
|
680 |
+
}
|
681 |
+
|
682 |
+
|
683 |
+
|
684 |
+
for n, i in enumerate(job):
|
685 |
+
|
686 |
+
#sys.stderr.write(f'{n+1} / {total}\r')
|
687 |
+
|
688 |
+
results['kinase' ] += [i['kinase']]
|
689 |
+
|
690 |
+
results['peptide'] += [i['peptide']]
|
691 |
+
|
692 |
+
results['prob' ] += [i['probability']]
|
693 |
+
|
694 |
+
|
695 |
+
|
696 |
+
result = pd.DataFrame(results)
|
697 |
+
|
698 |
+
|
699 |
+
|
700 |
+
return result
|
701 |
+
|
702 |
+
|
703 |
+
|
704 |
+
|
705 |
+
|
706 |
+
|
707 |
+
|
708 |
+
phosST(kinDomains,substrates).to_csv('BatchExample.csv')
|
709 |
+
|
710 |
+
|
711 |
+
|
712 |
+
|
713 |
+
|
714 |
+
|
715 |
+
|
716 |
+
|
717 |
+
|
718 |
+
```
|
719 |
+
|
720 |
+
</br>
|
721 |
+
|
722 |
+
|
723 |
+
|
724 |
+
</br>
|
725 |
+
|
726 |
+
|
727 |
+
|
728 |
+
## Troubleshooting
|
729 |
+
|
730 |
+
|
731 |
+
|
732 |
+
If torch is not installing correctly or you do not have a GPU to run Phos-ST on, the CPU version of torch is perfectly fine to use
|
733 |
+
|
734 |
+
|
735 |
+
|
736 |
+
Using the CPU version of torch might 10x to 1000x your run time so for large prediction datasets GPU acceleration is suggested
|
737 |
+
|
738 |
+
|
739 |
+
|
740 |
+
If you just are here to test if it phos-ST works, the example code should not take too much time to run on the CPU version of torch
|
741 |
+
|
742 |
+
|
743 |
+
|
744 |
+
Also depending on your GPU the `batch_size` argument might need to be adjusted
|
745 |
+
|
746 |
+
|
747 |
+
|
748 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|