🔨

ApptainerでBindCraft (ver. 1.5.2) を動かそう

に公開

コードブロック における 🔨 は、プロンプトを表している

以下、本記事を執筆した際の自宅環境。

specifications
CPU Ryzen 7 5700X (AMD)
グラフィックボード GeForce RTX 2080 Ti VENTUS GP OC (MSI)
メモリ DDR4-3200 32 GB×2 (Crucial)
version
Windows 10 22H2
NVIDIA グラフィクス ドライバー 576.52
WSL2 2.5.7.0
Ubuntu on WLS2 24.04 LTS
Apptainer 1.4.1

BindCraftについて

Protein–protein interactions (PPIs) are at the core of all key biological processes. However, the complexity of the structural features that determine PPIs makes their design challenging. We present BindCraft, an open-source and automated pipeline for de novo protein binder design with experimental success rates of 10-100%. BindCraft leverages the weights of AlphaFold2 to generate binders with nanomolar affinity without the need for high-throughput screening or experimental optimization, even in the absence of known binding sites. We successfully designed binders against a diverse set of challenging targets, including cell-surface receptors, common allergens, de novo designed proteins, and multi-domain nucleases, such as CRISPR-Cas9. We showcase the functional and therapeutic potential of designed binders by reducing IgE binding to birch allergen in patient-derived samples, modulating Cas9 gene editing activity, and reducing the cytotoxicity of a foodborne bacterial enterotoxin. Lastly, we utilize cell surface receptor-specific binders to redirect AAV capsids for targeted gene delivery. This work represents a significant advancement towards a “one design-one binder” approach in computational design, with immense potential in therapeutics, diagnostics, and biotechnology.

蛋白質–蛋白質相互作用 (PPI) は、あらゆる重要な生物学的プロセスの中核をなす。しかし、PPIを規定する構造的特徴の複雑さにより、その設計は困難である。我々は、実験的成功率が10〜100%に達するde novo蛋白質バインダー設計のためのオープンソースかつ自動化されたパイプラインであるBindCraftを提示する。BindCraftは、既知の結合部位が存在しない場合でも高スループットスクリーニングや実験的最適化を必要とせず、ナノモーラー親和性を有するバインダーを生成するためにAlphaFold2の重みを活用する。我々は、細胞表面受容体、一般的アレルゲン、de novo設計蛋白質、CRISPR-Cas9のような多ドメインヌクレアーゼなど、多様で困難な標的に対するバインダー設計に成功した。また、患者由来試料においてシラカバアレルゲンへのIgE結合を低減し、Cas9による遺伝子編集活性を調節し、食中毒原因菌由来エンテロトキシンの細胞毒性を低減することで、設計されたバインダーの機能的および治療的可能性を示した。さらに、細胞表面受容体特異的バインダーを利用して、AAVカプシドを標的遺伝子送達のためにリダイレクトした。本研究は、治療、診断、およびバイオテクノロジーにおいて莫大な可能性を秘めた、計算設計における「one design–one binder」アプローチに向けた重要な前進を示すものである。
(ChatGPT 5による翻訳です)

BindCraft: one-shot design of functional protein binders | Pacesa, M. et al. bioRxiv (2025).

GitHubリポジトリは BindCraft | GitHub です。

BindCraftRFdiffusion よりも少ないwet実験量でde novo binder deisignできるとか (ただし計算は重め)。

本記事では BindCraft (ver. 1.5.2) を実行するためのApptainer コンテナのビルド方法とコンテナ実行方法を紹介します。

🔨 BindCraft実行コンテナのビルド

任意のディレクトリに以下のような bindcraft-v1.5.2.def を作成します。

bindcraft-v1.5.2.def
BootStrap: docker
From: nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04

