Tooluck logoTooluck
SKILL.md

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)

awesome-med-research-skills/Data Analysis/batch-effect-correction/SKILL.md

MITFull file
1# Batch Effect Correction
2
3## Prerequisites
4
5Run the following before the first analysis to install all required R packages:
6
7```bash
8Rscript -e "if (!require('BiocManager', quietly=TRUE)) install.packages('BiocManager'); BiocManager::install(c('sva', 'limma')); install.packages('ggplot2', repos='https://cloud.r-project.org')"
9```
10
11> Note: `sva` and `limma` are Bioconductor packages and require `BiocManager` for installation. `ggplot2` is a standard CRAN package.
12
13**The skill cannot run until these packages are installed.** In new or bare R environments, always run the prerequisite step first.
14
15---
16
17## When to Read External Files
18
19| 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 |
26
27---
28
29## Usage
30
31```bash
32Rscript 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 42
42…

Excerpt shown under the repository's MIT license.

More skills in medical-research-skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates