bulkrna-batch-correction
БесплатноБез исполняемых скриптовНе проверенLoad when removing batch effects from a multi-cohort bulk RNA-seq dataset using ComBat (R or Python implementation). Skip if there is only one batch, or for…
от mdbabumiamssm★ 36 звёзд на GitHubОб этом скилле
bulkrna-batch-correction
When to use
Run when bulkrna-qc PCA or sample-correlation heatmap reveals samples
clustering by batch (cohort, sequencing run, library prep date) rather
than by biology. Applies ComBat — preferring the R sva implementation
when available, falling back to a Python port.
Inputs & Outputs
| Input | Format | Required |
|---|---|---|
| Expression matrix | .csv (gene × sample) |
yes (or --demo) |
| Batch metadata | --batch-info CSV (sample, batch cols) |
yes (or --demo) |
--mode |
parametric or non-parametric |
default parametric |
| Output | Path | Notes |
|---|---|---|
| Corrected matrix | tables/corrected_expression.csv |
same shape, batch effect removed |
| PCA before correction | figures/pca_before_correction.png |
per-sample colour-coded by batch |
| PCA after correction | figures/pca_after_correction.png |
same layout, post-ComBat |
| Batch assessment | figures/batch_assessment.png |
side-by-side comparison + silhouette delta |
| Batch metrics | tables/batch_metrics.csv |
silhouette score before/after |
| Report | report.md + result.json |
summary keys: n_genes, n_samples, n_batches, batch_names, mode, silhouette_before, silhouette_after |
Flow
- Load expression matrix + batch metadata.
- Try R
sva::ComBatfirst; on import failure, fall back to Python ComBat (bulkrna_batch_correction.py:427warns "R ComBat not available (...); using Python fallback."). - The Python fallback short-circuits with a warning at
:165("Only 1 batch detected; returning data unchanged.") when--batch-infodescribes a single batch. The R path has no equivalent guard. - Render before/after PCA; emit corrected table, batch-metrics table, and report.
Gotchas
- Single-batch input is a silent no-op (Python fallback only).
bulkrna_batch_correction.py:165returns the input unchanged with a warning when only one batch is detected — but only when the Python ComBat path runs. The Rsva::ComBatpath at:421does not have this guard, so a single-batch run on an R-equipped system may proceed with nonsense output. Verifyresult.json["n_batches"]≥ 2 before trusting downstream results. - R vs Python ComBat give numerically different results.
:427's silent fallback to the Python port can produce per-gene corrected values that differ at the 3rd decimal from Rsva— usually inconsequential for downstream DE but visible in direct value comparisons. The chosen backend is not recorded in the summary dict; only the warning log distinguishes them. - ComBat assumes the biological design is balanced across batches. If condition X is only in batch 1 and condition Y is only in batch 2, ComBat will remove the biology along with the batch effect. No automatic check — sanity-cross-tabulate
condition × batchbefore running, and consider including condition as a covariate in a more sophisticated tool (limma::removeBatchEffect) if confounded. - Negative output values are normal for ComBat-on-counts. ComBat operates in log-space and returns gene-by-sample matrices that can contain negative values after back-transform. Do NOT pipe
corrected_expression.csvintobulkrna-de(which expects non-negative integer counts) — use the corrected matrix only for visualisation, clustering, or co-expression analysis. - Silhouette score interpretation is direction-of-improvement, not absolute.
silhouette_before/silhouette_after(inresult.jsonandbatch_metrics.csv) measure batch clustering tightness. A drop indicates batch effect has been reduced; absolute values depend on how separable the batches were originally.
Key CLI
python omicsclaw.py run bulkrna-batch-correction --demo
python omicsclaw.py run bulkrna-batch-correction \
--input counts.csv --batch-info batches.csv --output results/
python omicsclaw.py run bulkrna-batch-correction \
--input counts.csv --batch-info batches.csv --output results/ \
--mode non-parametric
See also
references/parameters.md— every CLI flag and tuning hintreferences/methodology.md— parametric vs non-parametric ComBat, R↔Python differences, design-confound caveatsreferences/output_contract.md— exact output directory layout- Adjacent skills:
bulkrna-qc(run upstream to spot batch effects),bulkrna-coexpression/bulkrna-survival(downstream — corrected matrix safe for these),bulkrna-de(NOT downstream-safe — DE always wants raw counts),sc-batch-integration(single-cell sibling: Harmony/scVI/etc.)
Установить bulkrna-batch-correction в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл bulkrna-batch-correction?
Load when removing batch effects from a multi-cohort bulk RNA-seq dataset using ComBat (R or Python implementation). Skip if there is only one batch, or for single-cell batch integration (use sc-batch-integration), or for spatial multi-slice integration (use spatial-integrate).
Как установить скилл bulkrna-batch-correction?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bulkrna-batch-correction запускает скрипты?
Нет, скилл состоит только из инструкций (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