EpHod
Model Introduction
EpHod is an ensemble model for predicting the catalytic optimum pH (pHopt) of enzymes.
The model first uses ESM-1v to encode amino acid sequences into protein representations and then combines predictions from a Residual Lightweight Attention network (RLATtr) and a Support Vector Regression model (SVR).
Paper: Machine learning prediction of enzyme optimum pH
Model Description
The EpHod inference pipeline contains three main prediction components:
- ESM-1v: Encodes enzyme sequences into 1280-dimensional residue-level protein representations;
- RLATtr: Uses a residual lightweight attention network to predict
pHoptand can optionally output residue-level attention weights and a 2560-dimensional EpHod protein representation; - SVR: Performs support vector regression using pooled and standardized ESM-1v representations;
- Ensemble: Uses the average of the RLATtr and SVR predictions as the final
pHoptprediction.
The official RLATtr model was first pretrained on approximately 1.9 million proteins labeled with optimum environmental pH (pHenv) and was then fine-tuned on 9,855 enzymes labeled with catalytic optimum pH (pHopt).
Input sequences longer than 1022 residues are truncated.
To avoid pooling-related bias, the current inference entry point uses a fixed batch size of 1.
Use Cases
| Use Case | Description |
|---|---|
| Enzyme optimum pH prediction | Predict catalytic optimum pH from an enzyme amino acid sequence. |
| Enzyme candidate screening | Compare multiple candidate enzyme sequences based on predicted optimum pH. |
| Attention analysis | Optionally save residue-level RLATtr attention weights. |
| Protein representation extraction | Optionally save the final 2560-dimensional RLATtr protein representation. |
Usage
1. OneCode
You can use the OneCode online environment for an intelligent one-click AI4S programming experience:
Try OneCode for AI4S Programming
2. Manual Installation
Hardware Requirements
- Supports CPU and accelerator devices supported by PyTorch;
- GPU or SCNet DCU is recommended for ESM-1v inference;
- CPU execution is supported but is significantly slower;
- ESM-1v contains approximately 650 million parameters;
- Device memory usage depends on sequence length. If device memory is insufficient, reduce the input sequence length or process sequences individually.
Download the Model Package
Install the Hugging Face command-line tool and download the model repository:
python -m pip install -U huggingface_hub
hf download OneScience-Group/EpHod --local-dir ./EpHod
cd EpHod
Install the Runtime Environment
DCU Environment
# Activate DTK and Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
python -m pip install "onescience[bio-dcu]" \
-i http://mirrors.onescience.ai:3141/pypi/simple/ \
--trusted-host mirrors.onescience.ai
GPU Environment
# Activate Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
python -m pip install "onescience[bio-gpu]" \
-i http://mirrors.onescience.ai:3141/pypi/simple/ \
--trusted-host mirrors.onescience.ai
Install the additional dependencies required by EpHod:
python -m pip install --no-deps -r requirements.txt
Weight Preparation
Inference requires all three of the following assets:
| Asset | Relative Path | Purpose |
|---|---|---|
| ESM-1v 650M weights | weight/esm1v_t33_650M_UR90S_1.pt |
Generate residue-level protein representations |
| RLATtr weights | weight/ESM1v-RLATtr.pt |
Neural-network prediction branch |
| SVR model and normalization statistics | weight/ESM1v-SVR.pkl |
Support Vector Regression prediction branch |
Official sources:
- ESM-1v main checkpoint
- EpHod RLATtr weights and training data
ESM1v-SVR.pklis distributed with the official EpHod repository.
Quick Inference
The following command uses a validated smoke-test sequence:
python scripts/inference.py \
--fasta_path conf/data/smoke.fasta \
--output_path output/smoke/prediction.csv \
--verbose 1 \
--save_attention_weights 0 \
--save_embeddings 0
A complete example using the provided test sequences:
python scripts/inference.py \
--fasta_path conf/data/test_sequences.fasta \
--output_path output/inference/prediction.csv \
--verbose 1 \
--save_attention_weights 0 \
--save_embeddings 0
The output CSV contains three prediction columns:
RLATtr,SVR,Ensemble
Their meanings are:
RLATtr: optimum-pH prediction from the neural-network branch;SVR: optimum-pH prediction from the support vector regression branch;Ensemble: arithmetic mean of the RLATtr and SVR predictions and the recommended final EpHod prediction.
The --output_path argument directly specifies the complete output CSV path and automatically creates its parent directory when required.
The original --save_dir and --csv_name options remain available.
If --output_path is not specified, the output path is generated from --save_dir and --csv_name.
Save Attention Weights and Protein Representations
Set the corresponding options to 1:
python scripts/inference.py \
--fasta_path conf/data/smoke.fasta \
--output_path output/features/prediction.csv \
--save_attention_weights 1 \
--save_embeddings 1
The output includes:
output/features/
├── attention_weights/
├── embeddings.csv
└── prediction.csv
attention_weights/ stores residue-level RLATtr attention information.
embeddings.csv stores the extracted EpHod protein representations.
prediction.csv stores the RLATtr, SVR, and ensemble optimum-pH predictions.
OneScience Official Resources
| 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
- EpHod paper: Machine learning prediction of enzyme optimum pH
- Official implementation: https://github.com/jafetgado/EpHod
- EpHod model and data: Machine learning prediction of enzyme optimal pH
- The upstream EpHod implementation is distributed under the MIT License.
- This model package provides SCNet/DCU runtime adaptation and directory organization based on the official implementation.
- The adaptation does not modify the copyright status, licenses, or terms of use of the original paper, source code, model weights, datasets, ESM-1v assets, or other third-party resources.
中文说明
模型简介
EpHod 是用于预测酶催化最适 pH(pHopt)的集成模型。
模型先使用 ESM-1v 将氨基酸序列编码为蛋白质表征,再融合残差轻量注意力网络(RLATtr)和支持向量回归模型(SVR)的预测。
模型描述
EpHod 推理(inference)流程包含以下三个主要预测组件。
- ESM-1v:将酶序列编码为 1280 维的残基级蛋白质表征。
- RLATtr:使用残差轻量注意力网络预测
pHopt,可选输出残基级注意力权重及 2560 维 EpHod 蛋白质表征。 - SVR:对池化并标准化的 ESM-1v 表征进行支持向量回归。
- 集成:将 RLATtr 和 SVR 预测的平均值作为最终
pHopt预测值。
官方 RLATtr 模型先在约 1.9 million 个标注了最适环境 pH(pHenv)的蛋白质上预训练,再在 9,855 个标注了催化最适 pH(pHopt)的酶上微调(fine-tuning)。
超过 1022 个残基的输入序列将被截断。
为避免池化引起的偏差,当前推理入口的批大小固定为 1。
使用场景
| 使用场景 | 说明 |
|---|---|
| 酶最适 pH 预测 | 根据酶的氨基酸序列预测催化最适 pH。 |
| 酶候选筛选 | 根据预测的最适 pH 比较多个候选酶序列。 |
| 注意力分析 | 可选保存残基级 RLATtr 注意力权重。 |
| 蛋白质表征提取 | 可选保存最终的 2560 维 RLATtr 蛋白质表征。 |
使用方法
1. OneCode
可以通过 OneCode 在线环境体验智能一键 AI4S 编程。
2. 手动安装
硬件要求
- 支持 CPU 和 PyTorch 支持的加速设备。
- 建议使用 GPU 或 SCNet DCU 进行 ESM-1v 推理。
- 支持在 CPU 上运行,速度明显较慢。
- ESM-1v 包含约 650 million 个参数。
- 设备内存用量取决于序列长度。若设备内存不足,请缩短输入序列或逐条处理序列。
下载模型包
安装 Hugging Face 命令行工具并下载模型仓库。
python -m pip install -U huggingface_hub
hf download OneScience-Group/EpHod --local-dir ./EpHod
cd EpHod
安装运行环境
DCU 环境
# Activate DTK and Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
python -m pip install "onescience[bio-dcu]" \
-i http://mirrors.onescience.ai:3141/pypi/simple/ \
--trusted-host mirrors.onescience.ai
GPU 环境
# Activate Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
python -m pip install "onescience[bio-gpu]" \
-i http://mirrors.onescience.ai:3141/pypi/simple/ \
--trusted-host mirrors.onescience.ai
安装 EpHod 所需的附加依赖。
python -m pip install --no-deps -r requirements.txt
权重准备
推理需要以下全部三个文件。
| 文件 | 相对路径 | 用途 |
|---|---|---|
| ESM-1v 650M 权重 | weight/esm1v_t33_650M_UR90S_1.pt |
生成残基级蛋白质表征 |
| RLATtr 权重 | weight/ESM1v-RLATtr.pt |
神经网络预测分支 |
| SVR 模型和归一化统计量 | weight/ESM1v-SVR.pkl |
支持向量回归预测分支 |
官方来源
- ESM-1v 主模型权重(检查点)(checkpoint)
- EpHod RLATtr 权重及训练数据
ESM1v-SVR.pkl随 EpHod 官方仓库分发。
快速推理
以下命令使用经过验证的冒烟测试序列。
python scripts/inference.py \
--fasta_path conf/data/smoke.fasta \
--output_path output/smoke/prediction.csv \
--verbose 1 \
--save_attention_weights 0 \
--save_embeddings 0
使用随附测试序列的完整示例。
python scripts/inference.py \
--fasta_path conf/data/test_sequences.fasta \
--output_path output/inference/prediction.csv \
--verbose 1 \
--save_attention_weights 0 \
--save_embeddings 0
输出 CSV 包含三个预测列。
RLATtr,SVR,Ensemble
各列的含义如下。
RLATtr,神经网络分支预测的最适 pH。SVR,支持向量回归分支预测的最适 pH。Ensemble,RLATtr 和 SVR 预测的算术平均值,为推荐的 EpHod 最终预测。
--output_path 参数直接指定完整的输出 CSV 路径,并在需要时自动创建父目录。
原有的 --save_dir 和 --csv_name 选项仍可使用。
如果未指定 --output_path,则根据 --save_dir 和 --csv_name 生成输出路径。
保存注意力权重和蛋白质表征
将相应选项设置为 1。
python scripts/inference.py \
--fasta_path conf/data/smoke.fasta \
--output_path output/features/prediction.csv \
--save_attention_weights 1 \
--save_embeddings 1
输出包括以下内容。
output/features/
├── attention_weights/
├── embeddings.csv
└── prediction.csv
attention_weights/ 存放残基级 RLATtr 注意力信息。
embeddings.csv 存放提取的 EpHod 蛋白质表征。
prediction.csv 存放 RLATtr、SVR 及集成最适 pH 预测。
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 |
引用与许可证
- EpHod 论文 通过机器学习预测酶最适 pH
- 官方实现 https://github.com/jafetgado/EpHod
- EpHod 模型和数据 通过机器学习预测酶最适 pH
- EpHod 上游实现采用 MIT License 分发。
- 本模型包在官方实现基础上提供 SCNet/DCU 运行时适配与目录组织。
- 此适配不改变原始论文、源代码、模型权重、数据集、ESM-1v 资产或其他第三方资源的版权状态、许可证或使用条款。
- Downloads last month
- 24