README.md 4.23 KB
Newer Older
zhuwenwen's avatar
zhuwenwen committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<!--
 * @Author: zhuww
 * @email: zhuww@sugon.com
 * @Date: 2023-04-06 18:04:07
 * @LastEditTime: 2023-04-10 20:32:01
-->
# AlphaFold2
## 模型介绍
AlphaFold2是一个用于预测蛋白质三维结构的深度学习模型。
## 模型结构
模型核心是一个基于Transformer架构的神经网络,包括两个主要组件:Sequence to Sequence Model和Structure Model,这两个组件通过迭代训练进行优化,以提高其预测准确性。
## 数据集
推荐使用AlphaFold2中的开源数据集,包括BFD、MGnify、PDB70、Uniclust、Uniref90等,数据集大小约3TB。

我们提供了一个脚本download_all_data.sh用于下载使用的数据集和模型文件:

    ./scripts/download_all_data.sh 数据集下载目录

## 推理
### 环境配置
提供[光源](https://www.sourcefind.cn/#/service-details)拉取推理的docker镜像:
* 推理镜像:docker pull image.sourcefind.cn:5000/dcu/admin/base/custom:alphafold2-2.2.1-centos7.6-dtk-22.04.2-py38

激活镜像环境:
`source /opt/dtk-22.04.2/env.sh`
`source /opt/openmm-hip/env.sh`

测试目录:
`/opt/docker/test`

### 推理
我们分别提供了基于Jax的单体和多体的推理脚本,版本依赖:
* Jax(DCU版本) >= 0.3.14
* TensorFlow2(DCU版本) >= 2.7.0

设置DOWNLOAD_DIR路径和output_dir路径。确保输出目录存在,并且您有足够的权限对其进行写入。
    ```
    # Set to target of download all databases
    DOWNLOAD_DIR = '/path/to/database'

    # Path to a directory that will store the results.
    output_dir = '/path/to/output_dir'
    ```

#### 单体

    python3 run_alphafold.py \
    --fasta_paths=monomer.fasta \
    --output_dir=./ \
    --max_template_date=2020-05-14 \
    --model_preset=monomer \
    --run_relax=true \
    --use_gpu_relax=true

或者使用`./run_monomer.sh`

##### 单体推理参数说明
monomer.fasta为推理的单体序列;--output_dir为输出目录;--model_preset选择模型配置;--run_relax=true为进行relax操作;--use_gpu_relax=true为使用gpu进行relax操作(速度更快,但可能不太稳定),--use_gpu_relax=true为使用CPU进行relax操作(速度慢,但稳定);
若添加--use_precomputed_msas=true则可以加载已经搜索对齐的序列,否则默认进行搜索对齐;

#### 多体

    python3 run_alphafold.py \
    --fasta_paths=multimer.fasta \
    --output_dir=./ \
    --uniprot_database_path=/data/uniprot/uniprot_trembl.fasta \
    --pdb_seqres_database_path=/data/pdb_seqres/pdb_seqres.txt \
    --pdb70_database_path= \
    --max_template_date=2020-05-14 \
    --model_preset=multimer \
    --run_relax=true \
    --use_gpu_relax=true

或者使用`./run_multimer.sh`

##### 多体推理参数说明
multimer.fasta为推理的多体序列,data为数据集下载路径,其他参数同单体推理参数说明一致。

### 输出
`--output_dir`目录结构如下:
```
<target_name>/
    features.pkl
    ranked_{0,1,2,3,4}.pdb
    ranking_debug.json
    relaxed_model_{1,2,3,4,5}.pdb
    result_model_{1,2,3,4,5}.pkl
    timings.json
    unrelaxed_model_{1,2,3,4,5}.pdb
    msas/
        bfd_uniclust_hits.a3m
        mgnify_hits.sto
        uniref90_hits.sto
        ...
```

## 性能和准确率数据
测试数据:[casp14](https://www.predictioncenter.org/casp14/targetlist.cgi)[uniprot](https://www.uniprot.org/),使用的加速卡:1张 DCU 1代-16G

性能数据:
| 数据类型 | 序列类型 | 序列标签 | 序列长度 | Speed(s) |
| :------: | :------: | :------: | :------: |:------: |
| fp32 | 单体 | T1026  | 172  | 761.81  |
| fp32 | 单体 | T1053  | 580  | 2885.45 |
| fp32 | 单体 | T1091  | 863  | 5618.62 |

准确性数据:
| 数据类型 | 序列类型 | 序列标签 | 序列长度 | GDT-TS | GDT-HA | LDDT | TM score | MaxSub | RMSD |
| :------: | :------: | :------: | :------: |:------: |:------: | :------: | :------: | :------: |:------: |
| fp32 | 单体 | T1026 | 172 | 0.849 | 0.658 | 75.050 | 0.901 | 0.851 | 1.6 |
| fp32 | 单体 | T1053 | 580 | 0.941 | 0.789 | 92.316 | 0.985 | 0.935 | 1.1 |
| fp32 | 单体 | T1091 | 863 | 0.492 | 0.332 | 85.083 | 0.740 | 0.388 | 6.7 |


## 历史版本
* https://developer.hpccube.com/codes/modelzoo/AlphaFold2
## 参考
* [https://github.com/deepmind/alphafold](https://github.com/deepmind/alphafold)