Datasets:

Modalities:
Tabular
Text
Formats:
parquet
Libraries:
Datasets
pandas
File size: 9,363 Bytes
766d51a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d14e554
 
 
 
 
 
 
a87131d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d332d58
a87131d
 
d332d58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d14e554
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
---
dataset_info:
  features:
  - name: PDB_ID
    dtype: string
  - name: Entity_ID
    dtype: string
  - name: Chain
    dtype: string
  - name: Length
    dtype: int16
  - name: Fmax_eps-over-A
    dtype: float32
  - name: Fmax_pN
    dtype: float32
  - name: Dmax_A
    dtype: float32
  - name: Lmax_A
    dtype: float32
  - name: Lambda
    dtype: float32
  - name: Sequence
    dtype: string
  splits:
  - name: train
    num_bytes: 3212304
    num_examples: 16652
  - name: test
    num_bytes: 21731
    num_examples: 124
  download_size: 2217065
  dataset_size: 3234035
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
  - split: test
    path: data/test-*
---

# PRESTO: Rapid protein mechanical strength prediction with an end-to-end deep learning model

Proteins often form biomaterials with exceptional mechanical properties equal or even superior to synthetic materials. Currently, using experimental atomic force microscopy or computational molecular dynamics to evaluate protein mechanical strength remains costly and time-consuming, limiting large-scale de novo protein investigations. Therefore, there exists a growing demand for fast and accurate prediction of protein mechanical strength. To address this challenge, we propose PRESTO, a rapid end-to-end deep learning (DL) model to predict protein resistance to pulling directly from its sequence. By integrating a natural language processing model with simulation-based protein stretching data, we first demonstrate that PRESTO can accurately predict the maximal pulling force, for given protein sequences with unprecedented efficiency, bypassing the costly steps of conventional methods. Enabled by this rapid prediction capacity, we further find that PRESTO can successfully identify specific mutation locations that may greatly influence protein strength in a biologically plausible manner, such as at the center of polyalanine regions. Finally, we apply our method to design de novo protein sequences by randomly mixing two known sequences at varying ratios. Interestingly, the model predicts that the strength of these mixed proteins follows up- or down-opening “banana curves”, constructing a protein strength curve that breaks away from the general linear law of mixtures. By discovering key insights and suggesting potential optimal sequences, we demonstrate the versatility of PRESTO primarily as a screening tool in a rapid protein design pipeline. Thereby our model may offer new pathways for protein material research that requires analysis and testing of large-scale novel protein sets, as a discovery tool that can be complemented with other modeling methods, and ultimately, experimental synthesis and testing.

