spatial-cnv
Infer copy number variation programs from spatial transcriptomics data using inferCNVpy or Numbat, with method-aware matrix selection, reference controls, and…
от 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
- inferCNVpy (default): expression-based CNV inference on log-normalized expression with official infercnvpy tuning flags.
- Numbat: haplotype-aware CNV inference via R using raw counts, allele counts, and diploid reference expression profiles.
- Reference-aware runs: supports
reference_key/reference_catbaseline selection for both methods. - Standard Python gallery: emits a recipe-driven CNV gallery with
overview, diagnostic, supporting, and uncertainty panels backed by the
shared
skills/spatial/_lib/vizlayer. - Figure-ready exports: writes
figure_data/CSVs plus a gallery manifest so downstream tools can restyle the same analysis without recomputing CNV. - 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 columnscell/snp_id/CHROM/POS/AD/DP/GT/gene--reference-keyand--reference-cat: labeled diploid reference cells used by OmicsClaw to buildlambdas_ref
If layers["counts"] is missing, OmicsClaw falls back to adata.raw or
adata.X with a warning.
Workflow
- Load: read the preprocessed
.h5adand validate genomic annotations. - Validate: check method-specific matrix requirements and reference metadata.
- Run CNV inference:
infercnvpy: infer CNV matrix, then build CNV-space PCA / neighbors / Leiden clusters before computingcnv_scorenumbat: export a lightweight h5ad + allele-count table and launch the Rrun_numbat()workflow
- Summarize: compute cell-level CNV scores and write method-specific CSV outputs.
- Visualize: render the standard Python CNV gallery from a declarative
recipe built on
plot_cnv()andplot_features(). - Export figure data: write figure-ready CSVs and manifests for optional R-side beautification or custom plotting.
- 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
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
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), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…