批量動力學模擬
注意全都需要在類linux平臺上進行
安裝Desmond模塊:
https://github.com/Wang-Lin-boop/Schrodinger-Script
安裝AutoMD模塊:
Wang-Lin-boop/CADD-Scripts: Scripts for virtual screening, cross docking and protein relax using Schr?dinegr and Rosetta (github.com)
安裝Viparr和Msys
# 下載并上傳至集群個人home的software中
wget https://github.com/DEShawResearch/viparr/releases/download/4.7.35/viparr-4.7.35-cp38-cp38-manylinux2014_x86_64.whl
wget https://github.com/DEShawResearch/msys/releases/download/1.7.337/msys-1.7.337-cp38-cp38-manylinux2014_x86_64.whl
git clone git://github.com/DEShawResearch/viparr-ffpublic.git
git clone https://github.com/Wang-Lin-boop/AutoMD# 進入desmond工作目錄,啟動虛擬環境以幫助安裝Viparr和Msys
cd /fsa/home/ljx_zhangzw/software
./run schrodinger_virtualenv.py schrodinger.ve
source schrodinger.ve/bin/activate
pip install --upgrade pip
pip install msys-1.7.337-cp38-cp38-manylinux2014_x86_64.whl
pip install viparr-4.7.35-cp38-cp38-manylinux2014_x86_64.whl
echo "export viparr=${PWD}/schrodinger.ve/bin" >> ~/.bashrc# 將viparr-ffpublic.git解壓并添加到環境變量:echo "export VIPARR_FFPATH=${PWD}/viparr-ffpublic/ff" >> ~/.bashrc# 最后,將AutoMD.git解壓并進行安裝,同時指定可自動添加補充力場:
cd AutoMD
echo "alias AutoMD=${PWD}/AutoMD" >> ~/.bashrc
chmod +x AutoMD
source ~/.bashrc
cp -r ff/* ${VIPARR_FFPATH}/
示例
#注意修改相應計算節點和軟件路徑信息
#BSUB -L /bin/bash
#BSUB -q 83a100ib
#BSUB -m m001module load cuda/12.0.0
export Desmond=/fsa/home/ljx_zhangzw/
export viparr=/fsa/home/ljx_zhangzw/schrodinger.ve/bin
export VIPARR_FFPATH=/fsa/home/ljx_zhangzw/viparr-ffpublic/ff
alias AutoMD=/fsa/home/ljx_zhangzw/AutoMD/AutoMDecho $PATH
echo $LD_LIBRARY_PATH
nvidia-smi
env|grep CUDAAutoMD -i "*.mae" -S OUC -P "chain.name A" -L "res.ptype UNK" -F "OPLS_2005" -T 298 -s 10 -H m001 -G m001
Alphafold3
代碼協議
源代碼協議:CC NC-SA 4.0協議:
- 僅用于非商業用途
- 不允許使用af3的輸出訓練機器學習模型或者相關技術,來衍生大分子結構預測的模型,包括蒸餾或其他方法
- 分發輸出或者發布相關研究結果時,必須引用文獻:
Abramson, J et al. Accurate structure prediction of biomolecular interactions with AlphaFold 3. Nature (2024).
獲取模型參數
填寫表單以獲取權重文件,將在2-3個工作日內回復.
注意:必須要是學術郵箱。可能超過1周才回復。
安裝af3
硬件需求:
- 需要在linux上運行,不支持其他操作系統.
- 完整安裝需要1TB以上的磁盤空間,以保存基因數據庫
- 需要算力超過8.0的NVIDIA GPU,顯存越大,可以預測越大的蛋白結構
- 最多5120長度的序列可以在單個NVIDIA A100 80GB或H100 80GB上運行.已經驗證了在A100和H100上的數值精確性
- 基因搜索消耗大量內存,推薦內存至少64GB
docker安裝
見官方文檔:alphafold3/docs/installation.md at main · google-deepmind/alphafold3 (github.com)
ubuntu22.04LTS和conda安裝
# 更新系統,配置系統環境
sudo apt update --quiet
sudo apt install --yes --quiet software-properties-common
sudo apt install --yes --quiet git wget build-essential gcc g++ zlib1g zlib1g-dev curl zstd # fish ,可選安裝# 安裝miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh # 下載miniconda
chmod +x ./Miniconda3-latest-Linux-x86_64.sh # 給miniconda安裝腳本賦予可執行權限
./Miniconda3-latest-Linux-x86_64.sh # 運行miniconda安裝腳本
# 在交互模式下,回車;
# 按q翻頁;輸入yes同意協議;
# 輸入你想要放置miniconda的路徑,直接回車將默認為~/miniconda3;
# 輸入yes激活conda環境變量,完成miniconda的安裝
bash # 重新打開bash,可以看到(base)標識,說明conda的base環境已激活
# conda init fish # 可選,激活fish的conda環境
# fish# 創建conda環境
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple # pip換加速源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge # conda換加速源
conda config --set custom_channels.auto https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
git config --global url."https://github.moeyy.xyz/https://github.com".insteadOf https://github.com # github換加速源,如果加速無效,換一個[加速網點](https://fcp7.com/github-mirror-daily-updates.html);如果要提交PR給github,建議將~/.gitconfig中對應兩行注釋掉
conda config --set show_channel_urls yes# 克隆代碼,安裝其他依賴
git clone https://github.com/google-deepmind/alphafold3.git ~/git_develop/af3 #克隆路徑自行選擇,不指定路徑則在運行命令的目錄創建alphafold3文件夾
cd ~/git_develop/af3
conda create -n af3 python=3.11 # af3在python3.11上通過測試
conda activate af3 # 激活af3環境
conda install -c bioconda hmmer # 安裝hmmer
pip install -r dev-requirements.txt
pip install . --no-deps # --verbose 可選,如果安裝出錯,使用verbose選項查看具體錯誤
build_data # 構建cif數據庫
python run_alphafold_test.py # 由于暫時沒有模型參數,僅序列搜索測試成功# jax庫GPU檢測測試
python
import jax
jax.devices()
# 返回結果中包含cuda表明jax正確檢測到了GPU設置
from jax.lib import xla_bridge
xla_bridge.get_backend().platform
# 返回結果中包含gpu表明jaxlib正確檢測到了GPU設置
# CTRL+D退出# 基因(序列)數據庫下載,極其耗時,推薦使用SSD存儲,加快下載和序列搜索的速度
# 壓縮包大小252GB,解壓后為630GB
python fetch_databases.py --download_destination=存放數據庫的路徑
sudo chmod 755 --recursive 存放數據庫的路徑 # 給MSA工具提供權限
環境變量設置
> 終端環境變量配置: 使用任意文本編輯器,打開`~/.bashrc`,添加下面內容并保存
export XLA_FLAGS="--xla_gpu_enable_triton_gemm=false"
export XLA_PYTHON_CLIENT_PREALLOCATE=true
export XLA_CLIENT_MEM_FRACTION=0.95
> 如果使用fish終端,則打開`~/.config/fish/config.fish`,添加下面內容并保存set XLA_FLAGS "--xla_gpu_enable_triton_gemm=false"
set XLA_PYTHON_CLIENT_PREALLOCATE true
set XLA_CLIENT_MEM_FRACTION 0.95
運行預測
## 運行預測
# run_alphafold需要提供1個json文件,例如`alphafold_input.json`:{"name": "2PV7","sequences": [{"protein": {"id": ["A", "B"],"sequence": "GMRESYANENQFGFKTINSDIHKIVIVGGYGKLGGLFARYLRASGYPISILDREDWAVAESILANADVVIVSVPINLTLETIERLKPYLTENMLLADLTSVKREPLAKMLEVHTGAVLGLHPMFGADIASMAKQVVVRCDGRFPERYEWLLEQIQIWGAKIYQTNATEHDHNMTYIQALRHFSTFANGLHLSKQPINLANLLALSSPIYRLELAMIGRLFAQDAELYADIIMDKSENLAVIETLKQTYDEALTFFENNDRQGFIDAFHKVRDWFGDYSEQFLKESRQLLQQANDLKQG"}}],"modelSeeds": [1],"dialect": "alphafold3","version": 1
}# 然后運行:python run_alphafold.py \--json_path=輸入文件路徑/fold_input.json \--model_dir=模型參數路徑 \--output_dir=結果輸出路徑# 參數模型和輸出路徑自行調整
# 使用`python run_alphafold.py --help`查看其他選項