bulkrna-batch-correction
Batch effect correction for multi-cohort bulk RNA-seq data using ComBat, with PCA-based visualization before and after correction.
от mdbabumiamssm★ 36 звёзд на GitHub
Установить bulkrna-batch-correction в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Bulk RNA-seq Batch Effect Correction
Remove batch effects from multi-cohort bulk RNA-seq expression matrices using the ComBat algorithm (parametric and non-parametric modes), with PCA-based visualization and quantitative assessment.
Core Capabilities
- Parametric and non-parametric ComBat batch correction
- Built-in empirical Bayes implementation (no external R dependency)
- PCA visualization before and after correction with batch coloring
- Quantitative batch-effect metrics: silhouette score, kBET-like metric
- Export corrected expression matrices in CSV format
- Automatic batch detection from sample naming conventions
Why This Exists
- Without it: Users must install R, load the
svapackage, manually create model matrices, runComBat(), and export corrected data back to Python — a multi-step cross-language workflow. - With it: A single Python command performs batch correction on CSV expression matrices and generates before/after PCA plots with quantitative batch-mixing metrics.
- Why OmicsClaw: Pure Python ComBat implementation integrated into the OmicsClaw reporting framework, with automated batch-effect assessment.
Algorithm / Methodology
ComBat (Johnson et al., 2007)
- Standardize expression data by gene (subtract mean, divide by std)
- Estimate batch-specific location and scale parameters
- Apply empirical Bayes shrinkage to batch parameter estimates
- Adjust expression values to remove batch effects while preserving biological variation
Parametric vs Non-parametric
- Parametric (default): Assumes normal distribution for batch effects; faster
- Non-parametric: Uses kernel density estimation; more robust for non-normal batch effects
PCA Assessment
- PCA on log2(CPM+1) transformed data, colored by batch label
- Silhouette score: measures how well batches cluster (lower = better mixing after correction)
Input Formats
| Format | Extension | Description |
|---|---|---|
| Expression matrix | .csv |
Genes as rows, samples as columns; first column is gene identifiers |
| Batch metadata | .csv |
Two columns: sample and batch (or auto-detected from sample names) |
CLI Reference
python omicsclaw.py run bulkrna-batch-correction --demo
python omicsclaw.py run bulkrna-batch-correction --input expr.csv --batch-info batches.csv --output results/
python bulkrna_batch_correction.py --input expr.csv --batch-info batches.csv --output results/
python bulkrna_batch_correction.py --demo --output /tmp/batch_demo
Workflow
- Load: Read expression matrix and batch metadata (or auto-detect batches from sample names).
- Assess: PCA and batch-mixing metrics on uncorrected data.
- Correct: Apply ComBat (parametric or non-parametric mode).
- Validate: PCA and batch-mixing metrics on corrected data.
- Compare: Side-by-side before/after PCA visualization.
- Export: Corrected expression matrix, figures, and report.
Output Structure
output_directory/
├── report.md
├── result.json
├── figures/
│ ├── pca_before_correction.png
│ ├── pca_after_correction.png
│ └── batch_assessment.png
├── tables/
│ ├── corrected_expression.csv
│ └── batch_metrics.csv
└── reproducibility/
└── commands.sh
Parameters
| Parameter | Default | Description |
|---|---|---|
--input |
— | Path to expression matrix CSV |
--batch-info |
— | Path to batch metadata CSV (sample, batch columns) |
--output |
— | Output directory |
--mode |
parametric |
ComBat mode: parametric or non-parametric |
--demo |
— | Run with auto-generated demo data |
Safety
- Local-first: All processing runs locally; no data is uploaded.
- Disclaimer: Every report includes the standard OmicsClaw disclaimer.
- Audit trail: Parameters and batch assignments are recorded in result.json.
Integration with Orchestrator
Trigger conditions: Automatically invoked when user intent matches batch correction, ComBat, harmonization keywords.
Chaining partners:
bulkrna-qc— Upstream: count matrix QCbulkrna-de— Downstream: DE analysis on corrected databulkrna-coexpression— Downstream: co-expression on corrected data
Citations
- ComBat — Johnson et al., Biostatistics 2007
Dependencies
Required: numpy, pandas, scipy, matplotlib
Related Skills
bulkrna-qc— Count matrix QC upstreambulkrna-de— Differential expression on corrected data
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл bulkrna-batch-correction?
Batch effect correction for multi-cohort bulk RNA-seq data using ComBat, with PCA-based visualization before and after correction.
Как установить скилл bulkrna-batch-correction?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bulkrna-batch-correction запускает скрипты?
Нет, скилл состоит только из инструкций (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…