agentsclimarketplace

Peak calling

Skill BioTender-max/awesome-bio-agent-skills/skills/bioskills/peak-calling

Calls ChIP-seq peaks with MACS3, MACS2, HOMER, or SPP across narrow (TF) and broad (histone) modes. Handles input control matching, fragment-size modeling vs --nomodel, effective genome size, ENCODE-style IDR vs naive overlap, hyper-ChIPable artifacts, and aligner-specific shifts. Use when calling peaks from ChIP-seq alignments, choosing between narrow vs broad mode for a histone mark, deciding model vs nomodel for low-depth data, applying ENCODE pseudoreplicate IDR, or reconciling MACS vs HOMER vs SPP results.From its SKILL.md

Install
npx -y skills add BioTender-max/awesome-bio-agent-skills --skill peak-calling

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

19.5 KB, ~5.3k tokens by cl100k_base, as published. Nobody here has run it

Version Compatibility

Reference examples tested with: MACS3 3.0.4+, MACS2 2.2.9+, HOMER 4.11+, SPP 1.16+, samtools 1.19+, bedtools 2.31+, IDR 2.0.4+.

Before running, verify versions: <tool> --version and <tool> --help to confirm flags. If a flag is missing, check the changelog — MACS2->MACS3 is API-compatible for callpeak but predictd, bdgpeakcall, and hmmratac differ.

ChIP-seq Peak Calling

"Identify protein-DNA binding sites from ChIP-seq alignments" -> Detect statistically enriched genomic regions by comparing IP signal to input control (or genomic background), with peak shape (narrow/broad) determined by target biology (TF vs histone mark).

  • CLI (ENCODE TF default): macs2 callpeak -t chip.bam -c input.bam -f BAM -g hs -n sample --keep-dup all -p 1e-2
  • CLI (ENCODE histone default): same with --broad --broad-cutoff 0.1 for H3K27me3, H3K9me3, H3K36me3
  • CLI (alternative): macs3 callpeak ... (API-identical, active development), HOMER findPeaks tags/ -style histone -i input_tags/, SPP via phantompeakqualtools wrapper

ENCODE TF pipeline still uses SPP for peak ranking + IDR, with MACS2 producing the signal tracks. Histone pipeline uses MACS2 + naive overlap (IDR is too conservative for histone signal dynamic range). MACS3 is the actively maintained successor; MACS2 receives only bug fixes.

Critical Pre-Call Validation

Before any peak calling, three things must be true or the output is unreliable:

  1. Antibody validated — KO/KD orthogonal control, peptide-array specificity for histone modifications, or vendor-provided CRISPR-validated lot (Epicypher, CST). "ChIP-grade" marketing is not validation. See chipseq-qc.
  2. Fragment-size distribution is sane — TF ChIP should show sub-nucleosomal (~50-100 bp) enrichment; histone ChIP should show clean mono- (~150) and di-nucleosomal (~300) peaks. Flat distribution = over-sonication; rescue is impossible. Check via samtools view -f 0x2 sample.bam | awk '{print $9}' | sort | uniq -c.
  3. Input control matches — Sonicated input is biased toward open chromatin; MNase input toward nucleosomes. Input from a different library prep batch or fragmentation method introduces bias that subtraction cannot fix.

Algorithmic Taxonomy

