# Differential Expression Analysis

Use when analyzing bulk RNA-seq or microarray expression data to identify...

- Repository: https://github.com/aipoch/medical-research-skills (2020 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-09-17
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add aipoch/medical-research-skills --skill differential-expression-analysis -g -a claude-code -y`
Codex: `npx skills add aipoch/medical-research-skills --skill differential-expression-analysis -g -a codex -y`
Cursor: `npx skills add aipoch/medical-research-skills --skill differential-expression-analysis -g -a cursor -y`
Gemini CLI: `npx skills add aipoch/medical-research-skills --skill differential-expression-analysis -g -a gemini-cli -y`

## Description

Use when analyzing bulk RNA-seq or microarray expression data to identify differentially expressed genes between two biological groups (case vs control), with volcano plots and heatmap visualization. NOT for:single-cell RNA-seq, methylation analysis, non-expression data.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

> **Source**: [https://github.com/aipoch/medical-research-skills](https://github.com/aipoch/medical-research-skills)

# Differential Expression Analysis

## When to Read External Files

| Situation | File to Read | Purpose |
|-----------|--------------|---------|
| **Need algorithm details** | `references/algorithm.md` | Statistical methods, formulas, assumptions |
| **Need to run analysis** | `scripts/main.R` | Execute: `Rscript scripts/main.R --input_file ... --group_file ...` |
| **Encounter errors** | `references/troubleshooting.md` | Common errors and solutions |
| **Need CLI examples** | `references/cli-guide.md` | Detailed CLI usage examples |
| **Need test data** | `tests/data/` | Sample input files for testing |

---

## Usage

```bash
Rscript scripts/main.R \
  --input_file ./expression_matrix.csv \
  --group_file ./group_info.csv \
  --output_dir ./output/ \
  --diff_method limma \
  --p_threshold 0.05 \
  --logfc_threshold 0.1 \
  --seed 42
```

---

## Arguments

| Short | Long | Type | Default | Description |
|-------|------|------|---------|-------------|
| `-i` | `--input_file` | character | **required** | Expression matrix file (genes as rows, samples as columns) |
| `-g` | `--group_file` | character | **required** | Group information file (sample ID + group columns) |
| `-o` | `--output_dir` | character | `./output/` | Output directory |
| `-m` | `--diff_method` | character | `limma` | Method: limma, deseq2, edger, t, wilcox |
| `-n` | `--norm_method` | character | `TMM` | Normalization for edgeR: TMM, RLE, upperquartile |
| `-p` | `--p_threshold` | numeric | `0.05` | P-value threshold |
| `-f` | `--logfc_threshold` | numeric | `0.1` | Log fold change threshold |
| `-s` | `--seed` | integer | `42` | Random seed for reproducibility |

---

## Input Format

### Expression Matrix (input_file)

Genes as rows, samples as columns, CSV format with gene ID in first column.

The rest: https://github.com/aipoch/medical-research-skills/blob/HEAD/awesome-med-research-skills/Data Analysis/differential-expression-analysis/SKILL.md
