sc-metacell
БесплатноБез исполняемых скриптовНе проверенLoad when aggregating single cells into metacells (sample-aware coarse-grained pseudo-cells) on a normalised scRNA AnnData via SEACells or KMeans on a low-D…
от mdbabumiamssm★ 36 звёзд на GitHubОб этом скилле
sc-metacell
When to use
The user has a normalised scRNA AnnData with a low-D embedding
(obsm["X_pca"] by default) and wants compact metacell aggregates
suitable for downstream GRN inference, slow-RNA-velocity analysis, or
robust cluster-level statistics that need fewer but higher-coverage
units. Two methods:
seacells(default) — kernel archetypal analysis with iterative refinement (--min-iter/--max-iter). Aggregates similar cells into archetypes. Auto-falls back tokmeansif the SEACells package isn't installed.kmeans— KMeans clustering on the embedding; faster, no SEACells dependency.
Output is a new AnnData (madata) where each row is one metacell.
For per-cluster marker discovery on the original AnnData, use
sc-markers. For ordering cells, use sc-pseudotime.
Inputs & Outputs
| Input | Format | Required |
|---|---|---|
| Normalised AnnData | .h5ad with obsm[--use-rep] (default X_pca) |
yes (unless --demo) |
| Output | Path | Notes |
|---|---|---|
| Cell-level AnnData with metacell labels | processed.h5ad |
rows = original cells; adds obs["metacell"] holding the metacell ID. This is the primary downstream object — sc-de / sc-enrichment expect this shape. |
| Metacell-aggregated AnnData | tables/metacells.h5ad |
rows = metacells; per-metacell aggregated expression for cluster-level / GRN downstream |
| Metacell summary | tables/metacell_summary.csv |
per-metacell obs (size, dominant celltype, etc.) |
| Cell → metacell map | tables/cell_to_metacell.csv |
always |
| Figures | figures/metacell_centroids.png, figures/metacell_size_distribution.png |
first only when an embedding is plottable |
| Report | report.md + result.json |
always |
Flow
- SEACells fallback check: try
import SEACells; if it fails, silently switch--methodtokmeans. - Load AnnData (
--input) or build a demo. - Preflight:
obsm[--use-rep]exists;--n-metacellsis< n_cellsand≥ 2; warn if nolayers["counts"]. - For SEACells: run kernel archetypal analysis with
--min-iter/--max-iter; for KMeans: cluster the embedding. - Aggregate cell-level expression into metacell-level expression (sum over
layers["counts"]if present, else.X). - Build per-metacell summary (size, dominant
--celltype-keylabel). - Save metacell AnnData, tables, figures,
report.md,result.json.
Gotchas
--method seacellssilently auto-falls back tokmeansif SEACells isn't installed.sc_metacell.py:326-332catchesImportErrorfromimport SEACellsand logs a warning, then setsargs.method = "kmeans". The actually-used method is recorded inresult.json["method"](the post-fallback value), but the request-vs-execute distinction isn't preserved as separate keys here. Inspect logs / report.md to confirm.- All preflight failures
raise SystemExit(1), notValueError.sc_metacell.py:113raisesSystemExit(1)whenobsm[--use-rep]is missing (with available-embedding hint);:123raises when--n-metacells >= n_cells(with a sane suggested value);:128raises when--n-metacells < 2;:340raisesSystemExit("Provide --input or use --demo"). Wrappers expectingValueErrorneed to catchSystemExit. processed.h5adis the cell-level AnnData with metacell labels — NOT the metacell-aggregated AnnData.sc_metacell.py:463saves the originaladata(withobs["metacell"]added) toprocessed.h5ad;sc_metacell.py:393writes the aggregated metacell-shapemadatatotables/metacells.h5ad. Downstream skills likesc-de/sc-enrichment(advertised in the next-step block atsc_metacell.py:534-535) consumeprocessed.h5ad, not the aggregated shape — passtables/metacells.h5adexplicitly when you actually need per-metacell rows.- Aggregation prefers
layers["counts"]over.X. The preflight warns iflayers["counts"]is absent (sc_metacell.py:131-134); when it's missing the script aggregates from.X(typically log-normalised) which is mathematically less defensible than summing raw counts. --celltype-keydefaults toleiden.sc_metacell.py:77defaults toleiden; if your AnnData has labels under a different key (e.g.,cell_type), pass--celltype-key cell_typeso the per-metacell "dominant cell type" column is meaningful.
Key CLI
# Demo
python omicsclaw.py run sc-metacell --demo --output /tmp/sc_metacell_demo
# Default SEACells, 30 metacells
python omicsclaw.py run sc-metacell \
--input clustered.h5ad --output results/
# KMeans (fast, no SEACells dependency)
python omicsclaw.py run sc-metacell \
--input clustered.h5ad --output results/ \
--method kmeans --n-metacells 50
# Use Harmony-corrected embedding + custom celltype key
python omicsclaw.py run sc-metacell \
--input integrated.h5ad --output results/ \
--use-rep X_harmony --celltype-key cell_type --n-metacells 100
# More refinement iterations for SEACells (slower, smoother archetypes)
python omic
Установить sc-metacell в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл sc-metacell?
Load when aggregating single cells into metacells (sample-aware coarse-grained pseudo-cells) on a normalised scRNA AnnData via SEACells or KMeans on a low-D embedding. Skip when ranking marker genes per cluster (use sc-markers) or for trajectory pseudotime ordering (use sc-pseudotime).
Как установить скилл sc-metacell?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл sc-metacell запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic