Command Palette

Search for a command to run...

Назад к скиллам
скилл № 08396

spatial-cnv

Infer copy number variation programs from spatial transcriptomics data using inferCNVpy or Numbat, with method-aware matrix selection, reference controls, and…

БесплатноБез исполняемых скриптов
mdbabumiamssmот mdbabumiamssm★ 36 звёзд на GitHub

Установить spatial-cnv в Claude Code и Claude Desktop

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

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

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

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

🧫 Spatial CNV

You are Spatial CNV, the copy-number inference skill for OmicsClaw. Your role is to identify large-scale chromosomal gains and losses from spatial transcriptomics data while preserving the matrix assumptions and reference requirements of each CNV method.

Why This Exists

  • Without it: users have to wire gene-position metadata, reference groups, expression matrices, and downstream spatial visualization manually.
  • With it: one skill coordinates matrix-aware CNV inference, exports reproducibility commands, and writes spatially interpretable summary tables.
  • Why OmicsClaw: it provides a method-specific wrapper layer around inferCNVpy and Numbat, so the user sees the right knobs first and the project can extend methods later without changing the interaction pattern.

Core Capabilities

  1. inferCNVpy (default): expression-based CNV inference on log-normalized expression with official infercnvpy tuning flags.
  2. Numbat: haplotype-aware CNV inference via R using raw counts, allele counts, and diploid reference expression profiles.
  3. Reference-aware runs: supports reference_key / reference_cat baseline selection for both methods.
  4. Standard Python gallery: emits a recipe-driven CNV gallery with overview, diagnostic, supporting, and uncertainty panels backed by the shared skills/spatial/_lib/viz layer.
  5. Figure-ready exports: writes figure_data/ CSVs plus a gallery manifest so downstream tools can restyle the same analysis without recomputing CNV.
  6. Compact result tables: writes cell-level CNV scores and method-specific CNV summaries for downstream inspection.

Input Formats

Format Extension Required Fields Example
AnnData (preprocessed) .h5ad X, obsm["spatial"], var["chromosome"], var["start"], var["end"] processed.h5ad
Demo n/a --demo flag Runs spatial-preprocess demo first and injects synthetic gene positions / references

Input Matrix Convention

The two CNV methods do not consume the same matrix representation:

Method Input Matrix Rationale
infercnvpy adata.X (log-normalized) infercnvpy.tl.infercnv() models smoothed log-fold-change relative to a baseline and documents layer=None -> X as the main input path
numbat adata.layers["counts"] (raw integer UMI counts) run_numbat() expects a gene-by-cell UMI count matrix and combines it with allele evidence

Core principle: inferCNV-style expression smoothing works on normalized log-expression, while Numbat's joint expression/allelic model works on raw integer counts plus phased SNP evidence.

Additional Numbat Inputs

The current OmicsClaw Numbat wrapper requires:

  • adata.obsm["allele_counts"]: a table-like object with columns cell/snp_id/CHROM/POS/AD/DP/GT/gene
  • --reference-key and --reference-cat: labeled diploid reference cells used by OmicsClaw to build lambdas_ref

If layers["counts"] is missing, OmicsClaw falls back to adata.raw or adata.X with a warning.

Workflow

  1. Load: read the preprocessed .h5ad and validate genomic annotations.
  2. Validate: check method-specific matrix requirements and reference metadata.
  3. Run CNV inference:
    • infercnvpy: infer CNV matrix, then build CNV-space PCA / neighbors / Leiden clusters before computing cnv_score
    • numbat: export a lightweight h5ad + allele-count table and launch the R run_numbat() workflow
  4. Summarize: compute cell-level CNV scores and write method-specific CSV outputs.
  5. Visualize: render the standard Python CNV gallery from a declarative recipe built on plot_cnv() and plot_features().
  6. Export figure data: write figure-ready CSVs and manifests for optional R-side beautification or custom plotting.
  7. Report and export: write report.md, result.json, processed.h5ad, tables, figures, figure_data/, and reproducibility helpers.

CLI Reference

# inferCNVpy default run
oc run spatial-cnv \
  --input <processed.h5ad> --output <dir>

# inferCNVpy with explicit reference cells and broader smoothing
oc run spatial-cnv \
  --input <processed.h5ad> --method infercnvpy \
  --reference-key cell_type --reference-cat Normal Stroma \
  --window-size 150 --step 20 \
  --infercnv-dynamic-threshold 1.5 \
  --infercnv-lfc-clip 3.0 \
  --infercnv-exclude-chromosomes chrX chrY \
  --infercnv-chunksize 5000 --infercnv-n-jobs 1 \
  --output <dir>

# inferCNVpy including sex chromosomes
oc run spatial-cnv \
  --input <processed.h5ad> --method infercnvpy \
  --reference-key cell_type --reference-cat Normal \
  --infercnv-include-sex-chromosomes \
  --output <dir>

# Numbat (requires raw counts, allele counts, and diploid references)
oc run spatial-cnv \
  --input <processed.h5ad> --method numbat \
  --reference-key cell_typ
Полный SKILL.md на GitHub

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

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

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

FAQ

Что делает скилл spatial-cnv?

Infer copy number variation programs from spatial transcriptomics data using inferCNVpy or Numbat, with method-aware matrix selection, reference controls, and spatially mappable CNV summaries.

Как установить скилл spatial-cnv?

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

Скилл spatial-cnv запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

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

Сравнить spatial-cnv с