ProtDETR is a novel framework designed for the classification of multifunctional enzymes inspired by Object Detection in Computer Vision. You can read the preprint here - Interpretable Enzyme Function Prediction via Residue-Level Detection.
To run ProtDETR, you will need to set up an environment with specific package versions.
The primary packages:
- fair-esm-2.0.0
- torch-1.13.0 (GPU version, compatible with specific CUDA versions)
- scipy-1.10.1
To facilitate the classification of multifunctional enzymes, please download the datasets (namely split100, new, and price) directly from our Google Drive instead of CLEAN's GitHub repository. For details regarding this change, please see this issue discussion. Subsequently, move the downloaded CSV files into the ./data/multi_func/ directory within your project.
Note: Our dataset files may have different row ordering compared to the current CLEAN repository, but the content remains identical when sorted by Entry.
For the classification of monofunctional enzymes, acquire the ECPred40 dataset available on Zenodo at https://doi.org/10.5281/zenodo.7253910. Ensure to convert the training, validation, and test sets into CSV format and position them in the ./data/mono_func/ directory of your project.
Alternatively, you may opt to download the pre-organized dataset directly from our Google Drive at this link. Simply place the entire data directory within the root of your project for seamless integration.
To train models for enzyme classification, use the following commands:
-
For multifunctional enzyme classification:
python train_multi.py -
For monofunctional enzyme classification:
python train_mono.py
The default parameters utilized in our scripts are consistent with those detailed in our final publication. Users are encouraged to modify the hyperparameters to tailor them to their specific needs. To facilitate a more efficient training process, it is highly recommended to use Distributed Data Parallel (DDP) via torchrun. For practical implementations of torchrun, please consult the train_multi.sh and train_mono.sh scripts.
Ensure that the saved_models directory has already been created within your project directory to prevent any issues with model weight saving.
-
For evaluating multifunctional enzyme classification models:
python eval_multi.py -
For evaluating monofunctional enzyme classification models:
python eval_mono.py
eval_multi.py is intended for the released benchmark splits and evaluates the hard-coded new.csv and price.csv datasets under ./data/multi_func/.
To run ProtDETR on custom protein sequences, use the standalone prediction script instead of eval_multi.py:
python predict_multi.py \
--input_path ./example_sequences.fasta \
--output_path ./predictions.tsvSupported input formats:
- FASTA: standard multi-FASTA, where each header line is used as
Entry. - Table file: a CSV or TSV with exact column names
EntryandSequence.
Example table format:
Entry Sequence
seq1 MKQKIIIFGGSFDPIHNAHLYIAKHAI...
seq2 MAVAQCPASCGELIQGWILGSEKLVS...
For the released multifunctional model, the EC label mapping is built from split100.csv by default. If your label-map file is stored elsewhere, pass it explicitly:
python predict_multi.py \
--input_path ./example_sequences.csv \
--train_data_path /path/to/split100.csv \
--model_path /path/to/ProtDETR_split100.pt \
--output_path ./predictions.tsvNotes:
- Sequence lengths above 1022 amino acids are truncated to the first 1022 residues, consistent with ESM-1b.
- The output file contains
Top1_EC,Top1_Probability, and the full deduplicated EC prediction list with probabilities.
This script allows for the input of a UniProt ID and identifies important sites, such as active sites, based on attention maps generated by our model.
Run command:
python infer_important_site.pyUsage Example: When prompted, enter the UniProt ID and the active sites separated by commas as shown below:
Enter UniProt ID ('exit' to quit): A0JNI4
Enter active sites separated by commas (e.g., 32,47,140): 56, 84
Results: The results are saved for the specified UniProt ID in the following format:
Results saved for A0JNI4 in ./uniprot_results/A0JNI4.txt
Output File Content Example:
-
Encoder Top N attention sites:
- 85, 91, 92, 90, 314, 169, 205, 232, 282, 193
-
Encoder detected active sites:
-
Decoder Predictions and Attention Analysis:
- Query 1:
- Predicted EC: 4.3.1.17
- Decoder Top N attention sites: 56, 90, 85, 91, 92, 86, 84, 50, 55, 83
- Detected active sites: 56, 84
- Query 1:
Pretrained models for ProtDETR are available on Google Drive at this link. Please download and place the saved_models directory within the root directory of your project.
Our code is primarily based on the DETR framework by Facebook Research (DETR GitHub repository), the CLEAN method (CLEAN GitHub repository), and we have also incorporated code from the EnzBert project (EnzBert GitLab repository).
We thank their great work.
We kindly ask you to cite our paper if you find our code or research helpful.
@misc{yang2025interpretableenzymefunctionprediction,
title={Interpretable Enzyme Function Prediction via Residue-Level Detection},
author={Zhao Yang and Bing Su and Jiahao Chen and Ji-Rong Wen},
year={2025},
eprint={2501.05644},
archivePrefix={arXiv},
primaryClass={q-bio.BM},
url={https://arxiv.org/abs/2501.05644},
}