batch-effect-correction
Agent skill fromaipoch/medical-research-skills
Use when correcting batch effects in merged bulk expression matrices with sample-level batch metadata while preserving biological group structure and generating before-and-after QC plots. NOT for: single-cell integration, raw FASTQ processing, differential expression without batch labels, or datasets without biological groups.
How to install batch-effect-correction
install batch-effect-correction
# install the medical-research-skills pack with the skills CLI
npx skills add aipoch/medical-research-skills# or add only this skill to Claude Code: copy the folder
awesome-med-research-skills/Data Analysis/batch-effect-correction/
# into
~/.claude/skills/batch-effect-correction/ (all projects)
.claude/skills/batch-effect-correction/ (one project)
1# Batch Effect Correction23## Prerequisites45Run the following before the first analysis to install all required R packages:67```bash8Rscript -e "if (!require('BiocManager', quietly=TRUE)) install.packages('BiocManager'); BiocManager::install(c('sva', 'limma')); install.packages('ggplot2', repos='https://cloud.r-project.org')"9```1011> Note: `sva` and `limma` are Bioconductor packages and require `BiocManager` for installation. `ggplot2` is a standard CRAN package.1213**The skill cannot run until these packages are installed.** In new or bare R environments, always run the prerequisite step first.1415---1617## When to Read External Files1819| Situation | File to Read | Purpose |20|-----------|--------------|---------|21| **Need algorithm details** | `references/algorithm.md` | ComBat workflow, assumptions, and QC logic |22| **Need to run analysis** | `scripts/main.R` | Execute: `Rscript scripts/main.R --input_file ... --group_file ...` |23| **Encounter errors** | `references/troubleshooting.md` | Common errors and solutions |24| **Need CLI examples** | `references/cli-guide.md` | Detailed CLI usage examples and baseline run record |25| **Need test data** | `tests/data/` | Sample input files for testing |2627---2829## Usage3031```bash32Rscript scripts/main.R \33 --input_file ./expression_matrix.csv \34 --group_file ./sample_info.csv \35 --output_dir ./output/ \36 --batch_column batch \37 --group_column group \38 --sample_column sample \39 --log_transform auto \40 --timeout_seconds 600 \41 --seed 4242…
Excerpt shown under the repository's MIT license.