![image](https://cdn-uploads.huggingface.co/production/uploads/623ce1c6b66fedf374859fe7/kg7H9T2wgmKQD0lHZVPD4.png)

# Data, model and training

Load data

```python
import math
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
from datasets import load_dataset

ds = load_dataset("lamm-mit/PRESTO-protein-force", split="train")

protein_df = ds.to_pandas()

print(protein_df.columns)
```

Scale data

```python
y_data = np.array(protein_df.Fmax_pN.values)
plt.scatter(range(y_data.shape[0]),y_data,s=2)
plt.xlabel('Sequence Number')
plt.ylabel('${F_{max}} (pN)$')
plt.savefig('data_view.png',dpi=500)
scalar=StandardScaler()
y_data_temp=np.reshape(y_data,(y_data.shape[0],1))
fit_data=scalar.fit(y_data_temp)  
mean=fit_data.mean_[0]  
std=math.sqrt(fit_data.var_)  
Y=scalar.fit_transform(y_data_temp)
```

Define tokenizer and model 

```python
# maximum length of sequence, longer the sequences, more time we need - 
max_length = 300

from tensorflow.keras.preprocessing.text import Tokenizer
tokenizer = Tokenizer(char_level=True)
tokenizer.fit_on_texts(seqs)
X = tokenizer.texts_to_sequences(seqs)
# if AA seq is longer than max_lenght will be discarded
X = sequence.pad_sequences(X, maxlen=max_length)
```

Split train/test

```python
X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=.2,random_state=23)
```

Define model

```python
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Conv1D, Flatten
from tensorflow.keras.layers import Dropout
from tensorflow.keras.layers import Embedding

model = Sequential()
model.add(Embedding(len(tokenizer.word_index)+1, embedding_dim, input_length=max_length))
model.add(Conv1D(filters=64, kernel_size=3, padding='same', activation='relu'))
model.add(Conv1D(filters=32, kernel_size=3, padding='same', activation='relu'))
model.add(tf.keras.layers.Bidirectional(keras.layers.LSTM(units=32,return_sequences=True)))
model.add(tf.keras.layers.Bidirectional(keras.layers.LSTM(units=16,return_sequences=True)))
model.add(Flatten())
model.add(Dropout(0.5))
model.add(Dense(32, activation='relu'))
model.add(Dense(1, activation='linear'))
model.compile(loss='mean_squared_error', optimizer='adam')
```

Train model 

```python
hist=model.fit(X_train, y_train, validation_data=(X_test, y_test), epochs=100, batch_size=128)
model.save('PRESTO.h5')
```

Plots
```
from tensorflow.keras.models import load_model
import itertools

model=load_model('PRESTO.h5')
y_train_pred = model.predict(X_train)
y_test_pred = model.predict(X_test)
plt.title('Sequence-to-Feature Model')
plt.scatter(y_train,y_train_pred,s=2)
plt.scatter(y_test,y_test_pred,c='r',s=2)
plt.xlabel('BSDB ${F_{max}}$ (pN)')
plt.ylabel('ML ${F_{max}}$ (pN)')
plt.legend(['training', 'validation'])
plt.savefig('train_comp.png',dpi=500)
```

![image](https://cdn-uploads.huggingface.co/production/uploads/623ce1c6b66fedf374859fe7/3FouBrLR1siS2xScemhke.png)


# Optimization examples

Fitness function

```python
def objective_value(input_seqs,fitness_fcn):
    tmp=tokenizer.texts_to_sequences(input_seqs)
    temp=sequence.pad_sequences(tmp, maxlen=max_length)
    y_pred=fitness_fcn.predict(temp)
    return y_pred

def iterate_mutate_no_target(sequences, targeta):
    list_list_seq = []
    for x in range(len(sequences)):
        list_list_seq.append(mutate_no_target(sequences[x], targeta))
    return list_list_seq

def iterate_calc(sequences):
    list_list_seq = []
    for x in sequences:
      list_list_seq.append((objective_value(x,fitness_fcn)*std+mean).flatten())
    return list_list_seq
```

Sample sequences
```python
prot_2c7w =     'HQRKVVSWIDVYTRATCQPREVVVPLTVELMGTVAKQLVPSCVTVQRCGGCCPDDGLECVPTGQHQVRMQILMIRYPSSQLGEMSLEEHSQCECRPKKK'
prot_2g38 =     'MSFVITNPEALTVAATEVRRIRDRAIQSDAQVAPMTTAVRPPAADLVSEKAATFLVEYARKYRQTIAAAAVVLEEFAHALTTGADKYATAEADNIKTFS'
prot_2g38_mut = 'MSFVITNPEALTVAATCVRRIRDRAIQSDAQGAPMTTAVRPCADLVSCGGACCFLGEYACKYGQTIAAAAVVLEEFAHALTTGADKYATAEACNCKTFS'
prot_1yn4=      'GKHTVPYTISVDGITALHRTYFVFPENKKVLYQEIDSKVKNELASQRGVTTEKINNAQTATYTLTLNDGNKKVVNLKKNDDAKNSIDPSTIKQIQIVVK'
prot_1kat=      'HHEVVKFMDVYQRSYCHPIETLVDIFQEYPDEIEYIFKPSCVPLMRCGGCCNDEGLECVPTEESNITMQIMRIKPHQGQHIGEMSFLQHNKCECRPKKD'
prot_1bmp=      'STGSKQRSQNRSKTPKNQEALRMANVAENSSSDQRQACKKHELYVSFRDLGWQDWIIAPEGYAAYYCEGECAFPLNSYMNATNHAIVQTLVHFINPETVPKPCCAPTQLNAISVLYFDDSSNVILKKYRNMVVRACGCH'
prot_1cdc=      'RDSGTVWGALGHGINLNIPNFQMTDDIDEVRWERGSTLVAEFKRKMKPFLKSGAFEILANGDLKIKNLTRDDSGTYNVTVYSTNGTRILDKALDLRILE'
```
```python
#mutates seq into poly-X (change AA and color)
ori =           'MNIFEMLRIDEGLRLKIYLDKAIGRNRAALVNLVFQIGETAAAAAAAAAAAAAAAAAAGAAGFTNSLRYLQQKRWDEAAVNFAKSRWYNQTPNRAKRIAAAAAAAAAAAAAAAAAAITVFRTGTWDAYKNL'
AA='T'
color='orange'
multiple_ori = []
mutated_seqs=[]
mutated_seqs_fmax=[]
num=100
for i in range(num):
    multiple_ori.append(ori)

mutated_seqs = iterate_mutate_no_target(multiple_ori, AA)
mutated_seqs_fmax = iterate_calc(mutated_seqs)
pd.DataFrame(mutated_seqs).to_csv("mutations_"+AA+".csv")
np.savetxt('mutations_'+AA+'_fmax.csv', mutated_seqs_fmax, delimiter=',')

for y in mutated_seqs_fmax:
    plt.plot(y,'0.7', zorder=0, linewidth=0.4)

transposed=np.transpose(mutated_seqs_fmax)
transposed_mean=[]
transposed_sd=[]

for x in transposed:
    transposed_mean.append(np.mean(x))
    transposed_sd.append(np.std(x))
```

Plot results

```python
plt.errorbar(range(len(transposed_mean)),transposed_mean,transposed_sd,capsize=2,zorder=50,color=color)
plt.xlabel('Number of mutations')
plt.ylabel('${F_{max}}$ (pN)')
plt.title(str(num)+' 1p3n sequences mutate towards poly-'+AA)
plt.plot(0,mutated_seqs_fmax[0][0],'or',zorder=100)
plt.plot(len(mutated_seqs[0])-1,mutated_seqs_fmax[0][len(mutated_seqs_fmax[0])-1],'or',zorder=100)
plt.savefig('mutations_'+AA+'.png',dpi=500)
```

![image](https://cdn-uploads.huggingface.co/production/uploads/623ce1c6b66fedf374859fe7/laM-07m_WywyEmFqV4B1I.png)

# Sample results

![image](https://cdn-uploads.huggingface.co/production/uploads/623ce1c6b66fedf374859fe7/L016VkdQ5vDUM1OJLLVyg.png)

![image](https://cdn-uploads.huggingface.co/production/uploads/623ce1c6b66fedf374859fe7/DZ-UwfEVI_3LeXsRiGxZF.png)

# Reference

```bibtex
@article{liu2022presto,
  title        = {{PRESTO}: Rapid protein mechanical strength prediction with an end-to-end deep learning model},
  author       = {Liu, Frank Y. C. and Ni, Bo and Buehler, Markus J.},
  journal      = {Extreme Mechanics Letters},
  volume       = {55},
  pages        = {101803},
  year         = {2022},
  publisher    = {Elsevier},
  doi          = {10.1016/j.eml.2022.101803},
}
```