К основному содержанию
скилл CX Codex

ml-peptide-generation — скилл для Claude Code: генерация пептидов

Скилл ml-peptide-generation для Claude Code генерирует пептиды-кандидаты для связывания с целевым белком. Он ранжирует последовательности по псевдоперплексности и сравнивает настройки длины и top-k.

MIT ★ 77 обновлён 2026-10-27

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add ssinder/bioinformatics-agent-skills --skill ml-peptide-generation -a claude-code
Открыть на GitHub

Что делает ml-peptide-generation

Скилл генерирует пептиды-кандидаты с помощью языковой модели PepMLM-650M: добавляет маски к последовательности целевого белка и выбирает аминокислоты для каждой позиции. Результаты включают псевдоперплексность и флаг валидности; явный seed позволяет повторить генерацию с теми же настройками. X, B и Z исключаются из выбора.

Вход можно передать в FASTA, CSV с колонками id и seq или одной последовательностью. Скрипт генерации требует Python 3.9+, torch и transformers. Для фильтрации результатов и анализа параметров есть отдельный скрипт: ему достаточно стандартной библиотеки Python, GPU не нужен.

Псевдопереплексность отражает оценку модели, а не способность связываться с белком; выводы о связывании требуют экспериментальной или независимой вычислительной проверки. Последовательности-мишени длиннее 552 токенов скилл отклоняет.

Какие задачи решает

  • сгенерировать ранжированный набор пептидов для целевого белка
  • сравнить результаты для разных длин пептидов и значений top-k
  • отфильтровать кандидатов по псевдоперплексности и длине
  • повторить генерацию с заданным seed

Примеры запросов агенту

  • Сгенерируй пептиды для последовательности белка из targets.fasta и сохрани результаты в results/.
  • Сравни кандидатов для длин 10, 12 и 15 аминокислот с разными значениями top-k.
  • Отфильтруй results/peptides.csv по псевдоперплексности и собери анализ параметров.

Как установить ml-peptide-generation

1Через Skills CLI (Vercel)

npx skills add ssinder/bioinformatics-agent-skills --skill ml-peptide-generation -a claude-code

2Вручную: положить файлы

~/.claude/skills/ml-peptide-generation/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/ml-peptide-generation/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о ml-peptide-generation

Как установить ml-peptide-generation в Claude Code?

Выполни npx skills add ssinder/bioinformatics-agent-skills --skill ml-peptide-generation -a claude-code. Файл скилла находится по пути ~/.claude/skills/ml-peptide-generation/SKILL.md.

Что делает ml-peptide-generation?

Скилл генерирует кандидатов пептидов для целевого белка с помощью PepMLM-650M, оценивает их псевдоперплексность и фильтрует результаты. Эта оценка не подтверждает связывание с белком.

Что нужно для работы ml-peptide-generation?

Для генерации нужны Python 3.9+, torch и transformers. Скрипт анализа использует стандартную библиотеку Python и не требует GPU.

Исходный текст

SKILL.md · MIT
---
name: ml-peptide-generation
description: >-
  Generates candidate binder peptides for a target protein using the PepMLM-650M
  masked language model — appends <mask> tokens to the target sequence and
  samples amino acids at each position, with illegal residues (X, B, Z)
  excluded from the sampling candidates. Reports pseudo-perplexity for each
  candidate, supports reproducible generation via an explicit random seed,
  and provides offline filtering and parameter-sweep analysis that needs no GPU.
  This skill should be used when designing peptides or protein fragments that
  should bind a target, generating a ranked candidate pool for a target
  sequence, or comparing how peptide length and top-k sampling settings affect
  candidate quality.
license: MIT
compatibility: Python 3.9+; generation needs torch + transformers; analysis needs only the standard library
metadata:
  version: "1.0"
  last-reviewed: "2026-10-26"
  skill-author: sinder
---

# ML Peptide Generation

## Overview

This skill generates candidate binder peptides for a target protein with
**PepMLM-650M**, a masked language model trained on protein sequences.

The mechanism is straightforward: append N `<mask>` tokens to the target
sequence, ask the model for its amino-acid distribution at each masked
position, and sample from it. Repeating that for N positions produces an
N-residue peptide.

Two things this skill does that a naive implementation does not:

- **Reproducible by construction.** Every run takes an explicit `--seed`.
  The same seed and the same input always produce the same peptides, so a
  parameter sweep is a controlled experiment rather than a lottery.
