[meta]
name = "macs2"
category = "epigenomics"
description = "Model-based Analysis for ChIP-Seq — peak caller for ChIP-seq and ATAC-seq experiments"
tags = ["chip-seq", "atac-seq", "peak-calling", "epigenomics", "chromatin", "histone", "transcription-factor"]
author = "oxo-call built-in"
source_url = "https://macs3-project.github.io/MACS/"

[context]
concepts = [
    "MACS2 models the ChIP enrichment pattern to distinguish true peaks from background noise.",
    "Use 'macs2 callpeak' as the main subcommand; -t for treatment (ChIP/ATAC); -c for control (input/IgG).",
    "Use -g hs for human (hg19/hg38) or -g mm for mouse; these set effective genome sizes for q-value calculation.",
    "Use --broad for histone marks with broad enrichment (H3K27me3, H3K9me3); default is narrow peaks (TFs, H3K4me3).",
    "ATAC-seq: use --nomodel --shift -100 --extsize 200 for nucleosome-free regions; or MACS3 for native ATAC support.",
    "Output files: <name>_peaks.narrowPeak or <name>_peaks.broadPeak, <name>_summits.bed, <name>_peaks.xls.",
    "Use -q 0.05 (default) for FDR threshold or -p 1e-5 for p-value threshold.",
    "For paired-end ATAC-seq, use -f BAMPE to call peaks from fragment size distribution.",
]

pitfalls = [
    "Forgetting -c (input control) leads to high false positive rates in ChIP-seq — always include input/IgG control.",
    "Using -g for the wrong organism gives incorrect q-values — match genome size to your reference.",
    "For ATAC-seq, using default ChIP-seq parameters without --nomodel/shift adjustment misses NFR peaks.",
    "MACS2 expects single-end BAM by default; for paired-end BAM use -f BAMPE.",
    "The narrowPeak format columns 7-9 are enrichment and signalValue; column 10 is peak summit offset from start.",
    "Without --keep-dup auto, MACS2 removes duplicates — for ATAC-seq use --keep-dup all after separate dedup.",
]

[[examples]]
task = "call narrow peaks from ChIP-seq data with input control"
args = "callpeak -t chip.bam -c input.bam -f BAM -g hs -n sample_chip -q 0.05 --outdir chip_peaks/"
explanation = "-t treatment; -c control; -g hs for human; -n output name prefix; -q FDR threshold"

[[examples]]
task = "call broad peaks for histone mark (H3K27me3) ChIP-seq"
args = "callpeak -t h3k27me3.bam -c input.bam -f BAM -g hs --broad --broad-cutoff 0.1 -n h3k27me3 --outdir broad_peaks/"
explanation = "--broad for histone marks with diffuse enrichment; --broad-cutoff 0.1 for broad peak FDR threshold"

[[examples]]
task = "call ATAC-seq peaks using nucleosome-free region model"
args = "callpeak -t atac.bam -f BAM -g hs --nomodel --shift -100 --extsize 200 -n atac_sample -q 0.05 --outdir atac_peaks/"
explanation = "--nomodel --shift -100 --extsize 200 is the standard ATAC-seq NFR peak calling setting"

[[examples]]
task = "call peaks from paired-end ATAC-seq BAM"
args = "callpeak -t atac_pe.bam -f BAMPE -g hs -n atac_pe_sample -q 0.05 --outdir atac_pe_peaks/"
explanation = "-f BAMPE uses actual fragment sizes from paired-end BAM; better for ATAC-seq peak calling"

[[examples]]
task = "call peaks without control for ATAC-seq open chromatin"
args = "callpeak -t atac.bam -f BAM -g hs --nomodel --shift -100 --extsize 200 --keep-dup all -n open_chromatin --outdir atac_out/"
explanation = "--keep-dup all prevents duplicate removal (do separately if needed); no -c for ATAC without control"