ToolModelTreats fragments asStrengthFails when
MACS3/MACS2 callpeakDynamic local Poisson (max of genome-wide, 1kb, 5kb, 10kb lambda) + BH-FDRSingle-end shifts; PE fragments via BAMPEMature, fast, ENCODE-default, narrow + broad modes, integrated signal tracksConfounds NFR with broad accessible domains; default narrow mode segments broad enrichment; assumes most genome NOT enriched (breaks for genome-wide marks)
SPP (Kharchenko 2008)Strand cross-correlation peak detection + Poisson fold-enrichmentSingle-end with cross-corr-derived shiftENCODE TF caller; integrated NSC/RSC QC; robust for sharp TF peaksUnderperforms for broad marks; older R codebase; phantompeakqualtools wrapper has R-version compatibility issues
HOMER -style factorFixed-width peaks + three sequential filters (control / local / clonal)Tag positions; auto-estimated widthFast on tag directories; clonal filter -C removes PCR-artifact peaksLess calibrated p-values; fixed width clips variable-width factor binding
HOMER -style histoneVariable-width region stitching (500 bp blocks, 1000 bp gap merging); L=0 (no local enrichment)Tag positionsCaptures variable-width histone enrichment; Omnipeak 2025 benchmark: outperforms -style factor for ALL histone marks including H3K4me3Less sensitive than MACS for very sharp TF binding
Genrich -y (ChIP mode)q-value on log-transformed p-value, joint replicate modelWhole fragments (PE intervals)Joint replicate analysis; chrM exclusion via -e chrM; auto blacklist via -ELess peer-reviewed than MACS/SPP; thin literature; control handling less mature
MACS3 hmmratac3-state HMM on fragment-size signalFragment-size classesBest for ATAC, not ChIPWrong tool for ChIP; ChIP fragment-size distribution doesn't drive useful HMM states
SEACR (Meers 2019)Empirical threshold on signal block totalsBedgraph signal blocksDesigned for sparse CUT&RUN/CUT&Tag data; "stringent" mode with IgG strongly preferredNot for traditional ChIP-seq (assumes near-zero background); see cut-and-run-tag
LanceOtron (Hentges 2022)CNN trained on ENCODE peaksbigWig signalCompetitive for both narrow and broad without parameter tuningNewer; less validated; web-only or pip install

For CUT&RUN / CUT&Tag specifically, see chip-seq/cut-and-run-tag — protocol differences (lower depth, IgG-only control, E. coli spike-in carryover) drive different caller choice (MACS2 + SEACR consensus, not MACS3 alone).

Decision: Narrow vs Broad

Driven by target biology, not preference. Calling broad mode does not make a sharp signal broad; it changes how MACS stitches adjacent enrichment.

TargetModeWhy
Transcription factors (CTCF, p53, GATA1, FOXA1)Narrow (default)Discrete motif binding produces sharp peaks
H3K4me3, H3K27ac at promoters/enhancersNarrowLocalized at regulatory elements
H3K4me1 at enhancersNarrow or broad-cutoff 0.1Variable; check published data for the cell type
H3K36me3, H3K79me2 (elongation)BroadDeposited across active gene bodies (5-50 kb domains)
H3K27me3, H3K9me3 (repressive)BroadSpread across 10-100+ kb domains
H4K20me3 (constitutive het)BroadHeterochromatin domains
Pol II (RNAPII)Narrow at promoter + broad option for elongation profileTwo separate analyses if doing elongation biology

For HOMER: use -style histone for ALL histone marks (Omnipeak 2025 benchmark, btaf375); -style factor ONLY for transcription factors.

Decision: Model vs --nomodel

MACS2/3 fragment-size modeling needs ≥100 paired plus/minus enrichment regions within --mfold (default [5, 50]). Silent failure produces wrong fragment size and warped peaks — always inspect _model.r output.

ConditionModel?Fallback
Whole-genome, ≥1M treatment reads, narrow TFYes--mfold 3 50 if fails
Paired-end with -f BAMPEN/AFragment size from mate pairs
Single chromosome or targeted captureNo--nomodel --extsize <data-derived or mark default>
Low read count (<500k)NoSame
Broad histone markEitherMark-type default if no estimate available

When --nomodel is required, choose --extsize in priority order: (1) cross-correlation estimate from phantompeakqualtools (ENCODE standard, gives NSC/RSC simultaneously); (2) macs3 predictd -i chip.bam -g hs and read stderr; (3) mark-type fallback (147 for nucleosome-proximal marks, 200 for broader marks).

Effective Genome Size — Often Wrong, Always Matters

-g hs (2.7e9) and -g mm (1.87e9) are decade-old approximations. Modern read-length-matched values (deepTools effectiveGenomeSize table):

GenomeRead lengthEffective size
hg3850 bp2.913e9
hg3875 bp2.747e9
hg38100 bp2.701e9
hg38150 bp2.620e9
mm1050 bp2.652e9
mm10100 bp2.407e9

Wrong size shifts every q-value but rarely peak ranks. For subset data (single chromosome, targeted), provide numeric -g <bp>; the shorthand inflates lambda_BG by 60× and produces false positives at low-signal regions.

Hyper-ChIPable Regions Are a Persistent Artifact

