
14.AF3 批量结构预测方法
Created | |
---|---|
Tags | 作业脚本生信工具 |
AI summary | AF3(AlphaFold3)是一种用于蛋白质结构预测的工具,支持批量处理。用户需申请模型权重,准备输入数据和参考数据库,并使用Singularity和Slurm提交任务,预测结果将包含PDB结构文件和JSON评分。 |
Status | Draft |
一、简介
AF3(AlphaFold3)是一种用于蛋白质结构预测的工具,支持批量处理。用户需申请模型权重,准备输入数据和参考数据库,并使用Singularity和Slurm提交任务,预测结果将包含PDB结构文件和JSON评分
二、准备工作
*** 权重申请***
AF3 模型权重不能直接下载,需要前往AF3官方或相应 AF3 发布页面,如下图提交申请表或根据指引申请访问权限。
- 权重目录示例:
/hpcfs/fhome/用户名/models_weight/
- 权重放置要求:按照官方结构放置


三、输入数据准备
创建一个包含多个目标序列的 JSON 文件,例如:
路径示例:/hpcfs/fhome/用户名/fold_input.json
可参考链接alphafold3/docs/input.md at main · google-deepmind/alphafold3 · GitHub
{
"name": "2PV7",
"sequences": [
{
"protein": {
"id": ["A", "B"],
"sequence": "GMRESYANENQFGFKTINSDIHKIVIVGGYGKLGGLFARYLRASGYPISILDREDWAVAESILANADVVIVSVPINLTLETIERLKPYLTENMLLADLTSVKREPLAKMLEVHTGAVLGLHPMFGADIASMAKQVVVRCDGRFPERYEWLLEQIQIWGAKIYQTNATEHDHNMTYIQALRHFSTFANGLHLSKQPINLANLLALSSPIYRLELAMIGRLFAQDAELYADIIMDKSENLAVIETLKQTYDEALTFFENNDRQGFIDAFHKVRDWFGDYSEQFLKESRQLLQQANDLKQG"
}
}
],
"modelSeeds": [1],
"dialect": "alphafold3",
"version": 1
}
四、参考数据库准备
路径示例:/hpcfs/fpublic/database/alphafold/af3/data/
- 可使用超算平台中参考数据库
- AF3 运行时自动引用
[demo@login5 /data/ ]$ ls
bfd-first_non_consensus_sequences.fasta pdb_2022_09_28_mmcif_files.tar rnacentral_active_seq_id_90_cov_80_linclust.fasta
mgy_clusters_2022_05.fa pdb_seqres_2022_09_28.fasta uniprot_all_2021_04.fa
nt_rna_2023_02_23_clust_seq_id_90_cov_80_rep_seq.fasta rfam_14_9_clust_seq_id_90_cov_80_rep_seq.fasta uniref90_2022_05.fa
命令行提交方式
一、Singularity 命令说明
[demo@login5 ]$ singularity exec --nv \
-B 模型权重:/af3/model_weight \
-B /hpcfs/fpublic/database/alphafold/af3/data/:/af3/data \
/hpcfs/fpublic/container/singularity/app/af3/af3.sif \
sh /opt/f3.sh --json_path=af3/protein_V4.json --output_dir=/af3/output
参数说明:
-nv
:启用 GPU 支持
B
:绑定主机目录至容器路径
sh /opt/f3.sh
:容器内启动脚本
-json_path
:输入 JSON 路径
-output_dir
:预测输出目录
四、Slurm 作业脚本模板
保存为 run_af3.slurm
:
[demo@login5 ]$ vim run_af3.slurm
#!/bin/bash
#SBATCH --job-name=af3_batch
#SBATCH --partition=qgpu_a40
#SBATCH --gres=gpu:1
#SBATCH --cpus-per-task=8
#SBATCH --mem=64G
#SBATCH --time=24:00:00
#SBATCH --output=af3_batch_%j.out
echo "Starting AF3 prediction job..."
date
JSON_PATH="/hpcfs/fhome/用户名/fold_input.json"
OUTPUT_DIR="/hpcfs/fhome/用户名/output/"
singularity exec --nv \
-B 模型权重:/af3/model_weight \
-B /hpcfs/fpublic/database/alphafold/af3/data/:/af3/data \
/hpcfs/fpublic/container/singularity/app/af3/af3.sif \
sh /opt/f3.sh --json_path=af3/protein_V4.json --output_dir=/af3/output
echo "AF3 prediction finished."
date
五、提交任务
[demo@login5 ]$ sbatch run_af3.slurm
查看日志输出:
[demo@login5 ]$ cat af3_batch_作业号.out
六、结果查看
预测结果将保存在 --output_dir
对应的路径下,通常包含:
- PDB 结构文件
- JSON 预测评分
- 运行日志
右边是名为“Hello Fold”的 AlphaFold 3 作业的输出目录列表示例
hello_fold/
├── seed-1234_embeddings # Only if --save_embeddings=true.
│ └── hello_fold_seed-1234_embeddings.npz # Only if --save_embeddings=true.
├── seed-1234_sample-0/
│ ├── hello_fold_seed-1234_sample-0_confidences.json
│ ├── hello_fold_seed-1234_sample-0_model.cif
│ └── hello_fold_seed-1234_sample-0_summary_confidences.json
├── seed-1234_sample-1/
│ ├── hello_fold_seed-1234_sample-1_confidences.json
│ ├── hello_fold_seed-1234_sample-1_model.cif
│ └── hello_fold_seed-1234_sample-1_summary_confidences.json
├── seed-1234_sample-2/
│ ├── hello_fold_seed-1234_sample-2_confidences.json
│ ├── hello_fold_seed-1234_sample-2_model.cif
│ └── hello_fold_seed-1234_sample-2_summary_confidences.json
├── seed-1234_sample-3/
│ ├── hello_fold_seed-1234_sample-3_confidences.json
│ ├── hello_fold_seed-1234_sample-3_model.cif
│ └── hello_fold_seed-1234_sample-3_summary_confidences.json
├── seed-1234_sample-4/
│ ├── hello_fold_seed-1234_sample-4_confidences.json
│ ├── hello_fold_seed-1234_sample-4_model.cif
│ └── hello_fold_seed-1234_sample-4_summary_confidences.json
├── TERMS_OF_USE.md
├── hello_fold_confidences.json
├── hello_fold_data.json
├── hello_fold_model.cif
├── hello_fold_ranking_scores.csv
└── hello_fold_summary_confidences.json
七、常见问题
- 无法使用 GPU
- 确认使用了
-nv
并申请了 GPU 分区
- 确认使用了
- 作业无输出
- 查看 Slurm 输出日志中是否有报错信息
CHESS平台应用提交方式(推荐简单)