#author("2025-09-15T05:34:18+00:00","default:sysosa","sysosa") #author("2025-09-16T20:08:33+00:00","default:sysosa","sysosa") 本家様 [[https://github.com/jwohlwend/boltz>+https://github.com/jwohlwend/boltz]] pipy [[https://pypi.org/project/boltz/>+https://pypi.org/project/boltz/]] pipyの内容から Python <3.13, >=3.10 が動作条件っぽい 生体分子(タンパク質、核酸、リガンドなど)の構造予測・相互作用予測を行うモデルとアプリの名称. モデルファイルはオープンソースで商用利用可能. タンパク-リガンド複合体の構造予測とその結合親和性も見積もられるみたい. AlphaFoldはMultiple Sequence Alignment(MSA)は必須。BoltzはMSAなしでも行けるけど、MSAがあると精度が向上するそうな. [[msa]]を立ててみた. 環境 #code(nonumber){{ [root@rockylinux9 ~]# cat /etc/redhat-release Rocky Linux release 9.5 (Blue Onyx) [root@rockylinux9 ~]# uname -r 5.14.0-503.14.1.el9_5.x86_64 [root@rockylinux9 ~]# cat /proc/driver/nvidia/version NVRM version: NVIDIA UNIX x86_64 Kernel Module 570.172.08 Tue Jul 8 18:31:33 UTC 2025 GCC version: gcc version 11.5.0 20240719 (Red Hat 11.5.0-5) (GCC) [root@rockylinux9 ~]# }} 下準備 #code(nonumber){{ git clone https://github.com/yyuu/pyenv.git /apps/pyenv export PYENV_ROOT=/apps/pyenv export PATH=$PYENV_ROOT/bin:$PATH pyenv install anaconda3-2024.10-1 }} 構築 #code(nonumber){{ [root@rockylinux9 ~]# source /apps/pyenv/versions/anaconda3-2024.10-1/etc/profile.d/conda.sh [root@rockylinux9 ~]# conda create -n Boltz-2 pip python=3.12 -c conda-forge [root@rockylinux9 ~]# conda activate Boltz-2 (Boltz-2) [root@rockylinux9 ~]# cd /apps/src (Boltz-2) [root@rockylinux9 src]# git clone https://github.com/jwohlwend/boltz (Boltz-2) [root@rockylinux9 src]# cd boltz (Boltz-2) [root@rockylinux9 boltz]# (Boltz-2) [root@rockylinux9 boltz]# pip install -e .[cuda] (Boltz-2) [root@rockylinux9 boltz]# conda list : biopython 1.84 pypi_0 pypi boltz 2.2.0 pypi_0 pypi : python 3.12.11 h9e4cc4f_0_cpython conda-forge : rdkit 2025.3.3 pypi_0 pypi : torch 2.7.1 pypi_0 pypi : (Boltz-2) [root@rockylinux9 boltz]# conda deactivate [root@rockylinux9 boltz]# }} ***environment-modules [#rf1d758d] 「/apps/modulefiles/boltz-2」 #code(nonumber){{ #%Module module load PyMOL set root /apps/pyenv/versions/anaconda3-2024.10-1/envs/Boltz-2 prepend-path PATH $root/bin }} 「boltz --help」 #code(nonumber){{ Usage: boltz [OPTIONS] COMMAND [ARGS]... Boltz1. Options: --help Show this message and exit. Commands: predict Run predictions with Boltz-1. }} 「boltz predict --help」 #code(nonumber){{ Usage: boltz predict [OPTIONS] DATA Run predictions with Boltz-1. Options: --out_dir PATH The path where to save the predictions. --cache PATH The directory where to download the data and model. Default is ~/.boltz. --checkpoint PATH An optional checkpoint, will use the provided Boltz-1 model by default. --devices INTEGER The number of devices to use for prediction. Default is 1. --accelerator [gpu|cpu|tpu] The accelerator to use for prediction. Default is gpu. --recycling_steps INTEGER The number of recycling steps to use for prediction. Default is 3. --sampling_steps INTEGER The number of sampling steps to use for prediction. Default is 200. --diffusion_samples INTEGER The number of diffusion samples to use for prediction. Default is 1. --step_scale FLOAT The step size is related to the temperature at which the diffusion process samples the distribution.The lower the higher the diversity among samples (recommended between 1 and 2). Default is 1.638. --write_full_pae Whether to dump the pae into a npz file. Default is True. --write_full_pde Whether to dump the pde into a npz file. Default is False. --output_format [pdb|mmcif] The output format to use for the predictions. Default is mmcif. --num_workers INTEGER The number of dataloader workers to use for prediction. Default is 2. --override Whether to override existing found predictions. Default is False. --seed INTEGER Seed to use for random number generator. Default is None (no seeding). --use_msa_server Whether to use the MMSeqs2 server for MSA generation. Default is False. --msa_server_url TEXT MSA server url. Used only if --use_msa_server is set. --msa_pairing_strategy TEXT Pairing strategy to use. Used only if --use_msa_server is set. Options are 'greedy' and 'complete' --help Show this message and exit. }} ***テスト [#c7c30c1c] git にあるサンプルファイル「/apps/src/boltz/examples/affinity.yaml」を使ってテスト #code(nonumber){{ [illya@rockylinux9 ~]$ cp /apps/src/boltz/examples/affinity.yaml . [illya@rockylinux9 ~]$ module load boltz-2 [illya@rockylinux9 ~]$ cat affinity.yaml version: 1 # Optional, defaults to 1 sequences: - protein: id: A sequence: MVTPEGNVSLVDESLLVGVTDEDRAVRSAHQFYERLIGLWAPAVMEAAHELGVFAALAEAPADSGELAR(略 - ligand: id: B smiles: 'N[C@@H](Cc1ccc(O)cc1)C(=O)O' properties: - affinity: binder: B [illya@rockylinux9 ~]$ [illya@rockylinux9 ~]$ boltz predict affinity.yaml --out_dir out --use_msa_server }} 「--cache」でmodelファイルの参照先を指定するが、なにも指定しないと「$HOME/.boltz」を見る っで「$HOME/.boltz」に何もないと自動的にモデルがダウンロードされる. 自分向けのフォルダなので自由に使えるが、サイズは 12GB になる. ユーザ毎に12GBが消費されるのが避けたいなら共通の場所に置く手もあるが、 どうも、そのフォルダは実行時に生成・更新されるファイルがあるようで、実行するたびに新しいキャッシュが追加されたり、古いものが更新されたりするみたい(from ChatGPT). なので書き込み可能にしておく. どんなファイルが置かれるかは「/apps/src/boltz/src/boltz/main.py」に記載されている なので #code(nonumber){{ mkdir /apps/boltz ; cd /apps/boltz wget https://model-gateway.boltz.bio/boltz1_conf.ckpt wget https://model-gateway.boltz.bio/boltz2_conf.ckpt wget https://model-gateway.boltz.bio/boltz2_aff.ckpt wget https://huggingface.co/boltz-community/boltz-1/resolve/main/ccd.pkl wget https://huggingface.co/boltz-community/boltz-2/resolve/main/mols.tar tar xf mols.tar [root@rockylinux9 boltz]# ls -l /apps/boltz/ total 9909400 -rw-r--r--. 1 root root 3595352714 Nov 28 2024 boltz1_conf.ckpt -rw-r--r--. 1 root root 2062139170 Jun 6 22:17 boltz2_aff.ckpt -rw-r--r--. 1 root root 2286561469 Jun 6 22:15 boltz2_conf.ckpt -rw-r--r--. 1 root root 345859128 Nov 18 2024 ccd.pkl drwxr-sr-x. 2 22478 20626 1105920 Feb 19 03:01 mols -rw-r--r--. 1 root root 1855662080 Jun 6 22:14 mols.tar [root@rockylinux9 boltz]# [root@rockylinux9 boltz]# chmod 777 /apps/boltz }} とする。 &size(10){「chmod 777」は微妙なので、各ホームディレクトリに収めるのがいいのかもしれない}; っで下記で実行します #code(nonumber){{ [illya@rockylinux9 ~]$ boltz predict affinity.yaml --out_dir out --use_msa_server --cache /apps/boltz --override }} 結果は「out/boltz_results_affinity/predictions/affinity/affinity_model_0.cif」で得られる. cifファイルなのでお好みのviewerで見る. ここでは pymol で開いてみた &ref(2025y09m15d_142925067.png,nolink,80%); ***Bolts-gui [#dba9ce6f] 本家様 [[https://github.com/ravishar313/boltz-gui>+https://github.com/ravishar313/boltz-gui]] &color(red){製作中}; 下準備 npm のインストール. npmは18以上が必要なので #code(nonumber){{ [root@rockylinux8 ~]# cat /etc/redhat-release Rocky Linux release 8.10 (Green Obsidian) [root@rockylinux8 ~]# dnf module list nodejs Last metadata expiration check: 0:10:33 ago on Mon 23 Jun 2025 09:58:38 PM JST. Rocky Linux 8 - AppStream Name Stream Profiles Summary nodejs 10 [d][e] common [d], development, minimal, s2i Javascript runtime nodejs 12 common [d], development, minimal, s2i Javascript runtime nodejs 14 common [d], development, minimal, s2i Javascript runtime nodejs 16 common [d], development, minimal, s2i Javascript runtime nodejs 18 common [d], development, minimal, s2i Javascript runtime nodejs 20 common [d], development, minimal, s2i Javascript runtime nodejs 22 common, development, minimal, s2i Javascript runtime Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled [root@rockylinux8 ~]# [root@rockylinux8 ~]# dnf module install nodejs:18 <-- エラーが出るなら「dnf module reset nodejs」を実行 }} あとは各自のユーザディレクトリで作ってください #code(nonumber){{ [saber@rockylinux8 ~]$ echo $PATH /home/saber/.local/bin:/home/saber/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin [saber@rockylinux8 ~]$ curl -LsSf https://astral.sh/uv/install.sh | sh downloading uv 0.7.13 x86_64-unknown-linux-gnu no checksums to verify installing to /home/saber/.local/bin uv uvx everything's installed! [saber@rockylinux8 ~]$ uv --version uv 0.7.13 [saber@rockylinux8 ~]$ }} boltz-guiパッケージの取得 #code(nonumber){{ [saber@rockylinux8 ~]$ git clone https://github.com/ravishar313/boltz-gui }} backend の準備 #code(nonumber){{ [saber@rockylinux8 ~]$ cd boltz-gui/backend/ [saber@rockylinux8 backend]$ uv sync }} backend の起動 #code(nonumber){{ [saber@rockylinux8 ~]$ cd boltz-gui/backend/ [saber@rockylinux8 backend]$ source .venv/bin/activate (boltz-gui) [saber@rockylinux8 backend]$ uv run run_server.py (boltz-gui) [saber@rockylinux8 backend]$ uv run run_server.py Starting Boltz GUI Server... Server will be available at: http://localhost:6969 API documentation: http://localhost:6969/docs Health check: http://localhost:6969/health Press Ctrl+C to stop the server INFO: Will watch for changes in these directories: ['/home/saber/boltz-gui/backend'] INFO: Uvicorn running on http://0.0.0.0:6969 (Press CTRL+C to quit) INFO: Started reloader process [2120] using WatchFiles INFO: Started server process [2122] INFO: Waiting for application startup. INFO: Application startup complete. INFO:watchfiles.main:11 changes detected : (終了するには CTRL+C で止めて) ^CINFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [2122] INFO: Stopping reloader process [2120] (boltz-gui) [saber@rockylinux8 backend]$ deactivate [saber@rockylinux8 backend]$ }} backend の起動後に 別のターミナルを開いて frontend の準備 #code(nonumber){{ [saber@rockylinux8 ~]$ cd boltz-gui/frontend/ [saber@rockylinux8 frontend]$ npm install }} frontend を起動します #code(nonumber){{ [saber@rockylinux8 frontend]$ npm run dev (終了するには CTRL+C で止めます) }}