Teytelman 2013 (PNAS) and Park 2013 (PLoS One) demonstrated that highly-transcribed genes (rRNA, tRNA, histone gene cluster, snoRNA hosts, mitochondrial-encoded genes, abundant housekeeping loci) appear "bound" in ChIP-seq with untagged GFP, no antibody, or non-existent targets. ENCODE blacklist v2 catches repeat-driven artifacts but NOT these hyper-ChIPable transcribed regions.

Always interpret peaks at rRNA loci, tRNA clusters, replication-dependent histone genes (HIST1/2 clusters), mitochondrial DNA, and the top-1% input-signal regions with skepticism. For rigorous claims: (1) require motif enrichment at the peak (artifact has no motif); (2) require KO/KD signal loss; (3) build a cell-type-specific blacklist from the top 1% of input signal and intersect-out.

Pipeline Reference: ENCODE TF vs Histone

TF pipeline (uses SPP for peak ranking):

# Per-replicate (loose) — IDR tightens downstream
macs2 callpeak -t rep1.tagAlign.gz -c input.tagAlign.gz \
    -f BED -g hs -n rep1 \
    --nomodel --shift 0 --extsize {fraglen_from_xcor} \
    --keep-dup all -B --SPMR -p 1e-2

# Repeat for rep2, pooled, and pseudoreplicates (split each rep into halves)
# Score peaks by signalValue, sort, run IDR (see Replicate Handling below)

Histone pipeline (uses MACS2 broad / narrow + naive overlap):

# Broad marks: H3K27me3, H3K9me3, H3K36me3
macs2 callpeak -t rep1.tagAlign.gz -c input.tagAlign.gz \
    -f BED -g hs -n rep1 \
    --broad --broad-cutoff 0.1 \
    --nomodel --shift 0 --extsize {fraglen} \
    --keep-dup all -B --SPMR -p 1e-2

# Naive overlap: a peak passes if it appears in ≥2 of N replicates
# with ≥40% reciprocal overlap (ENCODE default, often misquoted as 50%)
bedtools intersect -a rep1.broadPeak -b rep2.broadPeak -f 0.40 -r -u > naive_overlap.bed

--keep-dup all is intentional in the ENCODE pattern: duplicates were already filtered upstream by MarkDuplicates + samtools view -F 1804 -q 30. -p 1e-2 is permissive because IDR (TF) or overlap (histone) tightens downstream.

Replicate Handling: IDR vs Naive Overlap

ENCODE rules (Landt 2012 Genome Res):

TFs use IDR. Run on signal-ranked peaks (sort by -k8,8nr p-value; -k7,7nr signal works for SPP but breaks for MACS pile-up if libraries differ).

sort -k8,8nr rep1.narrowPeak > rep1.sorted
sort -k8,8nr rep2.narrowPeak > rep2.sorted

idr --samples rep1.sorted rep2.sorted \
    --input-file-type narrowPeak --rank p.value \
    --idr-threshold 0.05 --output-file true_reps.idr --plot

ENCODE Nself/Nt consistency rule (often misremembered):

  • Nt = IDR-passing peaks across true biological replicates (threshold 0.05)
  • Nself (per rep) = IDR-passing peaks across pseudoreplicates of one library (threshold 0.10)
  • Library passes if max(N1self, N2self) / min(N1self, N2self) ≤ 2 AND max(Nt, max(Nself)) / min(Nt, min(Nself)) ≤ 2
  • Both ratios > 2: library rejected

Histones use naive overlap. IDR's high-vs-low-rank assumption breaks for histone dynamic range. Naive overlap: pool peaks, require each to appear in ≥2 replicates with ≥40% reciprocal overlap.

ENCODE 3 vs ENCODE 4 Differences

FeatureENCODE 3ENCODE 4
TF peak rankerSPPSPP (unchanged)
Histone callerMACS2MACS2 (MACS3 not yet adopted)
Alignerbwa-membwa-mem (chromap evaluated; not yet swapped)
Blacklistv1 (Hoffman 2013)v2 (Amemiya 2019)
TF significance-p 1e-2 + IDR @ 0.05Same
Histone significance-p 1e-2 + naive overlapSame
Effective genome sizehs/mm shorthanddeepTools read-length-tabulated
Pseudoreplicate IDR threshold0.10 self-consistency0.10 self-consistency

