mcpField
P
proteinmpnn

proteinmpnn

github.com/adaptyvbio其他17246 次安装20 周前更新
代码仓库

关于 proteinmpnn

proteinmpnn 是从骨架结构设计蛋白质序列的指南,介绍 ProteinMPNN 及相关变体,面向需要配置序列生成、链选择和位置约束的研究人员,并提供结合体与界面设计示例。

主要功能

  1. 01从 PDB 骨架生成序列
  2. 02选择链和位置
  3. 03温度与氨基酸设置
  4. 04ProteinMPNN、SolubleMPNN 和 LigandMPNN

适用场景

  1. 01设计结合体链序列
  2. 02重新设计蛋白质界面
  3. 03针对多种构象生成序列

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/adaptyvbio/protein-design-skills --skill proteinmpnn

安装后在 Claude Code 中输入/proteinmpnn确认已加载。

附带文件references/temperature-guide.md

详细介绍

ProteinMPNN 序列设计

先决条件

要求最低配置推荐配置
Python3.8+3.10
CUDA11.0+11.7+
GPU 显存8GB16GB(T4)
RAM8GB16GB

运行方法

第一次使用? 请参阅入门指南,设置 Modal 和 biomodals。

选项 1:本地安装(推荐)
git clone https://github.com/dauparas/ProteinMPNN.git
cd ProteinMPNN

python protein_mpnn_run.py \
  --pdb_path backbone.pdb \
  --out_folder output/ \
  --num_seq_per_target 16 \
  --sampling_temp "0.1"

GPU:T4(16GB)即可 | 耗时:约 50-100 条序列/分钟

选项 2:Modal(通过 LigandMPNN 封装器)
cd biomodals
# modal_ligandmpnn.py takes --input-pdb and forwards run.py args via --params-str
modal run modal_ligandmpnn.py \
  --input-pdb backbone.pdb \
  --params-str "--model_type protein_mpnn --number_of_batches 16 --temperature 0.1"

GPU(Modal):默认 A10G | 超时:默认 900s

注意:LigandMPNN 包含 ProteinMPNN 功能(使用 --model_type protein_mpnn 选择)。

配置架构

核心参数
参数默认值范围说明
--pdb_path必填路径单个 PDB 输入
--pdb_path_chains全部A,B要设计的链(逗号分隔)
--out_folder必填路径输出目录
--num_seq_per_target11-1000每个结构的序列数
--sampling_temp"0.1""0.0001-1.0"温度(字符串!)
--seed0int随机种子
--batch_size11-32批次大小
温度指南
0.1  -> Low diversity, high recovery (production)
0.2  -> Moderate diversity (default)
0.3  -> Higher diversity (exploration)
0.5+ -> Very diverse, lower quality

重要:温度必须以字符串而非浮点数传入。

常见错误

温度参数

✅ 正确:

--sampling_temp "0.1"    # String with quotes

❌ 错误:

--sampling_temp 0.1      # Float without quotes - may cause errors
--sampling_temp 0.1,0.2  # Multiple temps need proper format
固定位置 JSONL

✅ 正确:

{"A": [1, 2, 3, 10, 11], "B": [5, 6]}

❌ 错误:

{"A": "1,2,3,10,11"}     # String instead of list
{A: [1, 2, 3]}           # Missing quotes on key
{"A": [1,2,3,]}          # Trailing comma
链选择

✅ 正确:

--pdb_path_chains A,B    # No spaces

❌ 错误:

--pdb_path_chains A, B   # Space after comma
--pdb_path_chains "A,B"  # Quotes may cause issues
氨基酸偏置
# Bias toward certain AAs (positive = favor)
--bias_AA_jsonl '{"A": {"A": 1.5, "W": -2.0}}'

# Omit specific AAs globally
--omit_AAs "CM"  # No cysteine or methionine

# Per-position omission
--omit_AA_jsonl '{"A": {"1": "C", "2": "CM"}}'
多链设计
# Design chains A and B together
--pdb_path_chains A,B

# Tie chains (same sequence)
--tied_positions_jsonl tied.jsonl

