$npx -y skills add GPTomics/bioSkills --skill atac-peak-callingCall accessible chromatin regions from ATAC-seq BAM files using MACS3, MACS2, Genrich, or HMMRATAC. Use when identifying open chromatin from aligned ATAC-seq, choosing between point-source vs HMM peak callers, applying ENCODE-style pseudoreplicate IDR, removing blacklist regions,
| 1 | ## Version Compatibility |
| 2 | |
| 3 | Reference examples tested with: MACS3 3.0.2+, MACS2 2.2.9+, Genrich 0.6.1+, HMMRATAC 1.2+ (now bundled in MACS3 as `macs3 hmmratac`), samtools 1.19+, bedtools 2.31+, IDR 2.0.4+. |
| 4 | |
| 5 | Before using code patterns, verify installed versions match. If versions differ: |
| 6 | - CLI: `<tool> --version` then `<tool> --help` to confirm flags |
| 7 | |
| 8 | If code throws unexpected errors, introspect the installed binary (`<tool> -h`) and adapt the example to match the actual CLI rather than retrying. |
| 9 | |
| 10 | # ATAC-seq Peak Calling |
| 11 | |
| 12 | **"Call accessible regions from my ATAC-seq BAM"** -> Identify Tn5-hypersensitive open chromatin, treating fragments as point insertion events (not protein-bound regions as in ChIP-seq) and accounting for the lack of input control. |
| 13 | |
| 14 | - CLI (canonical, ENCODE 4): `macs2 callpeak -t atac.bam -f BAM -g hs -n sample --nomodel --shift -75 --extsize 150 --keep-dup all -B --SPMR -p 0.01` (use `-f BAM`, not `-f BAMPE` -- BAMPE reads true fragment ends and ignores `--shift`/`--extsize`) |
| 15 | - CLI (HMM-based, single sample): `macs3 hmmratac -i atac.bam -n sample --outdir hmm_out` |
| 16 | - CLI (joint replicates): `Genrich -j -t rep1.bam,rep2.bam -o peaks.narrowPeak -e chrM -E blacklist.bed` |
| 17 | |
| 18 | The `-p 0.01` (loose) plus IDR is the ENCODE pattern: low stringency increases peak overlap between replicates, and IDR rescues the reproducible set. Single-sample workflows usually swap to `-q 0.05` instead. |
| 19 | |
| 20 | ## Algorithmic Taxonomy |
| 21 | |
| 22 | | Tool | Model | Treats fragments as | Min reps | Strength | Fails when | |
| 23 | |------|-------|---------------------|----------|----------|------------| |
| 24 | | MACS3/MACS2 | Local Poisson lambda + FDR | Point-source insertions (+/- shift) | 1 | Mature, ENCODE-default, fast, narrow + broad modes | Confounds NFR with broad accessible domains; no input means lambda from local genome only | |
| 25 | | Genrich (ATAC mode -j) | q-value on log-transformed p-value, joint replicate model | Whole fragments (paired-end intervals) | 1 (multi-rep optional) | Treats reps jointly; can exclude chrM via `-e chrM`; auto blacklist via `-E`; PCR-dup removal via `-r` | Less peer-reviewed than MACS; thin literature; slow on deep libraries | |
| 26 | | MACS3 hmmratac (was HMMRATAC) | 3-state HMM (open / nucleosomal / background) on fragment-size signal | Fragment-size classes | 1 | Models nucleosome periodicity directly; differentiates NFR and flanking nucleosomes | Needs >= 30M de-duplicated nuclear reads; memory-hungry; slow; flat fragment distribution -> garbage HMM | |
| 27 | | HOMER `findPeaks -style dnase` | Fixed window + fold-change cutoff | Tag positions | 1 | Convenient for downstream HOMER motif analysis | Less calibrated p-values than MACS; window-size sensitive | |
| 28 | | nf-core/atacseq | Wrapper (MACS2 by default) | Same as MACS2 | 1 | Reproducible Nextflow pipeline with QC built in | Only as good as the underlying caller | |
| 29 | |
| 30 | Methodology evolves; verify the current ENCODE ATAC-seq Standards (encodeproject.org pipelines/atac-seq) before locking parameters. ENCODE 4 still defaults to MACS2 (not MACS3) at time of writing; `macs3 callpeak` is API-compatible for ATAC parameters but not yet the official ENCODE binary. |
| 31 | |
| 32 | ## Shift-Extend vs BAMPE: The Critical Choice |
| 33 | |
| 34 | Two valid ways to feed paired-end ATAC into MACS: |
| 35 | |
| 36 | **Pattern A (ENCODE / "single-end-ified"):** `-f BAMPE` actually IGNORES `--shift/--extsize`. To activate them, use `-f BAM` and treat each end independently. ENCODE's pipeline uses `-f BAM --shift -75 --extsize 150` to model each Tn5 cut as a 150 bp window centered on the insertion site, ignoring fragment lengths. |
| 37 | |
| 38 | **Pattern B (paired-fragment):** `-f BAMPE` uses the full paired-end fragment span as the signal interval. Best when fragment lengths are biologically meaningful (e.g., NFR-only peak calling at 38/75 bp). In BAMPE mode, do NOT set `--shift/--extsize` (silently ignored, but confusing). |
| 39 | |
| 40 | For most bulk ATAC, Pattern A matches ENCODE convention and is reproducible against published peak sets. Pattern B can be more sensitive at narrow regulatory elements but does not match ENCODE outputs. |
| 41 | |
| 42 | ## Effective Genome Size |
| 43 | |
| 44 | `-g hs` and `-g mm` are MACS shorthands for old defaults. Modern values: |
| 45 | |
| 46 | | Genome | MACS shorthand | Actual mappable size | Source | |
| 47 | |--------|---------------|----------------------|--------| |
| 48 | | hg38 | `-g hs` (2.7e9) | 2.701e9 (50bp), 2.748e9 (75bp), 2.806e9 (100bp), 2.862e9 (150bp) | deepTools `effectiveGenomeSize` | |
| 49 | | hg19 | `-g hs` (2.7e9) | 2.686e9 (50bp), 2.777e9 (100bp) | deepTools | |
| 50 | | mm10 | `-g mm` (1.87e9) | 2.308e9 (50bp), 2.408e9 (75bp), 2.467e9 (100bp) | deepTools | |
| 51 | | mm39 | no |