chai について
chaiは、FASTA入力からChai-1でタンパク質構造を予測するスキルです。タンパク質複合体、リガンド、核酸を扱い、研究ワークフロー向けに出力と信頼度指標を説明します。
主な機能
- 01タンパク質複合体の予測
- 02タンパク質・リガンド・DNA/RNA入力への対応
- 03Modal、API、ローカル環境での実行
- 04CIFモデルと信頼度指標の出力
- 05リサイクル回数と拡散ステップの設定
活用シーン
- 01バインダーと標的の複合体の検証
- 02タンパク質と低分子の構造予測
- 03複数のFASTAファイルの一括予測
- 04モデルスコアと信頼度の確認
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ adaptyvbio/ protein-design-skills --skill chaiインストール後、Claude Code で/chaiを入力して読み込まれたか確認します。
同梱ファイルreferences/api-reference.md
詳細
Chai-1 構造予測
前提条件
| 要件 | 最小 | 推奨 |
|---|---|---|
| Python | 3.10+ | 3.11 |
| CUDA | 12.0+ | 12.1+ |
| GPU VRAM | 24GB | 40GB (A100) |
| RAM | 32GB | 64GB |
実行方法
初めてですか? Modal と biomodals のセットアップについては、Getting started をご覧ください。
オプション 1:Modal
cd biomodals
modal run modal_chai1.py \
--input-faa complex.fasta \
--out-dir predictions/
GPU:A100 (40GB) | タイムアウト:デフォルトは 30min
オプション 2:Chai API(推奨)
pip install chai_lab
python -c "
import chai_lab
from chai_lab.chai1 import run_inference
# Run prediction
run_inference(
fasta_file='complex.fasta',
output_dir='predictions/',
num_trunk_recycles=3
)
"
オプション 3:ローカルインストール
git clone https://github.com/chaidiscovery/chai-lab.git
cd chai-lab
pip install -e .
chai-lab predict \
--fasta complex.fasta \
--output predictions/
FASTA 形式
タンパク質複合体
>binder
MKTAYIAKQRQISFVKSHFSRQLE...
>target
MVLSPADKTNVKAAWGKVGAHAGE...
タンパク質 + リガンド
>protein
MKTAYIAKQRQISFVKSHFSRQLE...
>ligand|smiles
CCO
タンパク質 + DNA/RNA
>protein
MKTAYIAKQRQISFVKSHFSRQLE...
>dna
ATCGATCGATCG
主なパラメーター
| パラメーター | デフォルト | 範囲 | 説明 |
|---|---|---|---|
num_trunk_recycles | 3 | 1-10 | リサイクル回数(多いほど良好) |
num_diffn_timesteps | 200 | 50-500 | 拡散ステップ数 |
seed | 0 | int | ランダムシード |
出力形式
predictions/
├── pred.model_idx_0.cif # Best model (CIF format)
├── pred.model_idx_1.cif # Second model
├── scores.json # Confidence scores
├── pae.npy # PAE matrix
└── plddt.npy # pLDDT values
注:Chai-1 の出力形式は CIF です。必要に応じて PDB に変換します。
from Bio.PDB import MMCIFParser, PDBIO
parser = MMCIFParser()
structure = parser.get_structure("pred", "pred.model_idx_0.cif")
io = PDBIO()
io.set_structure(structure)
io.save("pred.model_idx_0.pdb")
メトリクスの抽出
import numpy as np
import json
# Load scores
with open('predictions/scores.json') as f:
scores = json.load(f)
plddt = np.load('predictions/plddt.npy')
pae = np.load('predictions/pae.npy')
print(f"pLDDT: {plddt.mean():.3f}")
print(f"pTM: {scores['ptm']:.3f}")
print(f"ipTM: {scores.get('iptm', 'N/A')}")
ユースケース
バインダーの検証
# Predict complex with Chai
chai-lab predict --fasta binder_target.fasta --output val/
# Check ipTM > 0.5
scores = json.load(open('val/scores.json'))
if scores['iptm'] > 0.5:
print("Design passes validation")
タンパク質-リガンド複合体
# FASTA with SMILES
fasta = """
>protein
MKTA...
>ligand|smiles
CCO
"""
# Chai handles both protein and small molecules
バッチ予測
# Multiple sequences
for fasta in sequences/*.fasta; do
chai-lab predict \
--fasta "$fasta" \
--output "predictions/$(basename $fasta .fasta)"
done
AF2 との比較
| 項目 | Chai-1 | AlphaFold2 |
|---|---|---|
| MSA が必要 | いいえ | はい |
| 小分子 | はい | いいえ |
| DNA/RNA | はい | 限定的 |
| 速度 | 高速 | 低速 |
| 精度 | 同等 | 基準 |
出力例
正常に実行された場合
$ chai-lab predict --fasta complex.fasta --output predictions/
[INFO] Loading Chai-1 model...
[INFO] Running inference...
[INFO] Saved 5 models to predictions/
predictions/scores.json:
{
"ptm": 0.82,
"iptm": 0.71,
"ranking_score": 0.76
}
良好な出力の目安:
- pTM:> 0.7(全体構造の信頼度が高い)
- ipTM:> 0.5(インターフェースの信頼度が高い。高信頼度の目安は > 0.7)
- 原子位置が妥当な CIF ファイル
判断フロー
Should I use Chai?
│
├─ What are you predicting?
│ ├─ Protein-protein complex → Chai ✓ or ColabFold
│ ├─ Protein + small molecule → Chai ✓
│ ├─ Protein + DNA/RNA → Chai ✓
│ └─ Single protein only → Use ESMFold (faster)
│
├─ Need MSA?
│ ├─ No / want speed → Chai ✓
│ └─ Yes / want accuracy → ColabFold
│
└─ Priority?
├─ Highest accuracy → ColabFold with MSA
├─ Speed / no MSA → Chai ✓
└─ Ligand binding → Chai ✓
一般的なパフォーマンス
| キャンペーン規模 | 所要時間 (A100) | コスト (Modal) | 備考 |
|---|---|---|---|
| 100 複合体 | 30-60 min | ~$10 | 標準的な検証 |
| 500 複合体 | 2-4h | ~$45 | 大規模キャンペーン |
| 1000 複合体 | 5-8h | ~$90 | 包括的な検証 |
複合体あたり:一般的なバインダー-標的複合体では約 20-40 秒です。
検証
find predictions -name "*.cif" | wc -l # Should match input count
トラブルシューティング
pLDDT が低い:num_trunk_recycles を増やします。 ipTM が低い:鎖の順序とインターフェース領域を確認します。 OOM エラー:A100-80GB を使用するか、バッチサイズを小さくします。 予測が遅い:num_diffn_timesteps を減らします。
エラーの解釈
| エラー | 原因 | 解決方法 |
|---|---|---|
RuntimeError: CUDA out of memory | 複合体が大きすぎます | A100-80GB を使用するか、予測を分割します |
KeyError: 'iptm' | 単一鎖が予測されました | FASTA に複数の鎖が含まれていることを確認します |
ValueError: invalid SMILES | リガンドの形式が不正です | RDKit で SMILES を検証します |
torch.cuda.OutOfMemoryError | GPU のメモリを使い切りました | num_diffn_timesteps を 100 に減らします |
次へ:フィルタリングとランキングには protein-qc を使用します。
コメント
Markdown 対応