安装要求
AlphaFold 部署具有一定难度,体现在硬件、软件、数据、文档等多个层面。
- 硬件。需要 GPU 卡。CPU 尽量配 8 核心以上,内存尽量 32 G 以上;
- 软件。官方提供的是 docker 安装;
- 数据。需要自国外多个数据中心下载 438 GB 数据(解压后为 2.2 TB),见4;
- 文档。安装和使用文档较为欠缺。
1、安装nvida显卡驱动
https://www.nvidia.cn/drivers/unix/
chmod +x NVIDIA-Linux-x86_64-470.94.run
./NVIDIA-Linux-x86_64-470.94.run
1.1出现如下错误,nouveau没有disable:
解决办法:
sudo vim /etc/modprobe.d/blacklist-nouveau.conf
#插入以下两行
blacklist nouveau
options nouveau modeset=0
#用:wq保存退出后
sudo update-initramfs -u
#重启电脑,安装驱动,可能会没有图形界面,nvidia驱动安装好后重启可以恢复界面
2、安装docker
curl https://get.docker.com | sh && sudo systemctl --now enable docker
3、安装nvidia container toolkit
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
#失败可以尝试以下方法:
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | \
sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \
sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
安装好后重启服务,并验证安装是否成功:
sudo systemctl restart docker
sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi#或者nvidia-smi
出现类似界面即为安装成功:
4、下载alphafold 数据 Genetic databases并按照图示的结构放置,也可以拆分存放:
其中mmcif数据下载时可能会出现损坏的情况,损坏文件个数少的时候可以在PDB数据库中下载对应文件,多的话就重新下吧。
在alphafold/docker/run_docker.py中将相应数据集路径修改为本地绝对路径:
# You can individually override the following paths if you have placed the
# data in locations other than the FLAGS.data_dir.
# Path to the Uniref90 database for use by JackHMMER.
uniref90_database_path = os.path.join(
FLAGS.data_dir, 'uniref90', 'uniref90.fasta')
# Path to the Uniprot database for use by JackHMMER.
uniprot_database_path = os.path.join(
FLAGS.data_dir, 'uniprot', 'uniprot.fasta')
# Path to the MGnify database for use by JackHMMER.
mgnify_database_path = os.path.join(
FLAGS.data_dir, 'mgnify', 'mgy_clusters_2018_12.fa')
# Path to the BFD database for use by HHblits.
bfd_database_path = os.path.join(
FLAGS.data_dir, 'bfd',
'bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt')
# Path to the Small BFD database for use by JackHMMER.
small_bfd_database_path = os.path.join(
FLAGS.data_dir, 'small_bfd', 'bfd-first_non_consensus_sequences.fasta')
# Path to the Uniclust30 database for use by HHblits.
uniclust30_database_path = os.path.join(
FLAGS.data_dir, 'uniclust30', 'uniclust30_2018_08', 'uniclust30_2018_08')
# Path to the PDB70 database for use by HHsearch.
pdb70_database_path = os.path.join(FLAGS.data_dir, 'pdb70', 'pdb70')
# Path to the PDB seqres database for use by hmmsearch.
pdb_seqres_database_path = os.path.join(
FLAGS.data_dir, 'pdb_seqres', 'pdb_seqres.txt')
# Path to a directory with template mmCIF structures, each named <pdb_id>.cif.
template_mmcif_dir = os.path.join(FLAGS.data_dir, 'pdb_mmcif', 'mmcif_files')
# Path to a file mapping obsolete PDB IDs to their replacements.
obsolete_pdbs_path = os.path.join(FLAGS.data_dir, 'pdb_mmcif', 'obsolete.dat')
5、下载alphafold
#先安装git
sudo apt-get install git
#将alphafold clone到本地
git clone https://github.com.cnpmjs.org/deepmind/alphafold.git
cd alphafold
docker build -f docker/Dockerfile -t alphafold .#会下载很多依赖包
pip3 install -r docker/requirements.txt
6、测试
python3 docker/run_docker.py \
--fasta_paths=T1050.fasta \
--max_template_date=2020-05-14 \
--data_dir=$DOWNLOAD_DIR #数据没有拆分,填数据路径,已经拆分并且在docker已经配置好可以随便填
参考
GitHub - deepmind/alphafold: Open source code for AlphaFold.
AlphaFold Deployment and Optimization on HPC Platform (sjtu.edu.cn)
安装nvidia-docker2报错E: Unable to locate package nvidia-docker2 - 神奇二进制 - 博客园 (cnblogs.com)
全面加速 GitHub,git clone 太慢的 9 种解决办法 - 云+社区 - 腾讯云 (tencent.com)
禁用Nouveau,安装Linux Nvidia 显卡驱动_JL-LOVE-CSDN博客_禁用nouveau驱动