ENCODE 4 outputs are NOT numerically comparable to ENCODE 3 on the same BAM (blacklist change + genome size update shift peak counts ~3-10%).

Per-Tool Failure Modes

MACS2/3 -- Silent fragment-size model failure

Trigger: Sparse signal, low replicate depth, or saturated samples; _model.r plot never inspected.

Mechanism: Model needs ≥100 paired plus/minus enriched regions in --mfold range. Below threshold, MACS picks an arbitrary fragment size (often 50 or 1000 bp), producing miscentered or oversized peaks. Stderr shows a warning that gets ignored.

Symptom: Peak summits shifted relative to known motif positions by hundreds of bp; visual inspection in IGV shows peaks displaced from pile-up centers.

Fix: Inspect <sample>_model.r — if peaks look reasonable, accept; if degenerate, widen with --mfold 3 50 or switch to --nomodel --extsize <data-derived>. For consistency across samples in a study, always use --nomodel --extsize {fraglen} with cross-correlation-derived fraglen (ENCODE pattern).

MACS2/3 -- Confounded narrow vs broad on intermediate marks

Trigger: Marks of intermediate breadth (H3K4me1, H3K9ac) called with default narrow mode.

Mechanism: Default narrow mode fragments wide enrichment into multiple sub-peaks; --broad over-stitches.

Symptom: Peak count 3-5× higher than published for same cell type; mean peak width < 200 bp at known enhancer regions.

Fix: For H3K4me1, try --broad --broad-cutoff 0.1 and compare; for H3K9ac, narrow mode typically OK. Always cross-reference published peak counts for the cell type and antibody lot.

MACS2/3 -- --call-summits double-counts

Trigger: Narrow mode + --call-summits flag.

Mechanism: MACS adds sub-peak summits at multi-mode pile-ups; broad-shouldered peaks get split into 2-3 entries.

Symptom: Peak count inflated; same genomic region appears as 2-3 adjacent peaks in narrowPeak output.

Fix: Drop --call-summits unless deliberately analyzing multi-mode binding (rare); merge bedtools merge -d 200 if needed post-hoc.

HOMER -- Wrong style for histones

Trigger: -style factor used for histone marks.

Mechanism: Factor mode uses fixed-width peaks with local enrichment filter -L 4 that eliminates broad signal.

Symptom: Far fewer peaks than expected for H3K4me3/H3K27ac/H3K27me3; missed enrichment at known regions.

Fix: Use -style histone for ALL histone marks (Omnipeak 2025); reserve -style factor for TFs only.

SPP / phantompeakqualtools -- R version incompatibility

Trigger: Running phantompeakqualtools wrapper script with R ≥ 4.0.

Mechanism: spp R package has unmaintained dependencies; some functions silently fail or return NaN for NSC/RSC.

Fix: Use conda env pinned to R 3.6 + spp 1.16; or use kundajelab/phantompeakqualtools fork (current); or substitute deepTools plotFingerprint for QC and MACS-derived fragment length.

chromap aligner -- Pre-applied shift double-counts

Trigger: Using chromap (fast aligner) output as MACS input with --shift -75 --extsize 150.

Mechanism: chromap pre-applies a Tn5/cut-site shift before fragment output (designed for ATAC); ChIP cut-site reasoning doesn't apply but the shift still happens silently.

Symptom: Peaks shifted ~5-10 bp from bwa-mem output at the same locus.

Fix: When using chromap, drop downstream shift OR use chromap's --no-correction. For ChIP, bwa-mem or bowtie2 are safer defaults until ENCODE switches.

Reconciliation: When Callers Disagree

PatternLikely causeAction
MACS finds peak; HOMER missesHOMER local-enrichment filter (-L 4) removed it at low-signal regions; or -style factor clipped a histone peakRe-run HOMER with -style histone -L 0 for histones; if persists, trust MACS
HOMER finds peak; MACS missesClonal filter -C 2 retained PCR artifact peaks; or HOMER's auto-width captured something MACS narrow mode segmentedCheck if MACS broad mode rescues; check IGV for visual confirmation
SPP and MACS narrow peaks differ by 10-50 bp summitDifferent fragment-size estimates (SPP uses cross-corr; MACS models from data)Use same fragment size for both: ENCODE pattern --nomodel --extsize {xcor_fraglen}
MACS narrow + MACS broad on same data: 10× peak count differenceExpected — broad mode stitches subpeaks within 1 kb gapUse narrow for differential analysis (consistent units); broad for domain annotation
Per-rep MACS calls peak; pooled MACS does notOne replicate dominates; pooling smooths local lambdaTrust pooled + IDR over per-replicate counts
Replicate count differs >2×One replicate failedCheck FRiP, NSC, library complexity per replicate; do NOT average — drop the failing replicate or repeat

