alphafold3
介绍¶
alphafold3是Google DeepMind开发的、用于生物分子复合体结构预测的人工智能模型,该模型接受一个json形式的、用于描述生物分子体系的文件,输出预测结构与置信度打分信息。结构预测过程主要分为两步:
data pipeline
: 在一定参数控制下,基于输入的序列信息进行生物信息学搜索,得到结构预测所需的共进化信息 (multi-sequence alginment, msa) 与结构模板 (templates),并将这些信息与输入信息整合,将整合信息作为json文件输出inference
: 读取整合入msa和templates的json文件,转化为模型输入特征进行推理,输出mmcif格式的预测结构与confidence score
项目地址 https://github.com/google-deepmind/alphafold3/
软件镜像和数据库下载¶
可以使用南京大学的镜像站里的下载链接
https://mirror.nju.edu.cn/alphafold/
权重可以使用集群中申请好的。
基本使用¶
Warning
alphafold3 需要在 GPU 队列运行,需要向管理员申请 GPU 队列使用权限。
输入文件 input.json
{
"name": "2PV7",
"sequences": [
{
"protein": {
"id": ["A", "B"],
"sequence": "GMRESYANENQFGFKTINSDIHKIVIVGGYGKLGGLFARYLRASGYPISILDREDWAVAESILANADVVIVSVPINLTLETIERLKPYLTENMLLADLTSVKREPLAKMLEVHTGAVLGLHPMFGADIASMAKQVVVRCDGRFPERYEWLLEQIQIWGAKIYQTNATEHDHNMTYIQALRHFSTFANGLHLSKQPINLANLLALSSPIYRLELAMIGRLFAQDAELYADIIMDKSENLAVIETLKQTYDEALTFFENNDRQGFIDAFHKVRDWFGDYSEQFLKESRQLLQQANDLKQG"
}
}
],
"modelSeeds": [1],
"dialect": "alphafold3",
"version": 1
}
准备运行目录,并将输入文件放入其中, mkdir af3_run; mv input.json af3_run
。
运行脚本
#BSUB -J alphafold3
#BSUB -n 16
#BSUB -o %J.out
#BSUB -e %J.err
#BSUB -q gpu
module load Singularity/3.7.3
singularity exec \
--nv \
--bind af3_run:/af3_run \
--bind /public/home/software/opt/af3_weights/:/af3_weights \
--bind /public/home/software/opt/af3_db/:/af3_db \
$IMAGE/alphafold/3.0.1.sif \
/alphafold3_venv/bin/python /app/alphafold/run_alphafold.py \
--json_path=/af3_run/input.json \
--model_dir=/af3_weights \
--db_dir=/af3_db \
--output_dir=/af3_run
结果文件位于 af3_run/2PV7
目录内,结果解读见官方文档 AlphaFold 3 Output。
分步运行¶
alphafold3 程序运行主要分为 data pipeline 和 inference 两步。其中,data pipeline 只使用 CPU 计算,且耗时较长;inference 会用到 GPU 进行蛋白结构预测。
因为集群上 GPU 有限,因此如果有较多蛋白需要预测,建议先在 CPU 队列上运行 data pipeline,然后再到 GPU 队列上运行 inference,以提高计算通量。
第一步,运行 data pipeline,添加参数 --norun_inference
#BSUB -J alphafold3_data_pipeline
#BSUB -n 16
#BSUB -o %J.out
#BSUB -e %J.err
#BSUB -q normal
module load Singularity/3.7.3
singularity exec \
--nv \
--bind af3_run:/af3_run \
--bind /public/home/software/opt/af3_weights/:/af3_weights \
--bind /public/home/software/opt/af3_db/:/af3_db \
$IMAGE/alphafold/3.0.1.sif \
/alphafold3_venv/bin/python /app/alphafold/run_alphafold.py \
--json_path=/af3_run/input.json \
--model_dir=/af3_weights \
--db_dir=/af3_db \
--norun_inference \
--output_dir=/af3_run
第二步,运行 inference,使用第一步生成的中间文件作为输入文件 --json_path=/af3_run/2pv7/2pv7_data.json
,添加参数 --norun_data_pipeline
。
#BSUB -J alphafold3_data_pipeline
#BSUB -n 4
#BSUB -o %J.out
#BSUB -e %J.err
#BSUB -q gpu
module load Singularity/3.7.3
singularity exec \
--nv \
--bind af3_run:/af3_run \
--bind /public/home/software/opt/af3_weights/:/af3_weights \
--bind /public/home/software/opt/af3_db/:/af3_db \
$IMAGE/alphafold/3.0.1.sif \
/alphafold3_venv/bin/python /app/alphafold/run_alphafold.py \
--json_path=/af3_run/2pv7/2pv7_data.json \
--model_dir=/af3_weights \
--db_dir=/af3_db \
--norun_data_pipeline \
--output_dir=/af3_run
结果文件,第一步生成的中间文件目录 af3_run/2pv7
,第二步生成的结果文件目录 af3_run/2pv7_20250213_101747
。
$ tree af3_run/
af3_run/
├── 2pv7
│ └── 2pv7_data.json
├── 2pv7_20250213_101747
│ ├── 2pv7_confidences.json
│ ├── 2pv7_data.json
│ ├── 2pv7_model.cif
│ ├── 2pv7_summary_confidences.json
│ ├── ranking_scores.csv
│ ├── seed-1_sample-0
│ │ ├── confidences.json
│ │ ├── model.cif
│ │ └── summary_confidences.json
│ ├── seed-1_sample-1
│ │ ├── confidences.json
│ │ ├── model.cif
│ │ └── summary_confidences.json
│ ├── seed-1_sample-2
│ │ ├── confidences.json
│ │ ├── model.cif
│ │ └── summary_confidences.json
│ ├── seed-1_sample-3
│ │ ├── confidences.json
│ │ ├── model.cif
│ │ └── summary_confidences.json
│ ├── seed-1_sample-4
│ │ ├── confidences.json
│ │ ├── model.cif
│ │ └── summary_confidences.json
│ └── TERMS_OF_USE.md
└── input.json
性能测试¶
alphafold 3.0.1 相比 alphafold 3.0.0 功能上有了较多的更新,运行速度也有了优化,速度有了大幅提高,主要是第一步 data pipeline 运行速度提高比较多,inference 改善很小。测试数据使用的上面的 2PV7 数据。
硬件:GPU NVIDIA 4090D * 1,CPU AMD 9654 * 2,内存 1TB
软件 | 运行时间(s) |
---|---|
AlphaFold v3.0.0 | 2010 |
AlphaFold v3.0.1 | 635 |
参考¶
https://doc.nju.edu.cn/books/efe93/page/alphafold-3
https://docs.hpc.sjtu.edu.cn/app/bioinformatics/alphafold3.html
本文阅读量 次本站总访问量 次