关于 chai
chai 是使用 FASTA 输入运行 Chai-1 蛋白质结构预测的技能,涵盖蛋白质复合物、配体和核酸,并说明预测结果与置信度指标,适用于研究工作流。
主要功能
- 01预测蛋白质复合物
- 02支持蛋白质-配体及蛋白质-DNA/RNA 输入
- 03通过 Modal、API 或本地安装运行
- 04输出 CIF 模型和置信度指标
- 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 显存 | 24GB | 40GB(A100) |
| 内存 | 32GB | 64GB |
运行方法
第一次使用? 请参阅入门指南,了解如何设置 Modal 和 biomodals。
选项 1:Modal
cd biomodals
modal run modal_chai1.py \
--input-faa complex.fasta \
--out-dir predictions/
GPU:A100(40GB) | 超时:默认 30 分钟
选项 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 分钟 | ~$10 | 标准验证 |
| 500 个复合物 | 2-4 小时 | ~$45 | 大型项目 |
| 1000 个复合物 | 5-8 小时 | ~$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