变体比较

变体用途主要区别
ProteinMPNN通用原始模型
SolubleMPNN表达使用可溶性蛋白训练
LigandMPNN小分子感知配体的上下文

输出格式

output/
├── seqs/
│   └── backbone.fa          # FASTA sequences
└── backbone_pdb/
    └── backbone_0001.pdb    # PDBs with designed sequence
FASTA 标题格式
>backbone_0001, score=1.234, global_score=1.234, seq_recovery=0.85
MKTAYIAKQRQISFVKSHFSRQLE...

常见工作流

结合体序列设计
python protein_mpnn_run.py \
  --pdb_path binder_backbone.pdb \
  --out_folder output/ \
  --num_seq_per_target 16 \
  --sampling_temp "0.1" \
  --pdb_path_chains B  # Design binder chain only
界面重新设计
# Fix core, design interface
python protein_mpnn_run.py \
  --pdb_path complex.pdb \
  --fixed_positions_jsonl core_positions.jsonl \
  --num_seq_per_target 32
多状态设计
# Design for multiple conformations
python protein_mpnn_run.py \
  --pdb_path_multi state1.pdb,state2.pdb \
  --num_seq_per_target 16

输出示例

成功运行
$ python protein_mpnn_run.py --pdb_path backbone.pdb --out_folder output/ --num_seq_per_target 8
Loading model weights...
Designing sequences for backbone.pdb
Generated 8 sequences in 2.3 seconds

output/seqs/backbone.fa:
>backbone_0001, score=1.234, global_score=1.189, seq_recovery=0.82
MKTAYIAKQRQISFVKSHFSRQLEERGLTKE...
>backbone_0002, score=1.198, global_score=1.156, seq_recovery=0.79
MKTAYIAKQRQISFVKSQFSRQLDERGLTKE...

良好输出的特征:

  • 分数:1.0-2.0(越低 = 越有信心)
  • 序列恢复率:从头设计为 0.3-0.6,重新设计为 0.7-0.9
  • 当 temp > 0.1 时,序列具有多样性(并非全部相同)

决策树

Should I use ProteinMPNN?
│
├─ Have a backbone structure?
│  ├─ Yes → Continue below
│  └─ No → Use RFdiffusion first
│
├─ What's in the binding site?
│  ├─ Nothing / protein only → ProteinMPNN ✓
│  ├─ Small molecule / ligand → Use LigandMPNN
│  └─ Metal / cofactor → Use LigandMPNN
│
├─ Priority?
│  ├─ Solubility/expression → Consider SolubleMPNN
│  ├─ Speed → ProteinMPNN ✓
│  └─ AF2 optimization → Consider ColabDesign
│
└─ Need fixed positions?
   ├─ Yes → Use --fixed_positions_jsonl
   └─ No → ProteinMPNN ✓ (design all)

典型性能

任务规模耗时(T4)成本(Modal)备注
100 个骨架 × 8 条序列15-20 分钟~$2标准
500 个骨架 × 8 条序列1-1.5 小时~$8大型任务
1000 个骨架 × 16 条序列3-4 小时~$18全面

吞吐量:在 T4 GPU 上约为 50-100 条序列/分钟。


验证

grep -c "^>" output/seqs/*.fa  # Should match backbone_count × num_seq_per_target

故障排除

序列多样性低:将 sampling_temp 提高到 0.2-0.3
恢复率低:将 sampling_temp 降低到 0.1
OOM 错误:减小 batch_size
出现不需要的半胱氨酸:使用 --omit_AAs "C"

错误解读
错误原因解决方法
RuntimeError: CUDA out of memory蛋白质过长或批次过大减小 batch_size 或使用更大的 GPU
KeyError: 'A'PDB 中没有该链检查 PDB 文件中的链 ID
JSONDecodeErrorJSONL 格式无效验证 JSON 语法(参见“常见错误”)
IndexError: list index链或残基列表为空检查 PDB 是否包含原子,而不只是 HEADER

下一步:进行结构预测以验证 → 使用 protein-qc 进行筛选。

评论

支持 Markdown