- **Illegal residues are excluded at sampling time, not afterwards.** The
  model's vocabulary contains `X` (unknown), `B` and `Z` (ambiguous amino
  acids). Sampling from the raw vocabulary produces peptides that are not
  chemically meaningful. Here those candidates are removed *before* the
  draw, so the sampling budget is not wasted on rejects.

## When to Use This Skill

- Designing a peptide or protein fragment intended to bind a target protein
- Producing a ranked candidate pool for a set of targets
- Comparing peptide lengths (10 / 12 / 15 aa) or top-k settings
- Screening candidates before committing to synthesis or wet-lab validation

## Quick Start

```bash
export PYTHONPATH="$PWD/packages"

# 生成(需要 torch + transformers)
python scripts/generate_peptides.py \
    --input-fasta targets.fasta \
    --output-dir results/ \
    --peptide-lengths 10,12,15 \
    --num-binders 20 \
    --seed 42

# 分析(只用标准库,无需 GPU)
python scripts/analyze_peptides.py \
    --input results/peptides.csv \
    --output-dir analysis/ \
    --max-ppl 5.0
```

## Workflow

1. **Collect targets** — `--input-fasta` (FASTA), `--input-csv` (needs `id`
   and `seq` columns) or `--input-seq` (a single sequence).
2. **Set the seed** — `--seed` fixes `random`, `numpy` and `torch`. The seed
   is written into every output row so a run can be reproduced later.
3. **Generate** — for each target × peptide length × top-k combination,
   sample `--num-binders` peptides and score each by pseudo-perplexity.
4. **Analyse** — `analyze_peptides.py` filters invalid peptides, applies
   optional PPL/length thresholds, and reports per-configuration statistics.
5. **Select** — rank by pseudo-perplexity and carry the top candidates into
   downstream validation.

## Parameters

### `generate_peptides.py`

| Parameter | Default | Description |
|---|---|---|
| `--input-fasta` | — | Target protein FASTA file |
| `--input-csv` | — | Target CSV file (needs `id` and `seq` columns) |
| `--input-seq` | — | A single target sequence |
| `--output-dir` | `peptide_results` | Output directory |
| `--per-target-dir` | off | Also write one CSV per target |
| `--peptide-lengths` | `10,12,15` | Peptide lengths to generate |
| `--top-ks` | `3` | Top-k values to sweep |
| `--num-binders` | `10` | Peptides per (target × length × top-k) |
| `--seed` | `42` | Random seed — same seed, same results |
| `--model` | `TianlaiChen/PepMLM-650M` | Pretrained model |
| `--device` | auto | Force `cuda` or `cpu` |
| `--allow-invalid-amino-acids` | off | Allow sampling `X`/`B`/`Z` |

### `analyze_peptides.py`

| Parameter | Default | Description |
|---|---|---|
| `--input` | required | One or more result CSV files |
| `--output-dir` | `peptide_analysis` | Output directory |
| `--max-ppl` | none | Keep only peptides with PPL ≤ this value |
| `--min-length` / `--max-length` | none | Peptide length bounds |
| `--keep-invalid` | off | Keep peptides containing non-standard residues |
| `--top-n` | `20` | How many to print |

## Outputs

| File | Content |
|---|---|
| `peptides.csv` | All candidates: rank, target, length, top-k, binder, pseudo-perplexity, validity flag, seed |
| `peptides.json` | Same content as JSON |
| `filtered_peptides.csv` | Candidates passing the filters, sorted by PPL |
| `parameter_analysis.csv` / `.json` | Per-configuration totals, mean/median/min/max PPL |

## Validation

- **Pseudo-perplexity measures the model's own belief, not binding affinity.**
  A low PPL means "this looks like a peptide the model would have generated",
  not "this binds the target". It is a triage filter for wet-lab follow-up,
  nothing more. Any claim about affinity needs an experimental or
  orthogonal computational check.
- **PPL is only comparable within one (target, length) pair.** The scale
  depends on the target sequence; do not compare PPL across different
  targets and conclude one target is "easier".
- **Check the validity flag.** `has_unknown_aa=True` means the peptide
  contains a residue the model could not decide on — such a peptide is not
  a real design. The skill excludes these at sampling time, but the flag
  stays in the output so the filter can be audited.
- **Verify reproducibility.** Re-run with the same `--seed` and diff
  `peptides.csv`; the files must be byte-identical apart from the
  `generated_at` timestamp.