%post
  # localtime関係のWARNINGに対処
  touch /etc/localtime

  # 必要なパッケージのインストール (冗長)
  apt update && apt upgrade -y
  apt install -y \
    build-essential libgfortran5 libquadmath0 cmake git curl wget aria2 zip unzip
  
  # localeにen_US.UTF-8を追加する (WSL2だけで使用するなら不要)
  apt install -y locales
  locale-gen en_US.UTF-8
  
  # apt関係のお掃除
  rm -rf /var/lib/apt/lists/* && apt autoremove -y && apt clean

  # Pyenvを/usr/local/appsにインストール
  git clone https://github.com/pyenv/pyenv.git /usr/local/apps/pyenv
  export PYENV_ROOT="/usr/local/apps/pyenv"
  export PATH="${PYENV_ROOT}/bin:${PATH}"

  # PyenvでMiniforgeをインストールし、MiniforgeにPATHを通す
  pyenv install --list
  pyenv install miniforge3-24.11.3-2
  pyenv global miniforge3-24.11.3-2
  pyenv versions
  export MINIFORGE3_ROOT="${PYENV_ROOT}/versions/miniforge3-24.11.3-2"
  export PATH="${MINIFORGE3_ROOT}/bin:${PATH}"
  
  # conda自身のアップデート 
  conda update -n base conda
  # conda環境bindcraft-condaを作成
  conda create -n bindcraft-conda python=3.10
  # BindCraftに必要なライブラリのインストール
  conda install \
    -n bindcraft-conda \
    -c conda-forge --channel https://conda.graylab.jhu.edu \
    pip pandas matplotlib numpy"<2.0.0" biopython scipy pdbfixer seaborn \
    libgfortran5 tqdm jupyter ffmpeg pyrosetta fsspec py3dmol \
    dm-tree joblib ml-collections immutabledict
  
  # conda関係のお掃除
  conda clean --all --force-pkgs-dirs --yes
  # conda環境bindcraft-condaをアクティベート
  export BINDCRAFT_CONDA="${MINIFORGE3_ROOT}/envs/bindcraft-conda"
  export PATH="${BINDCRAFT_CONDA}/bin:${PATH}"
  
  # pip自身のアップデート
  python3 -m pip install --no-cache-dir --upgrade pip
  # JAXのインストール
  python3 -m pip install --no-cache-dir \
    "jax[cuda12]" chex dm-haiku "flax<0.10.0" optax
  # ColabDesignのインストール
  python3 -m pip install --no-cache-dir --no-deps \
    git+https://github.com/sokrypton/ColabDesign.git
  
  # BindCraftのクローン
  git clone https://github.com/martinpacesa/BindCraft.git /usr/local/apps/BindCraft
  # AlphaFold 2 weightsのダウンロード
  cd /usr/local/apps/BindCraft
  mkdir -p ./params && cd ./params
  curl -L -O 'https://storage.googleapis.com/alphafold/alphafold_params_2022-12-06.tar'
  tar --no-same-owner --no-same-permissions -xvf ./alphafold_params_2022-12-06.tar
  rm -f ./alphafold_params_2022-12-06.tar
  # 権限設定
  cd /usr/local/apps/BindCraft
  chmod +x ./functions/dssp
  chmod +x ./functions/DAlphaBall.gcc

  # conda環境bindcraft-condaにインストールしたパッケージの由来 (channel) を確認する
  conda list -n bindcraft-conda

%environment
  # BindCraftのための環境設定
  export MINIFORGE3_ROOT="/usr/local/apps/pyenv/versions/miniforge3-24.11.3-2"
  export BINDCRAFT_CONDA="${MINIFORGE3_ROOT}/envs/bindcraft-conda"
  export PATH="${BINDCRAFT_CONDA}/bin:${PATH}"
  export BINDCRAFT_HOME="/usr/local/apps/BindCraft"
  export PYTHONPATH="${BINDCRAFT_HOME}:${PYTHONPATH}"

%runscript
  # コンテナ実行時のスクリプトを定義
  # "$@"は追加の引数を利用するための設定
  exec "$@"

続いて以下のように bindcraft-v1.5.2.sif をビルドします ( もちろん .def の場所などは任意です )。

🔨 apptainer build ./bindcraft-v1.5.2.sif ./def_file/bindcraft-v1.5.2.def

🔨 BindCraftを使ってみる

ワーキングディレクトリの準備

任意のディレクトリに計算を実行するためのディレクトリを作成します。

ここでは例として /mnt/d/test/BindCraft/PDL1 というディレクトリで以降作業していきます。

Target .pdb fileの準備

例として BindCraft のGitHubリポジトリにexampleとして置かれている PDL1.pdb を利用します。

/mnt/d/test/BindCraft/PDL1target というディレクトリを作成し、その中に PDL1.pdb を配置します (つまり /mnt/d/test/BindCraft/PDL1/target/PDL1.pdb です)。

settings_targetの.json fileの準備

/mnt/d/test/BindCraft/PDL1settings_target というディレクトリを作成し、その中に以下の PDL1.json という設定ファイルを作成します (雛形としてGitHubリポジトリの settings_target/PDL1.json が利用できます)。

PDL1.json
{
    "design_path": "/mnt/d/test/BindCraft/PDL1/output/",
    "binder_name": "PDL1",
    "starting_pdb": "/mnt/d/test/BindCraft/PDL1/target/PDL1.pdb",
    "chains": "A",
    "target_hotspot_residues": "56",
    "lengths": [65, 150],
    "number_of_final_designs": 5
}

今回雛形から変更したのは design_path starting_pdb number_of_final_designs の3パラメーターです。

design_path および starting_pdb のPATHは、各自が作成したディレクトリのPATHを絶対パスで入力してください。

number_of_final_designs は、今回テストのため 50 から 5 に減らしています。

その他のパラメーターは標的蛋白質と目的に応じて変更する必要があります。詳細は 公式のwiki | GitHub などを参照しましょう。

BindCraftを実行する

/mnt/d/test/BindCraft/PDL1 に以下のシェルスクリプト run_bindcraft.sh を作成します。

run_bindcraft.sh
#!/usr/bin/env bash
set -eo pipefail

# Apptainerの設定
APPTAINER_IMAGE="/mnt/d/apptainer_image"
function bindcraft-app() {
  apptainer run \
    --nvccli \
    --bind /mnt/d \
    --net --network none \
    ${APPTAINER_IMAGE}/bindcraft-v1.5.2.sif "$@"
}

# BindCraftを実行
BINDCRAFT_HOME="/usr/local/apps/BindCraft"
bindcraft-app python3 -u -m bindcraft \
  --settings ./settings_target/PDL1.json \
  --filters ${BINDCRAFT_HOME}/settings_filters/default_filters.json \
  --advanced ${BINDCRAFT_HOME}/settings_advanced/default_4stage_multimer.json

スクリプト中の APPTAINER_IMAGEbindcraft-v1.5.2.sif を配置した任意のディレクトリを指定する必要があることに注意してください。

apptainer run--bind オプションは、homeディレクトリ以外の領域をコンテナに認識させたい場合に指定します (つまりhomeディレクトリ内での実行であれば不要です)。

apptainer run--net --network none オプションは、コンテナから外部ネットワークへの接続の遮断します。つけなくても良いですが、意図せず外部サーバーが利用されることがないので精神衛生上安心です。

シェルスクリプトを作成したら、以下のように実行します。

🔨 cd /mnt/d/test/BindCraft/PDL1
🔨 chmod u+x ./run_bindcraft.sh
🔨 ./run_bindcraft.sh

おつかれさまでした!

少しだけ補足

bindcraft のオプション --filters および --advanced で指定している .json ファイルは BindCraft のGitHubリポジトリに含まれている設定ファイルです (コンテナ内のファイルを指定している)。

これらは用途によって指定する .json ファイルを変更する必要があります (詳細はリポジトリを確認してください)。

また既存の .json を雛形にパラメーターをチューニングすることも可能です。

Discussion