Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

consensus-interpret

БесплатноЗапускает вложенные скриптыНе проверен

Load when biologically interpreting a finished verified consensus run (consensus-domains / sc-consensus-clustering) — inline DE, marker-DB lookup, and LLM…

lilinjiот lilinji★ 18 звёзд на GitHub

Об этом скилле

consensus-interpret

When to use

The user has just finished a verified typed consensus run (consensus-domains or sc-consensus-clustering) and wants the next manual step (read cross_method_nmi.csv → run spatial-de → cross-reference markers → name cell types → decide downstream skill) done automatically with falsifiable evidence binding every LLM claim.

This skill does NOT replace the typed run. It is a strictly downstream consumer: it reads <typed_run_dir>/{plan.json, consensus_labels.tsv, member_scores.csv, cross_method_nmi.csv} plus the original adata, and writes its output to a different directory under analysis://interpreted/<typed_run_id>. The verified-vs-exploratory boundary established by ADR 0010 is preserved.

Skip when:

  • The typed run did not produce consensus_labels.tsv (i.e. consensus-domains exited non-zero — fix the typed run first).
  • You are looking for a generic query → skill dispatcher; use orchestrator for that (forward direction).
  • You want to refine the consensus itself based on LLM judgment; that is explicitly forbidden by §11.4 "LLM never participates in statistical merging" and would be rejected by this skill's T3 invariants.

Inputs & Outputs

Inputs

  • Input kinds: directory
  • File types: .json

Outputs

  • interpreted_report.md
  • interpreted_assignments.json
  • de_per_cluster.csv
  • contradiction_regions.csv
  • audit.json

Flow

1. Preflight (T1 — fail-fast if any fail)
   ├─ Load plan.json from --input; assert schema_version + typed run integrity
   ├─ Locate adata at plan.json.input_path (or --adata override); check exists
   ├─ Load consensus_labels.tsv; assert observation column ⊆ adata.obs.index
   ├─ Resolve marker DB:
   │    --markers <path> if given;
   │    else bundled `data/markers/panglaodb_<tissue>.tsv` for --tissue;
   │    else exit 5 (MarkerDBUnavailable)
   └─ If LLM required and unreachable AND --no-llm not set → exit 6 (LLMUnavailable)

2. Per-cluster differential expression (deterministic, scanpy)
   └─ scanpy.tl.rank_genes_groups(adata, groupby=consensus_<operator>, method='wilcoxon')
       → de_per_cluster.csv with top-K markers per cluster (K=20 default)

3. Marker → cell-type lookup (deterministic, pre-LLM)
   └─ For each cluster, compute candidate cell types by ranking DB entries
       whose gene appears in the cluster's top-K markers (weighted by db.weight × 1/de_rank).

4. LLM grounded interpretation (γ + β; one call per cluster + one synthesis call)
   ├─ Prompt template embeds (per cluster):
   │    cluster_id, n_cells, top-K DE markers,
   │    DB candidate cell types (ranked),
   │    member_agreement summary, cross_method_nmi neighbors
   ├─ LLM must return JSON conforming to interpreted_assignments.json
   │   schema; mandatory evidence.markers[] with non-empty
   │   {gene, db_source, db_celltype}
   └─ After all clusters: one synthesis call to produce next_steps[]
       with mandatory evidence_refs[] (capped at top-3 by priority)

5. Invariant enforcement (T3 — fail-fast if violated)
   ├─ Every cluster.evidence.markers != []      → else exit 7
   ├─ Every next_steps[*].evidence_refs != []   → else exit 7
   └─ Banner present and matches one of two allowed values → else exit 7

6. Coverage check (T2 — escalate to T1 if floor breached)
   └─ interpretable_cluster_frac < --coverage-floor → exit 8

7. Artifact writes
   ├─ interpreted_report.md (banner enforced in format_interpreted_report)
   ├─ interpreted_assignments.json
   ├─ de_per_cluster.csv
   ├─ contradiction_regions.csv
   └─ audit.json

Gotchas

  • It never refines the consensus. The LLM names cell types and recommends next steps but is forbidden from touching the statistical merge — the T3 invariants reject any attempt (ADR 0012 §11.4). Treat the consensus labels as fixed input.
  • Marker citations are mandatory. Every cluster's evidence.markers[] and every next-step's evidence_refs[] must be non-empty, or the run exits 7 (InvariantViolation). Ungrounded LLM output is rejected, not silently kept.
  • --no-llm changes the banner, not just the content. Structural-only mode emits [I-noLLM: ...] and drops all cell-type claims; downstream consumers must branch on the banner, not assume biology is present.
  • Output lands in a separate namespace. Interpreted artifacts go to analysis://interpreted/<run_id>, never overwriting the verified analysis://typed/<run_id> evidence base (the ADR 0010 boundary).

Failure modes (per ADR 0012)

Exit Name Meaning
0 success All clusters interpreted (or low_confidence), invariants intact, no degradation triggered
2 argparse CLI error
3 TypedRunInvalid plan.json missing / malformed / not from a typed run
4 AdataMismatch adata obs index disjoint f
Полный SKILL.md на GitHub

Установить consensus-interpret в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

IMPLEMENTATION_PLAN.md_artifacts.py_candidates.py_de.py_errors.py_invariants.py_llm.py_marker_db.py_metrics.py_report.py_run_reader.pyconsensus_interpret.pydata/markers/README.mddata/markers/cellmarker_liver.tsvdata/markers/panglaodb_brain.tsvdata/markers/panglaodb_immune.tsvdata/markers/panglaodb_kidney.tsvprompts/annotate.tmplprompts/next_steps.tmplreferences/methodology.mdreferences/output_contract.mdreferences/parameters.mdskill.yaml

FAQ

Что делает скилл consensus-interpret?

Load when biologically interpreting a finished verified consensus run (consensus-domains / sc-consensus-clustering) — inline DE, marker-DB lookup, and LLM cell-type naming with mandatory marker citations + evidence-bound next-step recommendations. Skip when the consensus run failed (fix it first); forward query→skill routing (use orchestrator).

Как установить скилл consensus-interpret?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл consensus-interpret запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

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

Сравнить consensus-interpret с