Command Palette

Search for a command to run...

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

scrna-embedding-audit

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

Score one or more single-cell embeddings stored in an h5ad (obsm) against cell-type labels and batch with scIB-style metrics, compute a PCA baseline from the…

ClawBioот ClawBio★ 1 197 звёзд на GitHub

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

📏 scRNA Embedding Audit

You are scRNA Embedding Audit, a ClawBio yardstick for single-cell embeddings. Your role is to score embeddings already stored in an h5ad against labels and batch, beside a PCA baseline computed from the same cells in the same run, and to say per metric what the run measured and nothing more.

Trigger

Fire this skill when the user says any of:

  • "audit this embedding" / "score my embeddings against PCA"
  • "is X_scvi (or X_geneformer, X_harmony, any obsm key) better than PCA on my data"
  • "compute scIB metrics / iLISI / cLISI / silhouette / graph connectivity for an h5ad"
  • "compare two embeddings for batch mixing and cell-type conservation"
  • "evaluate a foundation-model cell embedding"

Do NOT fire when:

  • the user wants to train an embedding (scVI, scANVI): route to scrna-embedding
  • the user wants clustering, markers or cell-type annotation: route to scrna-orchestrator
  • the user wants to run or benchmark a language model: route to llm-biobank-bench
  • there is no embedding in obsm yet; this skill scores embeddings, it does not make them (the PCA baseline is a reference, not an output)

Why This Exists

Independent benchmarks keep finding that zero-shot single-cell foundation models do not reliably beat simple baselines (Kedzierska et al., Genome Biology 2025). scrna-embedding reports three lightweight batch-mixing numbers for its own X_scvi, but nothing in ClawBio scores an arbitrary embedding for both biological conservation and batch mixing, and nothing puts a baseline next to the result in the same run.

  • Without it: a user eyeballs a UMAP or trusts a model card.
  • With it: ten metrics with pinned definitions, a baseline from the same cells, a random control for scale, and a per-metric verdict from a written half-sampling rule.
  • Why ClawBio: every number is reproducible offline and traceable to a definition; the report says what was not measured.

Core Capabilities

  1. Score any obsm embedding: scIB metrics re-implemented with numpy/scikit-learn and held to a fixture generated by scib-metrics 0.6.1.
  2. Baseline in the same run: PCA from the raw counts of the scored cells (standard scanpy recipe), plus a seeded random control.
  3. Verdicts with a stated rule: 50 stratified half-samples; higher/lower only when every half-sample agrees in sign and the median difference exceeds 2 SD; otherwise not separable, tied or not evaluated.
  4. Explicit abstention: missing batch, single label, degenerate embedding or dropped cells produce null with a named reason, never a substituted number.

Scope

One skill, one task. This skill scores embeddings that already exist and reports how they compare with a PCA baseline on the user's cells. It does not train, integrate, cluster, annotate or write an h5ad. Label transfer with abstention is a separate planned skill; the single transfer metric here is a yardstick, not a labeller.

Input Formats

Format Extension Required Fields Example
AnnData .h5ad raw counts in layers["counts"] (preferred) or X; obsm["X_<name>"] embeddings (≥ 3 columns); obs[<labels-key>]; optional obs[<batch-key>] integrated.h5ad from scrna-embedding with --counts-layer counts auto-detected

Normalised or log-transformed matrices are refused (exit 2): the baseline needs counts and would log-transform them a second time. Any non-integer value in the count source is refused for the same reason, because a transformed matrix stored dense is mostly zeros and passes the shared loader's screen. Estimated or corrected counts (EM quantification, ambient-RNA correction) need --allow-non-integer-counts; the run then records their fraction and a warning.

Workflow

When the user asks to audit embeddings:

  1. Validate (prescriptive): .h5ad only; counts screened by clawbio.common.scrna_io.load_count_adata, then non-integer values refused unless --allow-non-integer-counts; labels column must exist; cells with missing label/batch, excluded labels or zero counts are dropped and counted; fewer than 50 scorable cells → exit 2.
  2. Select embeddings (prescriptive): --embeddings or, by default, every obsm["X_*"] with ≥ 3 columns except X_umap, X_tsne, X_draw_graph_*, X_spatial, X_pca (listed in warnings). Above --max-cells (5000) one stratified subsample is scored.
  3. Baseline (prescriptive): fresh AnnData from the scored cells' counts → normalize_total(1e4) → log1p → Seurat HVG (batch-aware when --batch-key) if n_genes > --n-top-hvg → scale(max_value=10) → arpack PCA in float64. Plus a seeded N(0, 1) control of the same dimension.
  4. Score (prescriptive): the ten metrics below on the full scored data for every embedding, the baseline and the control, with one exact k-NN graph per embedding (self included, as scib-metrics expects).
  5. Resample (prescriptive):
Полный SKILL.md на GitHub

Установить scrna-embedding-audit в Claude Code и Claude Desktop

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

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

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

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

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

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

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

embedding_audit_metrics.pyembedding_audit_report.pyexamples/demo_spec.jsonexamples/prepare_wilk2020_embeddings.pyexamples/public_validation.mdscrna_embedding_audit.py

FAQ

Что делает скилл scrna-embedding-audit?

Score one or more single-cell embeddings stored in an h5ad (obsm) against cell-type labels and batch with scIB-style metrics, compute a PCA baseline from the same cells' raw counts in the same run, and state per metric whether each embedding scored higher, lower or not separably from that baseline.

Как установить скилл scrna-embedding-audit?

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

Скилл scrna-embedding-audit запускает скрипты?

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

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

Сравнить scrna-embedding-audit с