UniKP
Model Introduction
UniKP is a unified framework for predicting enzyme kinetic parameters based on pretrained language models. Given a protein sequence and substrate structure, it can predict the enzyme turnover number $k_{cat}$, Michaelis constant $K_m$, and catalytic efficiency $k_{cat}/K_m$. UniKP uses a protein language model to extract enzyme sequence representations and combines them with substrate representations generated by a molecular language model to predict kinetic parameters.
Paper:
UniKP: a unified framework for the prediction of enzyme kinetic parameters
https://doi.org/10.1038/s41467-023-44113-1
Model Description
UniKP takes the enzyme protein sequence and substrate SMILES as two separate inputs. On the protein side, ProtT5-XL-UniRef50 is used to extract sequence representations, while on the substrate side, a SMILES Transformer is used to generate molecular representations. The two feature representations are concatenated and then fed into trained regression models to predict $k_{cat}$, $K_m$, and $k_{cat}/K_m$, respectively.
Use Cases
| Scenario | Description |
|---|---|
| Enzyme turnover number prediction | Predict $k_{cat}$ from a protein sequence and substrate SMILES |
| Michaelis constant prediction | Predict $K_m$ for an enzyme-substrate system |
| Catalytic efficiency prediction | Predict $k_{cat}/K_m$ |
| Enzyme discovery and screening | Predict and rank kinetic parameters for candidate enzyme sequences |
| Enzyme directed evolution | Compare predicted kinetic parameters of wild-type and mutant candidates |
| Environmental factor analysis | Use EF-UniKP-related implementations to investigate the effects of temperature and pH on $k_{cat}$ |
Usage
1. Using OneCode
You can use the OneCode online environment for intelligent one-click AI4S programming:
Try intelligent one-click AI4S programming
2. Manual Installation and Usage
Hardware Requirements
- ProtT5-XL-UniRef50 is relatively large, so GPU/DCU acceleration is recommended for protein representation extraction.
- A CPU can be used for a small number of short sequences, but it will be significantly slower than an accelerator.
- For batch prediction or long-sequence tasks, it is recommended to reduce the batch size and adjust it according to the available device memory.
Environment Setup
DCU Environment
# Activate DTK and CONDA first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[bio] \
-i http://mirrors.onescience.ai:3141/pypi/simple/ \
--trusted-host mirrors.onescience.ai
Environment Notes
- If you encounter missing dependencies or version incompatibilities during execution, refer to the dependency versions specified in
requirements.txtand install or adjust the corresponding packages as needed.
Model Weights
Complete UniKP inference requires three types of model resources:
- ProtT5-XL-UniRef50;
- UniKP regression models for $k_{cat}$, $K_m$, and $k_{cat}/K_m$;
- The vocabulary and pretrained weights of the SMILES Transformer.
1) ProtT5-XL-UniRef50
ProtT5-XL-UniRef50 needs to be downloaded separately:
https://zenodo.org/records/4644188
It is recommended to place it as follows:
UniKP/
└── weight/
└── prot_t5_xl_uniref50/
The current code will first try to use:
T5Tokenizer.from_pretrained("weight/prot_t5_xl_uniref50")
T5EncoderModel.from_pretrained("weight/prot_t5_xl_uniref50")
If weight/prot_t5_xl_uniref50 does not exist, the code will fall back to "prot_t5_xl_uniref50". You can also adjust scripts/project_paths.py according to the actual local path.
2) UniKP Regression Models
The official README provides download links for the models corresponding to the three tasks:
https://huggingface.co/HanselYu/UniKP/tree/main
Typical files include:
UniKP for kcat.pkl
UniKP for Km.pkl
UniKP for kcat_Km.pkl
- These files are included in
weight/UniKP_model.
3. Quick Start
Download the Model Package
hf download OneScience-Group/UniKP --local-dir ./UniKP
cd UniKP-main
- UniKP additionally depends on ProtT5-XL-UniRef50 and the three types of UniKP regression model weights. Please prepare the required models according to the "Model Weights" section before proceeding.
- The SMILES Transformer-related code is located in
model/. Before running, make sure thatweight/vocab.pklandweight/trfm_12_23000.pklexist.
Quick Verification
Check whether ProtT5 can be loaded locally:
python - <<'PY'
from transformers import T5Tokenizer, T5EncoderModel
path = "./weight/prot_t5_xl_uniref50"
T5Tokenizer.from_pretrained(path, do_lower_case=False)
T5EncoderModel.from_pretrained(path)
print("ProtT5 load OK")
PY
Check the regression model and SMILES Transformer resources:
ls -lh weight/UniKP_model/
ls -lh weight/vocab.pkl weight/trfm_12_23000.pkl
If all of the above checks pass, you can continue with the single-sample inference script:
python scripts/demo_kcat.py
Example Data
The core inputs for UniKP inference are:
Protein amino acid sequence
+
Substrate SMILES
Example:
| Input | Example |
|---|---|
| Protein sequence | MSELMKLSAV...MAQR |
| Substrate SMILES | CC(O)O |
The corresponding output can be:
kcat
Km
kcat / Km
Inference Examples
Single-Sample kcat Prediction
Run the following command from the UniKP root directory:
python scripts/demo_kcat.py
This script reads an example protein sequence and substrate SMILES, extracts their representations using ProtT5-XL-UniRef50 and the SMILES Transformer, respectively, concatenates the representations, and then loads weight/UniKP_model/UniKP for kcat.pkl to perform kcat prediction.
The prediction result is printed to the terminal and saved as:
UniKP_kcat_prediction.xlsx
By default, demo_kcat.py loads the kcat regression model:
with open("weight/UniKP_model/UniKP for kcat.pkl", "rb") as f:
model = pickle.load(f)
To predict Km, replace the model path above with:
with open("weight/UniKP_model/UniKP for Km.pkl", "rb") as f:
model = pickle.load(f)
To predict kcat/Km, replace it with:
with open("weight/UniKP_model/UniKP for kcat_Km.pkl", "rb") as f:
model = pickle.load(f)
Except for the regression model, the protein representation extraction, SMILES representation extraction, feature concatenation, and prediction workflow remain unchanged. The model outputs are in log10 space, and the script converts them back to the actual kinetic parameter values using 10 ** x.
Batch Prediction
The repository provides separate batch prediction scripts for kcat, Km, and kcat/Km:
python scripts/UniKP_kcat.py
python scripts/UniKP_Km.py
python scripts/UniKP_kcat_Km.py
The three scripts read the corresponding task data files and load the matching UniKP regression models to perform batch prediction on multiple protein sequences and substrate entries.
Before running, make sure that the data files for the corresponding task are located in conf/datasets/.
Output Description
UniKP outputs the predicted values of the corresponding enzyme kinetic parameters.
| Parameter | Unit Used in the Official Example |
|---|---|
| $k_{cat}$ | s⁻¹ |
| $K_m$ | mM |
| $k_{cat}/K_m$ | s⁻¹·mM⁻¹ |
The internal predictions of the UniKP regression models are in log10 space, so the output of model.predict() cannot be treated directly as the actual kinetic parameter values. Use:
pred = model.predict(fused_vector)
pred_real = [10 ** x for x in pred]
The official example saves the results as:
Kinetic_parameters_predicted_label.xlsx
OneScience Official Information
| Platform | OneScience Main Repository | Skills Repository |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
Citation and License
- Original UniKP paper: UniKP: a unified framework for the prediction of enzyme kinetic parameters.
- UniKP is licensed under the GNU General Public License version 3 (GPL-3.0).
- UniKP inference depends on third-party models and code such as ProtT5-XL-UniRef50 and the SMILES Transformer. Their respective licenses and terms of use must also be followed when using, modifying, or redistributing these resources.
- For research use, it is recommended to cite the original UniKP paper. If ProtT5 or the SMILES Transformer is used to generate representations, the corresponding projects should also be cited as required.
中文说明
模型简介
UniKP 是基于预训练语言模型预测酶动力学参数的统一框架。给定蛋白质序列和底物结构,它可以预测酶转换数 $k_{cat}$、米氏常数 $K_m$ 及催化效率 $k_{cat}/K_m$。UniKP 使用蛋白质语言模型(protein language model)提取酶序列表征,再与分子语言模型生成的底物表征结合,以预测动力学参数。
论文
UniKP:预测酶动力学参数的统一框架
https://doi.org/10.1038/s41467-023-44113-1
模型描述
UniKP 将酶蛋白质序列和底物 SMILES 作为两个独立输入。蛋白质侧使用 ProtT5-XL-UniRef50 提取序列表征,底物侧使用 SMILES Transformer 生成分子表征。拼接两个特征表征后,将其送入已训练的回归模型,分别预测 $k_{cat}$、$K_m$ 及 $k_{cat}/K_m$。
使用场景
| 场景 | 说明 |
|---|---|
| 酶转换数预测 | 根据蛋白质序列和底物 SMILES 预测 $k_{cat}$ |
| 米氏常数预测 | 预测酶-底物体系的 $K_m$ |
| 催化效率预测 | 预测 $k_{cat}/K_m$ |
| 酶的发现与筛选 | 预测候选酶序列的动力学参数并排序 |
| 酶定向进化 | 对比野生型及突变候选体的预测动力学参数 |
| 环境因素分析 | 使用 EF-UniKP 相关实现研究温度和 pH 对 $k_{cat}$ 的影响 |
使用方法
1. 使用 OneCode
可通过 OneCode 在线环境体验智能一键 AI4S 编程。
2. 手动安装与使用
硬件要求
- ProtT5-XL-UniRef50 相对较大,建议使用 GPU/DCU 加速提取蛋白质表征。
- 可使用 CPU 处理少量短序列,但速度显著低于加速器。
- 对于批量预测或长序列任务,建议减小批大小,并根据设备可用内存进行调整。
环境配置
DCU 环境
# Activate DTK and CONDA first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[bio] \
-i http://mirrors.onescience.ai:3141/pypi/simple/ \
--trusted-host mirrors.onescience.ai
环境说明
- 如果运行时遇到依赖缺失或版本不兼容,请参照
requirements.txt指定的依赖版本,按需安装或调整相应软件包。
模型权重
完整的 UniKP 推理(inference)需要三类模型资源。
- ProtT5-XL-UniRef50。
- 用于 $k_{cat}$、$K_m$ 及 $k_{cat}/K_m$ 的 UniKP 回归模型。
- SMILES Transformer 的词表和预训练权重。
1) ProtT5-XL-UniRef50
需要另行下载 ProtT5-XL-UniRef50。
https://zenodo.org/records/4644188
建议放在以下位置。
UniKP/
└── weight/
└── prot_t5_xl_uniref50/
当前代码会先尝试使用以下资源。
T5Tokenizer.from_pretrained("weight/prot_t5_xl_uniref50")
T5EncoderModel.from_pretrained("weight/prot_t5_xl_uniref50")
如果 weight/prot_t5_xl_uniref50 不存在,代码会回退到 "prot_t5_xl_uniref50"。也可依据实际本地路径调整 scripts/project_paths.py。
2) UniKP 回归模型
官方 README 提供对应三项任务的模型下载链接。
https://huggingface.co/HanselYu/UniKP/tree/main
典型文件如下。
UniKP for kcat.pkl
UniKP for Km.pkl
UniKP for kcat_Km.pkl
- 这些文件包含在
weight/UniKP_model中。
3. 快速开始
下载模型包
hf download OneScience-Group/UniKP --local-dir ./UniKP
cd UniKP-main
- UniKP 还依赖 ProtT5-XL-UniRef50 和三类 UniKP 回归模型权重。继续前,请按照“模型权重”一节准备所需模型。
- SMILES Transformer 相关代码位于
model/。运行前,请确认weight/vocab.pkl和weight/trfm_12_23000.pkl存在。
快速验证
检查能否在本地加载 ProtT5。
python - <<'PY'
from transformers import T5Tokenizer, T5EncoderModel
path = "./weight/prot_t5_xl_uniref50"
T5Tokenizer.from_pretrained(path, do_lower_case=False)
T5EncoderModel.from_pretrained(path)
print("ProtT5 load OK")
PY
检查回归模型及 SMILES Transformer 资源。
ls -lh weight/UniKP_model/
ls -lh weight/vocab.pkl weight/trfm_12_23000.pkl
若以上检查均通过,可继续运行单样本推理脚本。
python scripts/demo_kcat.py
示例数据
UniKP 推理的核心输入如下。
Protein amino acid sequence
+
Substrate SMILES
示例
| 输入 | 示例 |
|---|---|
| 蛋白质序列 | MSELMKLSAV...MAQR |
| 底物 SMILES | CC(O)O |
相应输出可以是下列内容。
kcat
Km
kcat / Km
推理示例
单样本 kcat 预测
从 UniKP 根目录运行以下命令。
python scripts/demo_kcat.py
此脚本读取示例蛋白质序列及底物 SMILES,分别使用 ProtT5-XL-UniRef50 和 SMILES Transformer 提取表征,拼接表征后加载 weight/UniKP_model/UniKP for kcat.pkl 进行 kcat 预测。
预测结果会打印到终端并保存为以下文件。
UniKP_kcat_prediction.xlsx
默认情况下,demo_kcat.py 加载 kcat 回归模型。
with open("weight/UniKP_model/UniKP for kcat.pkl", "rb") as f:
model = pickle.load(f)
要预测 Km,请将上述模型路径替换为下方路径。
with open("weight/UniKP_model/UniKP for Km.pkl", "rb") as f:
model = pickle.load(f)
要预测 kcat/Km,请替换为下方路径。
with open("weight/UniKP_model/UniKP for kcat_Km.pkl", "rb") as f:
model = pickle.load(f)
除回归模型外,蛋白质表征提取、SMILES 表征提取、特征拼接和预测流程均保持不变。模型在 log10 空间中输出,脚本通过 10 ** x 将其还原为实际动力学参数值。
批量预测
仓库提供分别用于 kcat、Km 和 kcat/Km 的批量预测脚本。
python scripts/UniKP_kcat.py
python scripts/UniKP_Km.py
python scripts/UniKP_kcat_Km.py
三个脚本读取相应任务的数据文件,加载匹配的 UniKP 回归模型,对多条蛋白质序列和多个底物条目进行批量预测。
运行前,请确认对应任务的数据文件位于 conf/datasets/。
输出说明
UniKP 输出相应酶动力学参数的预测值。
| 参数 | 官方示例所用单位 |
|---|---|
| $k_{cat}$ | s⁻¹ |
| $K_m$ | mM |
| $k_{cat}/K_m$ | s⁻¹·mM⁻¹ |
UniKP 回归模型的内部预测位于 log10 空间,因此不能直接将 model.predict() 的输出当作实际动力学参数值。请使用以下方式转换。
pred = model.predict(fused_vector)
pred_real = [10 ** x for x in pred]
官方示例将结果保存为以下文件。
Kinetic_parameters_predicted_label.xlsx
OneScience 官方信息
| 平台 | OneScience 主仓库 | Skills 仓库 |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
引用与许可证
- UniKP 原始论文UniKP:预测酶动力学参数的统一框架。
- UniKP 采用 GNU 通用公共许可证第 3 版(GPL-3.0)。
- UniKP 推理依赖 ProtT5-XL-UniRef50、SMILES Transformer 等第三方模型及代码。使用、修改或再分发这些资源时,还须遵循其各自许可证和使用条款。
- 用于科研时,建议引用 UniKP 原始论文。若使用 ProtT5 或 SMILES Transformer 生成表征,还应按要求引用相应项目。
- Downloads last month
- 10