- **Peptides shorter than about 8 residues rarely bind meaningfully.** Use
  `--min-length` to exclude them from a synthesis list.
- **The model truncates at 552 tokens.** Target sequences longer than that
  are rejected by the skill rather than silently truncated — a truncated
  target produces peptides for the wrong protein.

## References

- `references/methodology.md` — PepMLM mechanism, pseudo-perplexity derivation, sampling strategy
- `references/troubleshooting.md` — common failures and how to diagnose them
- Model card: <https://huggingface.co/TianlaiChen/PepMLM-650M>
- E-utilities context for target discovery: the `bioproject-search` skill

© ssinder · MIT · ssinder/bioinformatics-agent-skills

Похожие скиллы

Все скиллы по теме «ИИ и ML» →
tooluniverse-peptide-target-deorphanization mims-harvard Скилл tooluniverse-peptide-target-deorphanization для Claude Code ищет белковые мишени пептида по последовательности, фенотипу и данным о гомологии. Разбирает неожиданные и видоспецифичные результаты связывания. CX Codex +1 117установок protein-sequence-similarity-search google-deepmind Скилл protein-sequence-similarity-search ищет гомологичные последовательности белка через MMseqs2 или BLAST, разбирает метрики выравнивания и сохраняет таблицу хитов в Markdown. CX Codex +1 2 400установок protein-sequence-msa google-deepmind Скилл protein-sequence-msa для Claude Code, Codex, Cursor и других платформ, который выравнивает несколько белковых последовательностей через API EBI Clustal Omega. CX Codex +1 2 400установок diffdock K-Dense-AI Запускает DiffDock и DiffDock-L для расчёта поз связывания малой молекулы с белком. Считает одну пару или батч и выдаёт кандидатные позы для разбора. CX Codex +1 2 100установок tooluniverse-antibody-engineering mims-harvard Скилл tooluniverse-antibody-engineering ведёт антитело от лабораторного кандидата до клинического: гуманизация последовательности, аффинность, структура, иммуногенность. CX Codex +1 395установок rosetta-mcp-server Arielbs MCP-сервер, через который ИИ-ассистент запускает протоколы RosettaScripts, считает энергии структур и переводит код между PyRosetta и Biotite. CX Codex +1 ★ 19звёзд репо

Из того же набора10

Весь набор →
protein-structure Скилл protein-structure для Claude Code анализирует белковые структуры из PDB-файлов. Он включается при запросах о вторичной структуре, радиусе инерции или разборе PDB. CX Codex +1 ★ 77звёзд репо protein-interactions Скилл protein-interactions для Claude Code разбирает отчёты PLIP и архивы AlphaFold, извлекая взаимодействия белков на уровне остатков. Включается при анализе контактов, поиске горячих точек и визуализации. CX Codex +1 ★ 77звёзд репо ena-download Скилл ena-download для Claude Code загружает данные секвенирования FASTQ и метаданные через ENA Portal API. Включается при запросе сырых прочтений по номерам SRA, ERR или DRR. CX Codex +1 ★ 77звёзд репо bioproject-search Скилл bioproject-search для Claude Code выгружает метаданные проектов NCBI BioProject через E-utilities API. Сохраняет названия, организмы и даты релизов в CSV или JSON. CX Codex +1 ★ 77звёзд репо protein-docking-lightdock Скилл protein-docking-lightdock для Claude Code запускает локальный белковый докинг через LightDock и выгружает модели комплексов в PDB. Обрабатывает сетки рецептор-лиганд и ведёт ранжирование по DFIRE. CX Codex +1 ★ 77звёзд репо alphafold-db Скилл alphafold-db для Claude Code скачивает предсказанные структуры белков из AlphaFold DB и собирает метрики pLDDT. Запускается при запросе моделей по UniProt accession или отбора по уверенности. CX Codex +1 ★ 77звёзд репо bio-database-fetch Скилл bio-database-fetch для Claude Code выгружает свойства химических соединений из PubChem и таксономию видов из NCBI. Забирает данные пачками по 100 идентификаторов через официальные REST API. CX Codex +1 ★ 77звёзд репо protein-docking-hdock Скилл protein-docking-hdock для Claude Code отправляет задачи стыковки белков на сервер HDOCK и получает оценки и модели комплексов. Он подключается по запросам на предсказание структуры или загрузку результатов. CX Codex +1 ★ 77звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой