$npx -y skills add GPTomics/bioSkills --skill differential-accessibilityIdentify differentially accessible chromatin regions across conditions using DiffBind, csaw, DESeq2, or edgeR. Use when comparing ATAC-seq accessibility between treatment groups, choosing between consensus-peak vs sliding-window approaches, picking the correct normalization (full
| 1 | ## Version Compatibility |
| 2 | |
| 3 | Reference examples tested with: DiffBind 3.12+, DESeq2 1.42+, edgeR 4.0+, csaw 1.36+, limma 3.58+, GenomicRanges 1.54+, ChIPseeker 1.38+, Subread 2.0+ (featureCounts), sva 3.50+, RUVSeq 1.36+. |
| 4 | |
| 5 | Before using code patterns, verify installed versions match: |
| 6 | - R: `packageVersion('<pkg>')` then `?function_name` to verify parameters |
| 7 | |
| 8 | If code throws unexpected errors, introspect the installed package and adapt rather than retrying. |
| 9 | |
| 10 | # Differential Accessibility |
| 11 | |
| 12 | **"Find chromatin regions that change accessibility between my conditions"** -> Build a sample-by-region count matrix, normalize for library size and chromatin compaction, fit a generalized linear model (negative-binomial), and extract regions with significant accessibility change. |
| 13 | |
| 14 | - R (consensus-peak workflow): `DiffBind` -> count -> normalize -> contrast -> analyze |
| 15 | - R (window-based, no peak set): `csaw::windowCounts` + `filterWindowsGlobal` + edgeR QL F-test |
| 16 | - R (existing peak-count matrix): `DESeq2` or `edgeR` directly on `featureCounts` output |
| 17 | |
| 18 | DiffBind is a wrapper around DESeq2 / edgeR with ATAC-aware defaults. csaw is the only peak-free option; it tests fixed-width sliding windows. The choice depends on whether peaks are stable across conditions (use DiffBind) or whether some condition has dramatically different peak structure (use csaw or rebuild consensus peaks). |
| 19 | |
| 20 | ## Algorithmic Taxonomy |
| 21 | |
| 22 | | Tool | Model | Input | Min reps | Strength | Fails when | |
| 23 | |------|-------|-------|----------|----------|------------| |
| 24 | | DiffBind 3.x (default DESeq2) | NB GLM via DESeq2 on consensus peaks | BAM + peak files | 2-3 per group | ATAC-aware defaults; built-in QC; blocking factors. Default in 3.x is `normalize=DBA_NORM_LIB` with `library=DBA_LIBSIZE_FULL` (full library size, background-included) | Peaks differ dramatically between conditions (closed -> open shifts width); fewer than 2 reps per group | |
| 25 | | DiffBind with edgeR backend | NB GLM via edgeR-QL on consensus peaks | Same | 2-3 per group | Robust at low replicates (n=2 OK); QL test calibrates dispersion better than DESeq2 at small n | When global accessibility shifts dominate, switch to spike-in or full-library (library=DBA_LIBSIZE_FULL), never reads-in-peaks | |
| 26 | | DESeq2 directly on peak counts | NB GLM with shrinkage | featureCounts SAF | 3+ | Maximum control; integrates with apeglm shrinkage; modern interface | Need to manually build consensus peakset; per-region pre-filter required (low counts inflate dispersion) | |
| 27 | | edgeR QL F-test on peak counts | NB QL (quasi-likelihood) | featureCounts | 2 | Calibrated FDR at low n (n=2 viable); robust to outlier reps | Manual consensus peakset; small library bias unless normalization explicit | |
| 28 | | csaw (windows) | edgeR-QL on sliding windows | BAM only | 2 | No peak set required; detects diffuse changes peaks miss; merges adjacent windows | Computationally heavy; window size choice biases results; harder to annotate downstream | |
| 29 | | limma-voom | linear model with mean-variance trend | log2(CPM+offset) | 3 | Fast; good calibration at moderate count | Mis-calibrated at very low counts (atac peaks often have dropouts); needs explicit voom normalization | |
| 30 | |
| 31 | Methodology evolves; verify the current consensus practice (Gontarz 2020 DA-strategy benchmark; Reske 2020 normalization comparison) before locking pipelines. |
| 32 | |
| 33 | ## Decision Tree by Experimental Scenario |
| 34 | |
| 35 | | Scenario | Recommended workflow | Why | |
| 36 | |----------|---------------------|-----| |
| 37 | | 3+ reps, similar peak structure across conditions | DiffBind (DESeq2 backend), `summits=250`, `normalize=DBA_NORM_NATIVE` | Standard pattern; peak-level inference is interpretable | |
| 38 | | 2 reps per condition | DiffBind with edgeR backend OR raw edgeR QL | DESeq2 underpowered at n=2; QL is robust | |
| 39 | | Peak structure differs dramatically (e.g., differentiation, KO of pioneer TF) | csaw windows OR rebuild consensus peakset post-hoc per condition then take union | Stable consensus peakset is invalid when chromatin landscape shifts | |
| 40 | | Multi-factor design (batch, sex, time) | DiffBind with `dba.contrast(..., design='~Batch + Condition')` | Standard linear model adjustment | |
| 41 | | Hidden batch / unknown variance | DESeq2 + SVA OR RUVseq before fitting | Empirical surrogate variables capture unknown nuisance | |
| 42 | | Long timecourse (5+ time points) | DESeq2 LRT (likelihood ratio test) on `~time + condition + time:condition` | Captures temporal interaction; use `differential-expression/timeseries-de` patterns | |
| 43 | | Diffuse / broad ac |