Operational rule for publication-grade: TFs require IDR ≤ 0.05 on true reps AND Nt/Nself ratios ≤ 2. Histones require naive overlap ≥2 reps with ≥40% reciprocal overlap. Both require FRiP, NSC, RSC, and library complexity thresholds met. See chipseq-qc.

Common Errors

Error / symptomCauseSolution
0 peaks calledWrong genome size on subset data; wrong -f for input format; swapped treatment/controlProvide numeric -g; match -f to file type (BAM/BAMPE/BED); verify -t is enriched sample
Peak count >> 500kDid not deduplicate; chrM not removed; -q too loose; hyper-ChIPable artifacts dominateFilter samtools view -F 1804 -q 30; remove chrM; tighten to -q 0.01; blacklist top-1% input regions
Peaks shifted from motif by ~75 bp--shift not set for -f BAM; or fragment-size model wrongAdd --shift 0 --extsize {fraglen}; or check _model.r
--shift/--extsize ignored warningUsed -f BAMPE with these flagsSwitch to -f BAM for ENCODE pattern, or accept that BAMPE uses true fragment spans
IDR returns 0 reproducible peaksSorted by wrong column; ranks effectively randomsort -k8,8nr (p-value descending) on each peakset
Naive overlap returns few peaksSet -f 0.5 -r (50% reciprocal) — too strictUse -f 0.40 -r (ENCODE default)
FRiP < 1%Bad ChIP (antibody, fragmentation, depth); peaks called on noiseRe-validate antibody with KO/KD; check fragment-size distribution; do not proceed

References

  • Park PJ 2009 Nat Rev Genet 10:669 (foundational review)
  • Landt SG et al 2012 Genome Res 22:1813 (ENCODE/modENCODE guidelines, IDR Nself rule)
  • Zhang Y et al 2008 Genome Biol 9:R137 (MACS)
  • Kharchenko PV et al 2008 Nat Biotechnol 26:1351 (SPP)
  • Heinz S et al 2010 Mol Cell 38:576 (HOMER)
  • Li Q et al 2011 Ann Appl Stat 5:1752 (IDR framework)
  • Teytelman L et al 2013 PNAS 110:18602 (hyper-ChIPable regions)
  • Park D et al 2013 PLoS One 8:e83506 (independent hyper-ChIPable confirmation)
  • Amemiya HM et al 2019 Sci Rep 9:9354 (ENCODE blacklist v2)
  • ENCODE ChIP-seq pipeline v2.1.6 (github.com/ENCODE-DCC/chip-seq-pipeline)
  • Omnipeak benchmark 2025 Nucleic Acids Res (HOMER -style histone vs factor mode for histone marks; cited via publisher's bioinformatics aggregation)

Related Skills

  • chip-seq/chipseq-qc - Fragment-size diagnostic, FRiP, NSC/RSC, antibody validation
  • chip-seq/cut-and-run-tag - SEACR + MACS for CUT&RUN/CUT&Tag (different QC, lower depth)
  • chip-seq/spike-in-normalization - When global signal shifts expected (HDACi, BETi, EZH2i)
  • chip-seq/differential-binding - DiffBind/csaw downstream of peak calling
  • chip-seq/peak-annotation - Annotate peaks to genes and cCREs
  • chip-seq/motif-analysis - Discover and scan binding motifs in peaks
  • chip-seq/super-enhancers - Stitch H3K27ac peaks into super-enhancer calls
  • atac-seq/atac-peak-calling - ATAC-specific shift/extend; no input control
  • alignment-files/sam-bam-basics - Pre-call BAM filtering and deduplication
  • genome-intervals/interval-arithmetic - Peak intersection and overlap

What ships with it: 2 files

16.6 KB alongside SKILL.md, 1 of them executable

examples/

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.