【4.5.6】结构预测--alphafold

一、简介

网页结构预测:

https://colab.research.google.com/github/sokrypton/ColabFold/blob/main/AlphaFold2.ipynb

二、安装

2.1 创建conda环境

cd /data/software

# wget -c https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash Miniconda3-latest-Linux-x86_64.sh

conda create --name alphafold python==3.8
conda update -n base conda

启动conda环境

conda activate alphafold

2.2 安装包

Change cudnn==8.2.1.32 and cudatoolkit==11.0.3 versions if they are not supported in your system

conda install -y -c conda-forge openmm==7.5.1 cudnn==8.2.1.32 cudatoolkit==11.0.3 pdbfixer==1.7
conda install -y -c bioconda hmmer==3.3.2 hhsuite==3.3.0 kalign2==2.04

2.3 下载alphafold

git clone https://github.com/deepmind/alphafold.git	
#alphafold_path="/path/to/alphafold/git/repo"
alphafold_path="/data/software/alphafold"

Download chemical properties to the common folder

wget -q -P alphafold/common/ https://git.scicore.unibas.ch/schwede/openstructure/-/raw/7102c63615b64735c4941278d92b554ec94415f8/modules/mol/alg/src/stereo_chemical_props.txt

上面这个命令,没有下载到文件,重新用这个命令下载:

cd /data/software/alphafold/alphafold/common
wget -c --no-check-certificate  https://git.scicore.unibas.ch/schwede/openstructure/-/raw/7102c63615b64735c4941278d92b554ec94415f8/modules/mol/alg/src/stereo_chemical_props.txt

安裝alphafold包:

Change jaxlib==0.1.69+cuda<111> version if this is not supported in your system Note: jax updgrade: cuda111 supports cuda 11.3 - https://github.com/google/jax/issues/6628

pip install mock

pip  install  --timeout 800 absl-py==0.13.0 biopython==1.79 chex==0.0.7 dm-haiku==0.0.4 dm-tree==0.1.6 immutabledict==2.0.0 jax==0.2.14 ml-collections==0.1.0 numpy==1.19.5 scipy==1.7.0 tensorflow==2.5.0 pandas==1.3.4 tensorflow-cpu==2.5.0

pip install --timeout 800 --upgrade jax jaxlib==0.1.69+cuda111 -f https://storage.googleapis.com/jax-releases/jax_releases.html

报错:

jaxlib is version 0.1.69, but this version of jax requires version 0.1.74

解决办法:

pip install --timeout 800 --upgrade jax jaxlib==0.1.74+cuda11.cudnn805 -f https://storage.googleapis.com/jax-releases/jax_releases.html 

2.4 OpenMM包

alphafold_path=/data/software/alphafold;
cd /data/software/miniconda3/envs/alphafold/lib/python3.8/site-packages && patch -p0 < $alphafold_path/docker/openmm.patch

2.5 下载数据

yum install aria2c
yum install aria2
cd /data/software/alphafold/scripts
bash ./download_all_data.sh  /data/software/alphafold/alphafold/data/

下载:

cd /data/software
git clone https://github.com/kalininalab/alphafold_non_docker.git

2.6 测试:

https://github.com/kalininalab/alphafold_non_docker 拷贝 run_alphafold.sh 的脚本

运行:

bash run_alphafold.sh -d /data/software/alphafold/alphafold/data/  -o test/result -f test/test.fa -t 2020-05-14 -a 0,1 -n 100

必须的参数:

-o 输出文件夹
-f 输入的序列
-d 输入数据库
-t Maximum template release date to consider (ISO-8601 format - i.e. YYYY-MM-DD). Important if folding historical test sets

可考虑的参数:

-a 指定GPU
-n 指定核心数

-m <model_preset>     Choose preset model configuration - the monomer model, the monomer model with extra ensembling, monomer model with pTM head, or multimer model (default: 'monomer')
-c <db_preset>        Choose preset MSA database configuration - smaller genetic database config (reduced_dbs) or full genetic database config (full_dbs) (default: 'full_dbs')
-p <use_precomputed_msas> Whether to read MSAs that have been written to disk. WARNING: This will not check if the sequence, database or configuration have changed (default: 'false')
-l <is_prokaryote>    Optional for multimer system, not used by the single chain system. A boolean specifying true where the target complex is from a prokaryote, and false where it is not, or where the origin is unknown. This value determine the pairing method for the MSA (default: 'None')
-b <benchmark>        Run multiple JAX model evaluations to obtain a timing that excludes the compilation time, which should be more indicative of the time required for inferencing many proteins (default: 'false')

三、报错

3.1 报错1:

0] Couldn't get ptxas version string: INTERNAL: Running ptxas --version returned 32512
2021-12-20 13:57:13.555470: F external/org_tensorflow/tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc:435] ptxas returned an error during compilation of ptx to sass: 'INTERNAL: ptxas exited with non-zero error code 32512, output: '  If the error message indicates that a file could not be written, please verify that sufficient filesystem space is provided.

报错原因:

cuda没有安装,或者cuda版本不对,或者环境变量的问题,找不到ptxas。 重新安装即可。

参考资料

这里是一个广告位,,感兴趣的都可以发邮件聊聊:tiehan@sina.cn
个人公众号,比较懒,很少更新,可以在上面提问题,如果回复不及时,可发邮件给我: tiehan@sina.cn