deanluo commited on
Commit
bb929a8
·
verified ·
1 Parent(s): 4d40ede

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +264 -0
README.md CHANGED
@@ -1,3 +1,267 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ language:
4
+ - en
5
+ tags:
6
+ - enzyme
7
+ - enzyme-reaction
8
+ - reaction-retrieval
9
+ - protein-sequence
10
+ - protein-language-model
11
+ - bioinformatics
12
+ - computational-biology
13
+ - uncertainty
14
+ - mahalanobis-distance
15
+ library_name: pytorch
16
  ---
17
+
18
+ # EZHit
19
+
20
+ **EZHit** is a lightweight enzyme–reaction retrieval model for predicting potential catalytic compatibility between enzyme sequences and biochemical reactions.
21
+
22
+ Given an enzyme amino-acid sequence and a reaction SMILES, EZHit estimates whether the enzyme is likely to catalyze the reaction. The released checkpoints can be used for enzyme–reaction pair prediction, custom fine-tuning, and uncertainty-aware inference with Mahalanobis-distance-based distribution assessment.
23
+
24
+ ---
25
+
26
+ ## Online demo
27
+
28
+ An interactive web demo is available at:
29
+
30
+ [EZHit HuggingFace Space](https://huggingface.co/spaces/deanluo/Enzyme-Catalysis-Predictor)
31
+
32
+ The Space supports:
33
+
34
+ - enzyme–reaction pair prediction
35
+ - ensemble probability output
36
+ - ensemble uncertainty estimation
37
+ - Mahalanobis-distance-based reliability assessment
38
+ - reaction visualization
39
+
40
+ ---
41
+
42
+ ## Code and Colab notebook
43
+
44
+ The source code and Colab fine-tuning notebook are available at:
45
+
46
+ - GitHub repository: [ld139/EzHit](https://github.com/ld139/EzHit)
47
+ - Colab fine-tuning notebook: [Open in Colab](https://colab.research.google.com/github/ld139/EzHit/blob/main/colab/EZHit_FineTune_Colab.ipynb)
48
+
49
+ The Colab notebook allows users to fine-tune EZHit on their own enzyme–reaction datasets and export a fine-tuned checkpoint together with `train_distribution_stat.pt` for Mahalanobis-distance inference.
50
+
51
+ ---
52
+
53
+
54
+ ## Model variants
55
+
56
+ | Model group | File pattern | Description |
57
+ |---|---|---|
58
+ | General model | `binarycls_best_val_seed*.pt` | General enzyme–reaction compatibility model |
59
+ | Cytochrome P450 model | `ft_p450_best_seed*.pt` | Fine-tuned model for cytochrome P450-related prediction |
60
+ | Phosphatase model | `ft_phosphatase_best_seed*.pt` | Fine-tuned model for phosphatase-related prediction |
61
+ | Terpene synthase model | `ft_terpene_best_seed*.pt` | Fine-tuned model for terpene synthase-related prediction |
62
+
63
+ Each model group may contain multiple seed checkpoints for ensemble prediction.
64
+
65
+ ---
66
+
67
+ ## Download checkpoints
68
+
69
+ Install the HuggingFace Hub client:
70
+
71
+ ```bash
72
+ pip install -U huggingface_hub
73
+ ```
74
+
75
+ Download a checkpoint:
76
+
77
+ ```python
78
+ from huggingface_hub import hf_hub_download
79
+
80
+ ckpt_path = hf_hub_download(
81
+ repo_id="deanluo/EzHit",
82
+ filename="checkpoints/binarycls_best_val_seed40.pt"
83
+ )
84
+
85
+ print(ckpt_path)
86
+ ```
87
+
88
+ Download Mahalanobis statistics:
89
+
90
+ ```python
91
+ from huggingface_hub import hf_hub_download
92
+
93
+ stat_path = hf_hub_download(
94
+ repo_id="deanluo/EzHit",
95
+ filename="uncertainty/general_train_distribution_stat.pt"
96
+ )
97
+
98
+ print(stat_path)
99
+ ```
100
+
101
+ Download all files from this repository:
102
+
103
+ ```python
104
+ from huggingface_hub import snapshot_download
105
+
106
+ local_dir = snapshot_download(
107
+ repo_id="deanluo/EzHit",
108
+ local_dir="EzHit_checkpoints"
109
+ )
110
+
111
+ print(local_dir)
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Input format
117
+
118
+ EZHit takes two main inputs:
119
+
120
+ | Input | Description |
121
+ |---|---|
122
+ | Enzyme sequence | Amino-acid sequence of the enzyme |
123
+ | Reaction SMILES | Reaction in `reactants>>products` format |
124
+
125
+ Example reaction SMILES:
126
+
127
+ ```text
128
+ CCO>>CC=O
129
+ ```
130
+
131
+ For fine-tuning, the expected CSV format is:
132
+
133
+ ```csv
134
+ protein_sequence,CANO_RXN_SMILES,Label
135
+ MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAG,CCO>>CC=O,1
136
+ MKKLLPTAAAGLLLLAAQPAMA,CCO>>CC=O,0
137
+ ```
138
+
139
+ Required columns:
140
+
141
+ | Column | Description |
142
+ |---|---|
143
+ | `protein_sequence` | Enzyme amino-acid sequence |
144
+ | `CANO_RXN_SMILES` | Reaction SMILES in `reactants>>products` format |
145
+ | `Label` | Binary label. `1` for compatible enzyme–reaction pairs and `0` for negative pairs |
146
+
147
+ An optional `split` column can be provided with values `train`, `val`, and `test`.
148
+
149
+ ---
150
+
151
+ ## Output interpretation
152
+
153
+ EZHit can report the following outputs:
154
+
155
+ | Output | Description |
156
+ |---|---|
157
+ | Match probability | Predicted enzyme–reaction compatibility probability |
158
+ | Ensemble uncertainty | Model-disagreement-based uncertainty estimate |
159
+ | Mahalanobis distance | Latent-space distance from the learned training distribution |
160
+
161
+ A typical interpretation is:
162
+
163
+ | Probability | Mahalanobis distance | Interpretation |
164
+ |---|---|---|
165
+ | High | Low | High-priority candidate |
166
+ | High | High | Potentially useful but less reliable or out-of-distribution |
167
+ | Low | Low | In-distribution but predicted as incompatible |
168
+ | Low | High | Low-priority candidate |
169
+
170
+ Thresholds should be adjusted based on the model variant, dataset, and validation results.
171
+
172
+ ---
173
+
174
+ ## Mahalanobis-distance statistics
175
+
176
+ Mahalanobis-distance inference requires a `train_distribution_stat.pt` file generated from the same model architecture and latent dimension as the checkpoint used for prediction.
177
+
178
+ The expected file contains:
179
+
180
+ ```python
181
+ {
182
+ "mean": positive_class_latent_mean,
183
+ "inv_cov": inverse_covariance_matrix
184
+ }
185
+ ```
186
+
187
+ The latent dimension of the statistics file must match the hidden dimension of the checkpoint. For example, if the model hidden dimension is 512, the expected shapes are:
188
+
189
+ ```text
190
+ mean: [512]
191
+ inv_cov: [512, 512]
192
+ ```
193
+
194
+ If a checkpoint is fine-tuned with a different hidden dimension, the corresponding Mahalanobis statistics must be regenerated.
195
+
196
+ For very small fine-tuning datasets, covariance estimation may be unstable. In such cases, Mahalanobis distance should be interpreted cautiously together with probability and ensemble uncertainty.
197
+
198
+ ---
199
+
200
+ ## Fine-tuning
201
+
202
+ Users can fine-tune EZHit using the Colab notebook:
203
+
204
+ [Open EZHit fine-tuning notebook in Colab](https://colab.research.google.com/github/ld139/EzHit/blob/main/colab/EZHit_FineTune_Colab.ipynb)
205
+
206
+ The fine-tuning workflow exports:
207
+
208
+ | File | Description |
209
+ |---|---|
210
+ | `ezhit_finetuned_seed42.pt` | Fine-tuned checkpoint |
211
+ | `train_distribution_stat.pt` | Training-distribution statistics for Mahalanobis-distance inference |
212
+ | `val_predictions.csv` | Validation-set predictions |
213
+ | `test_predictions.csv` | Test-set predictions |
214
+
215
+ The fine-tuned checkpoint and `train_distribution_stat.pt` can be used for customized inference.
216
+
217
+ ---
218
+
219
+ ## Large-scale screening results
220
+
221
+ Large-scale enzyme–reaction screening results are provided separately as a HuggingFace Dataset repository:
222
+
223
+ `TODO: add dataset repository link`
224
+
225
+ Recommended location:
226
+
227
+ ```text
228
+ https://huggingface.co/datasets/deanluo/EzHit-screening-results
229
+ ```
230
+
231
+ The complete training and benchmark datasets will be archived separately on Zenodo:
232
+
233
+ `TODO: add Zenodo link`
234
+
235
+ ---
236
+
237
+ ## Installation for local use
238
+
239
+ Clone the code repository:
240
+
241
+ ```bash
242
+ git clone https://github.com/ld139/EzHit.git
243
+ cd EzHit
244
+ ```
245
+
246
+ Install dependencies:
247
+
248
+ ```bash
249
+ pip install -r requirements.txt
250
+ ```
251
+
252
+ The required `kan.py` implementation is already included in the GitHub repository. No separate KAN package installation is required.
253
+
254
+ ---
255
+
256
+
257
+ ## License
258
+
259
+ This project is released under the MIT License.
260
+
261
+ ---
262
+
263
+ ## Contact
264
+
265
+ For questions, please use the GitHub Issues page:
266
+
267
+ [https://github.com/ld139/EzHit/issues](https://github.com/ld139/EzHit/issues)