[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EEE2VN51RSCMZ6JJ57VM3F":3,"skill-same:01M7EEE2VN51RSCMZ6JJ57VM3F":66},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":14,"repositoryHtmlUrl":33,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":35,"install":36,"resources":49},"01M7EEE2VN51RSCMZ6JJ57VM3F","bio-methylation-dmr-detection",null,"Detects differentially methylated regions (DMRs) from short-read bisulfite (WGBS\u002FRRBS), array, and long-read methylation count tables using dmrseq (permutation region-FDR over the region selection), DSS callDMR (beta-binomial), methylKit tiles, bsseq BSmooth, DMRcate Gaussian-kernel smoothing, metilene, and comb-p. Covers why a DMR is DEFINED by arbitrary thresholds (min-CpGs, max-gap, delta-beta, q) and a smoothing bandwidth, why selecting extreme runs of CpGs then testing them on the same data is post-selection inference, why region q-values are not comparable across tools, and a single-sample domain-segmentation section (PMD, UMR\u002FLMR, MethylSeekR, solo-WCGW) that must run before focal calling on cancer\u002Faging genomes. Use when calling region-level methylation differences, choosing a DMR caller, controlling region-level FDR, or segmenting megabase methylation domains. For per-site testing see differential-cpg-testing; for the methylKit object model see methylkit-analysis.","Mr-Nobody-Anonymous\u002FAll-skills","Mr-Nobody-Anonymous","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184253119?v=4","01M7AEXFJHKTYQW5R0ZCQQTWFV","anonymous","01M7C00M3GQR4QKP9GZA42GFAK",0,"MIT","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-methylation-dmr-detection\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-methylation-dmr-detection\ndescription: Detects differentially methylated regions (DMRs) from short-read bisulfite (WGBS\u002FRRBS), array, and long-read methylation count tables using dmrseq (permutation region-FDR over the region selection), DSS callDMR (beta-binomial), methylKit tiles, bsseq BSmooth, DMRcate Gaussian-kernel smoothing, metilene, and comb-p. Covers why a DMR is DEFINED by arbitrary thresholds (min-CpGs, max-gap, delta-beta, q) and a smoothing bandwidth, why selecting extreme runs of CpGs then testing them on the same data is post-selection inference, why region q-values are not comparable across tools, and a single-sample domain-segmentation section (PMD, UMR\u002FLMR, MethylSeekR, solo-WCGW) that must run before focal calling on cancer\u002Faging genomes. Use when calling region-level methylation differences, choosing a DMR caller, controlling region-level FDR, or segmenting megabase methylation domains. For per-site testing see differential-cpg-testing; for the methylKit object model see methylkit-analysis.\ntool_type: r\nprimary_tool: dmrseq\nsource: \"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills\"\nsource_repository: \"GPTomics\u002FbioSkills\"\nsource_path: \"methylation-analysis\u002Fdmr-detection\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n\n## Version Compatibility\n\nReference examples tested with: dmrseq 1.22+, DSS 2.50+, methylKit 1.28+, bsseq 1.38+, DMRcate 2.16+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\n- CLI: `\u003Ctool> --version` then `\u003Ctool> --help` to confirm flags\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\nThe GENOME BUILD is a version that matters. methylKit\u002Fbsseq\u002FDMRcate `assembly=` is metadata, but annotation packages (`annotatr::build_annotations(genome='hg38')`, `TxDb.Hsapiens.UCSC.hg38.knownGene`) are build-specific and must match the alignment genome. DMRcate `arraytype='EPIC'`\u002F`'450K'` and the IlluminaHumanMethylation annotation package set the array CpG universe. DMRcate defaults shift across Bioconductor releases (the `C` kernel scaling has no single default - it is platform-dependent); confirm with `?dmrcate` on the installed build.\n\n# DMR Detection\n\n**\"Find differentially methylated regions\"** -> Detect candidate regions, then score them with a null that re-ran the selection - because a DMR is defined by a chain of thresholds, not found, and only a selection-aware q-value is honest.\n- R: `dmrseq(bs, testCovariate='condition')` (selection-aware) ; `DSS::callDMR()`, `methylKit::tileMethylCounts()`, `bsseq` BSmooth, `DMRcate::dmrcate()` (combine-and-correct)\n\nScope: REGION-level differential methylation from any per-CpG methylation+coverage table (WGBS\u002FRRBS counts, array beta\u002FM, long-read modkit bedMethyl), plus single-sample domain segmentation. Per-site DMC\u002FDMP testing -> differential-cpg-testing. The methylKit import\u002Ffilter\u002Funite object model -> methylkit-analysis. Long-read MM\u002FML calling that produces the counts -> long-read-sequencing\u002Fnanopore-methylation. Functional enrichment of DMR genes -> pathway-analysis\u002Fgo-enrichment (with the CpG-bias correction noted below).\n\n## The Single Most Important Modern Insight -- A DMR Is DEFINED, Not Found, and the Region p-Value Is Only Honest If Its Null Re-Ran the Selection\n\nThe naive recipe - compute a per-CpG statistic, select runs of CpGs that look extreme to DEFINE candidate regions, then test those same regions and report a p\u002Fq on the same data - reuses the data twice. The regions were CHOSEN because they were extreme; scoring them with the data that selected them inflates significance and produces uncalibrated region FDR. This is post-selection inference, the field's original sin. No error is thrown; the q-values just lie. Three corollaries:\n\n1. **dmrseq neutralizes the selection; the others combine-and-correct but do not re-select.** dmrseq (Korthauer 2019 *Biostatistics* 20:367) builds the null by PERMUTING the condition labels and RE-RUNNING the entire candidate-detection procedure on each permutation, pooling permuted region statistics into one genome-wide null - so its q-value is on REGIONS and accounts for selection. comb-p and DMRcate combine existing per-CpG p-values (Stouffer\u002FFisher\u002FSLK) and apply a region multiplicity correction, but never re-run selection. methylKit tiles use FIXED windows (boundaries not chosen from the data, so the selection part is sidestepped) but ignore inter-tile correlation. DSS callDMR merges significant CpGs (threshold-then-define).\n\n2. **Region q-values are NOT comparable across tools.** \"I found 4,000 DMRs at q\u003C0.05\" is meaningless without naming the tool and what its q controls. Cross-tool OVERLAP is the real evidence - run two callers and intersect.\n\n3. **Thresholds are conventions, not biology.** delta-beta 25%, min-CpGs 3, max-gap 1000bp, q\u003C0.01 are tutorial folklore. The same data yields radically different DMR sets under different settings. Report and justify every knob; never present one config as correct.\n\nOrganize the analysis around defending these, not around listing functions.\n\n## Tool Taxonomy\n\n| Tool | Citation | Mechanism \u002F role | When |\n|------|----------|------------------|------|\n| dmrseq | Korthauer 2019 *Biostatistics* 20:367 | GLS area statistic + permutation null that re-runs selection; smooths the difference internally | headline WGBS inference; calibrated region FDR; >=2 reps\u002Fgroup |\n| DSS callDMR | Feng 2014 *Nucleic Acids Res* 42:e69; Park & Wu 2016 *Bioinformatics* 32:1446 | per-CpG Bayesian beta-binomial dispersion shrinkage, then merge significant CpGs | small n, complex\u002Fmulti-factor designs; low-coverage with smoothing |\n| methylKit tiles | Akalin 2012 *Genome Biol* 13:R87 | fixed windows + logistic\u002FF test per tile | fast RRBS\u002FWGBS screening; reuses the methylKit object model |\n| bsseq (BSmooth) | Hansen 2012 *Genome Biol* 13:R83 | per-sample local-likelihood smoothing -> smoothed t-statistic | low\u002Funeven-coverage WGBS; superseded by dmrseq for calibrated FDR |\n| DMRcate | Peters 2015 *Epigenetics Chromatin* 8:6; Peters 2021 *Nucleic Acids Res* 49:e109 | Gaussian-kernel smoothing of the per-CpG statistic | arrays (450K\u002FEPIC) and WGBS (different kernel) |\n| metilene | Juhling 2016 *Genome Res* 26:256 | binary segmentation + 2D Kolmogorov-Smirnov; standalone C CLI | fast whole-genome second caller; data-adaptive boundaries; tolerates missingness |\n| comb-p | Pedersen 2012 *Bioinformatics* 28:2986 | ACF + Stouffer-Liptak-Kechris combination + Sidak; Python CLI on any p-values | array EWAS regions; tool-agnostic corroboration of any per-CpG p-values |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended | Why |\n|----------|-------------|-----|\n| WGBS, >=2 reps\u002Fgroup, headline region inference | dmrseq | only caller whose region FDR accounts for selection |\n| WGBS, small n, multi-factor \u002F covariates | DSS (`DMLtest.multiFactor` -> `callDMR`) | beta-binomial dispersion shrinkage + model formula |\n| Low \u002F uneven coverage WGBS | dmrseq (smooths internally) or DSS `smoothing=TRUE` | smoothing borrows strength across CpGs |\n| RRBS, quick region screen | methylKit tiles (filtered, `cov.bases>=3`) | fixed windows; fast; CpG-island enriched; screening q, not selection-corrected |\n| EPIC\u002F450K array | DMRcate array mode (`cpg.annotate('array')`) or comb-p on limma p | kernel tuned for array spacing; methylKit\u002Fbsseq\u002Fdmrseq are count-based |\n| Corroborate any DMR set | run a second caller, intersect | region q is not comparable across tools |\n| Cancer \u002F aging \u002F placenta \u002F cultured-cell WGBS | segment PMDs FIRST (see domain section) | a focal caller manufactures fake hypo-DMRs from PMD background |\n| Per-CpG, not region | -> differential-cpg-testing | site-level test before aggregating to regions |\n| Long-read modkit bedMethyl input | -> long-read-sequencing\u002Fnanopore-methylation, then any caller here | modkit calls; feed Nmod + Nvalid_cov here for region statistics |\n\n## dmrseq: The Selection-Aware Headline Caller\n\n**Goal:** Call WGBS DMRs with a region-level FDR that survives the region-selection step.\n\n**Approach:** Build a `BSseq` object from raw counts (do NOT pre-smooth), filter loci with zero coverage in any sample, then run `dmrseq`, which detects candidate regions (runs of CpGs whose smoothed methylation-difference coefficient exceeds `cutoff`), computes one GLS area statistic per region, and generates the null by permuting labels and re-running detection.\n\n```r\nlibrary(dmrseq)\nlibrary(bsseq)\n\nbs \u003C- read.bismark(c('ctrl1.cov.gz', 'ctrl2.cov.gz', 'treat1.cov.gz', 'treat2.cov.gz'),\n                   colData = DataFrame(condition = c('ctrl', 'ctrl', 'treat', 'treat')),\n                   rmZeroCov = TRUE, strandCollapse = TRUE)\n\n# dmrseq requires every locus to have non-zero coverage in EVERY sample.\nbs \u003C- bs[rowSums(getCoverage(bs) == 0) == 0, ]\n\n# cutoff=0.1 only SEEDS candidate detection (10% smoothed difference); significance\n# comes from the permutation statistic, so dmrseq does NOT hard-threshold delta-beta.\ndmrs \u003C- dmrseq(bs, testCovariate = 'condition', cutoff = 0.1)\nsig \u003C- dmrs[dmrs$qval \u003C 0.05]   # qval is a REGION FDR that accounts for selection\n```\n\ndmrseq smooths the DIFFERENCE internally (`bpSpan`\u002F`minInSpan`\u002F`maxGapSmooth`); running `BSmooth()` first double-smooths and invalidates the model. The permutation null is COARSE at 2-vs-2 (few distinct label permutations) - the package pools across all candidate regions to compensate, but more replicates give a finer null. Use `adjustCovariate` for nuisance variables and `block = TRUE` for large-scale differential blocks.\n\n## DSS: Beta-Binomial Dispersion Shrinkage\n\n**Goal:** Call DMRs with per-CpG dispersion shrinkage for small n or a multi-factor design.\n\n**Approach:** `DMLtest` does per-CpG Wald tests with a Bayesian beta-binomial dispersion estimate, then `callDMR` merges significant CpGs into regions.\n\n```r\nlibrary(DSS)\n\nbs \u003C- makeBSseqData(list(c1, c2, t1, t2), c('C1', 'C2', 'T1', 'T2'))   # each: chr\u002Fpos\u002FN\u002FX data.frame\ndml \u003C- DMLtest(bs, group1 = c('C1', 'C2'), group2 = c('T1', 'T2'), smoothing = TRUE)   # TRUE for low-cov WGBS\n\n# callDMR defaults (verify on installed build): delta=0, p.threshold=1e-5,\n# minlen=50, minCG=3, dis.merge=100, pct.sig=0.5.\n# delta=0 means NO effect-size floor - SET it explicitly so tiny shifts are not called.\ndmrs \u003C- callDMR(dml, delta = 0.1, p.threshold = 1e-5, minlen = 50, minCG = 3,\n                dis.merge = 100, pct.sig = 0.5)   # pct.sig=0.5: >=50% of region CpGs individually significant\n```\n\ncallDMR merges significant CpGs (threshold-then-define), so its region p is NOT selection-corrected; its strengths are dispersion shrinkage and multi-factor support (`DMLtest.multiFactor` with a model formula).\n\n## bsseq BSmooth\n\n**Goal:** Call DMRs on low\u002Funeven-coverage WGBS by smoothing each sample before testing.\n\n**Approach:** Smooth per sample, compute the smoothed t-statistic, then threshold it into regions.\n\n```r\nlibrary(bsseq)\n\nbs_smooth \u003C- BSmooth(bs, BPPARAM = MulticoreParam(4), verbose = TRUE)\nkeep \u003C- rowSums(getCoverage(bs_smooth) >= 2) == ncol(bs_smooth)   # >=2x in every sample\nbs_filt \u003C- bs_smooth[keep, ]\n\ntstat \u003C- BSmooth.tstat(bs_filt, group1 = c('C1', 'C2'), group2 = c('T1', 'T2'),\n                       estimate.var = 'same', mc.cores = 4)\ndmrs \u003C- dmrFinder(tstat, cutoff = c(-4.6, 4.6))   # t-stat cutoff (Hansen 2012 uses quantile-based cutoffs)\n```\n\n`dmrFinder` needs `BSmooth.tstat` output, not the smoothed `BSseq` object directly. BSmooth gives a RANKED DMR list, not a calibrated region FDR - dmrseq (same lab lineage) supersedes it for region inference. Over-smoothing (too-wide bandwidth) washes out focal promoter DMRs.\n\n## DMRcate: The Array-vs-WGBS Fork\n\n**Goal:** Call DMRs by Gaussian-kernel smoothing of the per-CpG statistic, with the correct kernel for the platform.\n\n**Approach:** Annotate per-CpG statistics through the array OR sequencing entry point, then smooth and extract.\n\n```r\nlibrary(DMRcate)\n\n# ARRAY (450K\u002FEPIC): beta\u002FM matrix; arraytype sets the CpG universe.\ndesign \u003C- model.matrix(~ condition)\nann_array \u003C- cpg.annotate('array', m_values, what = 'M', arraytype = 'EPIC',\n                          analysis.type = 'differential', design = design, coef = 2)\ndmrs_array \u003C- extractRanges(dmrcate(ann_array, lambda = 1000, C = 2))   # array kernel\n\n# WGBS: different entry point AND a much smaller kernel - the array C=2 over-smooths\n# dense sequencing CpGs ~25x. Annotate from a count\u002FedgeR-DSS path, then C=50.\nann_seq \u003C- sequencing.annotate(bs, design = design, coef = 2)\ndmrs_seq \u003C- extractRanges(dmrcate(ann_seq, C = 50))   # WGBS kernel (Peters 2021)\n```\n\nThe default `lambda=1000, C=2` is ARRAY-only; applying it to WGBS produces massively over-smoothed, merged, inflated DMRs. `pcutoff='fdr'` returns no DMRs if the upstream limma\u002FDSS yields no significant CpGs.\n\n## metilene and comb-p (Second Callers)\n\nmetilene is a standalone C CLI taking one tab table (chrom, pos, per-sample methylation rate); binary segmentation + a 2D-KS test find data-adaptive boundaries. comb-p is a Python CLI that takes a BED of per-CpG p-values from ANY upstream test, estimates the p-value autocorrelation, does a Stouffer-Liptak-Kechris combination of neighbors, groups regions, and applies a one-step Sidak correction.\n\n```bash\nmetilene -M 1000 -m 10 -d 0.1 -a g1 -b g2 input.tsv | metilene_output.pl   # -m min CpGs, -d min mean diff\ncomb-p pipeline -c 4 --seed 0.01 --dist 500 --step 50 -p out methyl_pvals.bed   # --seed = p to start a region\n```\n\nBoth combine-and-correct rather than re-select; use them as fast corroboration and intersect with dmrseq.\n\n## Thresholds Are Conventions; Region FDR Is Tool-Specific\n\nEvery caller exposes the same coupled knobs under different names: min-CpGs (`minNumRegion`\u002F`minCG`\u002F`-m`\u002F`min.cpgs`\u002F`cov.bases`), max-gap (`maxGap`\u002F`dis.merge`\u002F`-M`), delta-beta (`cutoff`\u002F`delta`\u002F`-d`\u002F`betacutoff`\u002F`difference`), and a significance cutoff. Shrinking max-gap, raising min-CpGs, and raising delta all reduce the DMR count, and the same data yields wildly different DMR sets. The phrase \"region-level FDR\" means three different objects: a selection-aware permutation FDR (dmrseq), a BH\u002FSidak correction on combined per-CpG p-values (DMRcate\u002Fcomb-p), or per-unit q on independent tiles\u002FCpGs (methylKit\u002FDSS). Report all knobs, name the tool, and use cross-tool overlap as the evidence statement.\n\n## DMR-to-Gene Mapping and the CpG-Density Enrichment Bias\n\n**Goal:** Interpret DMRs without inflating enrichment from CpG-rich genes.\n\n**Approach:** Annotate DMRs to features (annotatr returns one row per DMR-feature overlap; genomation collapses by precedence), then run enrichment with a method that corrects for CpG\u002Fprobe count.\n\n```r\nlibrary(annotatr)\nannots \u003C- build_annotations(genome = 'hg38', annotations = c('hg38_basicgenes', 'hg38_cpg_islands'))\ndmr_ann \u003C- annotate_regions(regions = sig, annotations = annots, ignore.strand = TRUE)   # one row per overlap\n\n# Enrichment: methylation has a CpG-density bias (CpG-rich genes harbor DMRs by chance),\n# so a plain hypergeometric GO test is biased. Use missMethyl goregion (probe\u002FCpG-bias-aware).\n# missMethyl::goregion(sig_ranges, all.cpg=..., collection='GO', array.type='EPIC')\n```\n\nA single DMR commonly overlaps or sits between several genes; mapping DMR -> gene (nearest TSS vs overlap vs within-X-kb) is a modeling choice that changes the gene list. Hand the corrected enrichment to pathway-analysis\u002Fgo-enrichment, flagging that methylation input needs a CpG-bias-aware method (missMethyl `gometh`\u002F`goregion`), not a generic hypergeometric test.\n\n## Single-Sample Domain Structure (NOT Differential)\n\nThis is a DIFFERENT problem from the focal between-group callers above. The mammalian methylome partitions at MEGABASE scale into Highly Methylated Domains (HMDs, ~80-90%, ordered) and Partially Methylated Domains (PMDs, ~40-70%, disordered, high-variance), and PMDs coincide with late replication, Lamina-Associated Domains, and the Hi-C B-compartment (Lister 2009 *Nature* 462:315; Berman 2012 *Nat Genet* 44:40). Cancer \"global hypomethylation\" is a DOMAIN phenomenon - focal CpG-island hypermethylation sitting ON a background of megabase PMD hypomethylation - not a focal one. Domain structure is a SINGLE-SAMPLE, structural question answered by SEGMENTERS, not by any between-group DMR caller (methylKit\u002FDSS\u002Fdmrseq\u002FDMRcate\u002Fmetilene\u002Fcomb-p have no single-sample segmentation mode).\n\n- **MethylSeekR** (Burger 2013 *Nucleic Acids Res* 41:e155) segments one WGBS methylome into UMRs (CpG-rich unmethylated = promoters\u002FCGIs), LMRs (CpG-poor low-methylated ~30% = distal enhancers), and PMDs. Pipeline: `readMethylome()` -> `plotAlphaDistributionOneChr()` (diagnostic: does the sample have PMDs?) -> `segmentPMDs()` (2-state Gaussian HMM, 101-CpG windows) -> `calculateFDRs()` -> `segmentUMRsLMRs(m=0.5, n=..., pmdGRanges=...)`. PMDs MUST be masked before UMR\u002FLMR calling or PMD disorder spawns spurious LMRs.\n- **solo-WCGW** (Zhou 2018 *Nat Genet* 50:591) - an isolated CpG in `[A\u002FT]CG[A\u002FT]` context - loses methylation fastest and most monotonically with cell division and is the most sensitive PMD\u002Fmitotic-clock readout, detecting PMD hypomethylation even in near-normal tissue. Quantify as the mean over the published common-PMD solo-WCGW CpG set, not as a DMR. See epigenetic-clocks for the broader clock taxonomy.\n\nThe warning: running a focal DMR caller on a PMD-bearing genome manufactures thousands of fake hypo-DMRs that are really one phenomenon - the PMD background shifting - chopped into pieces by the max-gap\u002Fmin-CpG knobs. Segment domains FIRST, then EXCLUDE PMD intervals from focal calling or STRATIFY every DMR by in-PMD vs out-of-PMD and report the fraction that is PMD background.\n\n## Per-Method Failure Modes\n\n### PMD background reported as DMRs\n**Trigger:** focal caller on tumor\u002Faged\u002Fplacenta\u002Fcultured WGBS without domain screening. **Mechanism:** megabase PMD hypomethylation chopped into pieces by max-gap\u002Fmin-CpG. **Symptom:** thousands of large hypo-DMRs in gene-desert, late-replicating, low-CpG-density coordinates. **Fix:** segment PMDs (MethylSeekR) first; exclude or stratify; report the PMD fraction.\n\n### Pre-smoothing before dmrseq\n**Trigger:** `BSmooth()` then feeding the smoothed object to `dmrseq`. **Mechanism:** dmrseq smooths the difference internally; pre-smoothing double-smooths. **Symptom:** distorted candidate regions and invalid statistics. **Fix:** feed dmrseq the raw `BSseq` counts.\n\n### DMRcate array defaults on WGBS\n**Trigger:** copying `lambda=1000, C=2` onto sequencing data. **Mechanism:** the array kernel is ~25x too wide for dense WGBS CpGs. **Symptom:** massively over-smoothed, merged, inflated DMRs. **Fix:** `sequencing.annotate()` + `C=50` for WGBS (Peters 2021).\n\n### Threshold-then-test reported as region FDR\n**Trigger:** greping runs of significant per-CpG calls and reporting the per-CpG q. **Mechanism:** the regions were selected for extremeness, then tested on the same data. **Symptom:** anti-conservative, uncalibrated region q. **Fix:** use dmrseq (selection-aware) for the headline; at minimum state that a tile\u002Fmerge q is a screening q.\n\n### Single-CpG tiles\n**Trigger:** `tileMethylCounts` at the default `cov.bases=0`. **Mechanism:** a window with one covered CpG becomes a \"DMR.\" **Symptom:** thousands of single-CpG noisy regions. **Fix:** set `cov.bases >= 3`.\n\n### Cross-tool count comparison\n**Trigger:** comparing \"N DMRs at q\u003C0.05\" between callers. **Mechanism:** each tool's q controls a different object. **Symptom:** apparent disagreement that is really an FDR-definition mismatch. **Fix:** compare OVERLAP, not counts.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|-----------|--------|-----------|\n| dmrseq `cutoff` 0.1 (candidate seed only) | Korthauer 2019 | seeds detection; significance is the permutation statistic, NOT a delta floor |\n| DSS `callDMR(delta=0)` default -> SET it | Park & Wu 2016; DSS docs | delta=0 calls regions with no effect-size floor; set ~0.1 to require a real shift |\n| min-CpGs per region 3-5 | convention | single-CpG \"regions\" are DMPs in disguise; trades sensitivity vs specificity |\n| delta-beta 25% (\"moderate\") | methylKit tutorial folklore | NOT derived; biologically meaningful delta is feature- and purity-dependent |\n| methylKit `tileMethylCounts(cov.bases>=3)` | nuance (default is 0) | the default 0 lets single-CpG tiles through |\n| coverage floor ~10x per CpG | field standard | a single-CpG beta below ~10x is a coin flip |\n| DMRcate WGBS `C=50` (array `C=2`) | Peters 2021 *Nucleic Acids Res* 49:e109 | dense WGBS CpGs need a far narrower kernel than array probes |\n| MethylSeekR `m=0.5`, FDR\u003C5% | Burger 2013 | methylation cutoff for hypomethylated regions; FDR target picks the CpG-count threshold n |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| dmrseq error about zero-coverage loci | a locus has 0 coverage in some sample | filter `rowSums(getCoverage(bs)==0)==0` first |\n| Thousands of huge hypo-DMRs in cancer WGBS | PMD background not segmented | MethylSeekR `segmentPMDs` first; exclude\u002Fstratify |\n| Over-merged WGBS DMRs with DMRcate | array kernel on sequencing | `sequencing.annotate()` + `C=50` |\n| `dmrFinder` errors on a smoothed object | needs `BSmooth.tstat` output | run `BSmooth.tstat` before `dmrFinder` |\n| DMRcate returns no DMRs | `pcutoff='fdr'` and no significant upstream CpGs | check the upstream limma\u002FDSS result first |\n| Biased GO enrichment of DMR genes | plain hypergeometric ignores CpG density | use missMethyl `goregion`\u002F`gometh` |\n\n## References\n\n- Korthauer K, Chakraborty S, Benjamini Y, Irizarry RA. 2019. Detection and accurate false discovery rate control of differentially methylated regions from whole genome bisulfite sequencing. *Biostatistics* 20:367-383.\n- Feng H, Conneely KN, Wu H. 2014. A Bayesian hierarchical model to detect differentially methylated loci from single nucleotide resolution sequencing data. *Nucleic Acids Res* 42:e69.\n- Park Y, Wu H. 2016. Differential methylation analysis for BS-seq data under general experimental design. *Bioinformatics* 32:1446-1453.\n- Hansen KD, Langmead B, Irizarry RA. 2012. BSmooth: from whole genome bisulfite sequencing reads to differentially methylated regions. *Genome Biol* 13:R83.\n- Akalin A, Kormaksson M, Li S, et al. 2012. methylKit: a comprehensive R package for the analysis of genome-wide DNA methylation profiles. *Genome Biol* 13:R87.\n- Peters TJ, Buckley MJ, Statham AL, et al. 2015. De novo identification of differentially methylated regions in the human genome. *Epigenetics Chromatin* 8:6.\n- Peters TJ, Buckley MJ, Chen Y, et al. 2021. Calling differentially methylated regions from whole genome bisulphite sequencing with DMRcate. *Nucleic Acids Res* 49:e109.\n- Juhling F, Kretzmer H, Bernhart SH, Otto C, Stadler PF, Hoffmann S. 2016. metilene: fast and sensitive calling of differentially methylated regions from bisulfite sequencing data. *Genome Res* 26:256-262.\n- Pedersen BS, Schwartz DA, Yang IV, Kechris KJ. 2012. Comb-p: software for combining, analyzing, grouping and correcting spatially correlated P-values. *Bioinformatics* 28:2986-2988.\n- Lister R, Pelizzola M, Dowen RH, et al. 2009. Human DNA methylomes at base resolution show widespread epigenomic differences. *Nature* 462:315-322.\n- Berman BP, Weisenberger DJ, Aman JF, et al. 2012. Regions of focal DNA hypermethylation and long-range hypomethylation in colorectal cancer coincide with nuclear lamina-associated domains. *Nat Genet* 44:40-46.\n- Zhou W, Dinh HQ, Ramjan Z, et al. 2018. DNA methylation loss in late-replicating domains is linked to mitotic cell division. *Nat Genet* 50:591-602.\n- Burger L, Gaidatzis D, Schubeler D, Stadler MB. 2013. Identification of active regulatory regions from DNA methylation data. *Nucleic Acids Res* 41:e155.\n\n## Related Skills\n\n- differential-cpg-testing - Per-site testing before region aggregation\n- methylkit-analysis - methylKit object model and tile construction\n- methylation-calling - Produces the input count tables\n- array-preprocessing - Array beta\u002FM-value input for DMRcate array mode\n- epigenetic-clocks - Mitotic-clock \u002F solo-WCGW overlap (domain section)\n- pathway-analysis\u002Fgo-enrichment - CpG-bias-aware enrichment of DMR genes (missMethyl gometh)\n- long-read-sequencing\u002Fnanopore-methylation - Pipe modkit bedMethyl counts here for region statistics\n- workflows\u002Fmethylation-pipeline - End-to-end bisulfite pipeline\n","## Version Compatibility\n\nReference examples tested with: dmrseq 1.22+, DSS 2.50+, methylKit 1.28+, bsseq 1.38+, DMRcate 2.16+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\n- CLI: `\u003Ctool> --version` then `\u003Ctool> --help` to confirm flags\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\nThe GENOME BUILD is a version that matters. methylKit\u002Fbsseq\u002FDMRcate `assembly=` is metadata, but annotation packages (`annotatr::build_annotations(genome='hg38')`, `TxDb.Hsapiens.UCSC.hg38.knownGene`) are build-specific and must match the alignment genome. DMRcate `arraytype='EPIC'`\u002F`'450K'` and the IlluminaHumanMethylation annotation package set the array CpG universe. DMRcate defaults shift across Bioconductor releases (the `C` kernel scaling has no single default - it is platform-dependent); confirm with `?dmrcate` on the installed build.\n\n# DMR Detection\n\n**\"Find differentially methylated regions\"** -> Detect candidate regions, then score them with a null that re-ran the selection - because a DMR is defined by a chain of thresholds, not found, and only a selection-aware q-value is honest.\n- R: `dmrseq(bs, testCovariate='condition')` (selection-aware) ; `DSS::callDMR()`, `methylKit::tileMethylCounts()`, `bsseq` BSmooth, `DMRcate::dmrcate()` (combine-and-correct)\n\nScope: REGION-level differential methylation from any per-CpG methylation+coverage table (WGBS\u002FRRBS counts, array beta\u002FM, long-read modkit bedMethyl), plus single-sample domain segmentation. Per-site DMC\u002FDMP testing -> differential-cpg-testing. The methylKit import\u002Ffilter\u002Funite object model -> methylkit-analysis. Long-read MM\u002FML calling that produces the counts -> long-read-sequencing\u002Fnanopore-methylation. Functional enrichment of DMR genes -> pathway-analysis\u002Fgo-enrichment (with the CpG-bias correction noted below).\n\n## The Single Most Important Modern Insight -- A DMR Is DEFINED, Not Found, and the Region p-Value Is Only Honest If Its Null Re-Ran the Selection\n\nThe naive recipe - compute a per-CpG statistic, select runs of CpGs that look extreme to DEFINE candidate regions, then test those same regions and report a p\u002Fq on the same data - reuses the data twice. The regions were CHOSEN because they were extreme; scoring them with the data that selected them inflates significance and produces uncalibrated region FDR. This is post-selection inference, the field's original sin. No error is thrown; the q-values just lie. Three corollaries:\n\n1. **dmrseq neutralizes the selection; the others combine-and-correct but do not re-select.** dmrseq (Korthauer 2019 *Biostatistics* 20:367) builds the null by PERMUTING the condition labels and RE-RUNNING the entire candidate-detection procedure on each permutation, pooling permuted region statistics into one genome-wide null - so its q-value is on REGIONS and accounts for selection. comb-p and DMRcate combine existing per-CpG p-values (Stouffer\u002FFisher\u002FSLK) and apply a region multiplicity correction, but never re-run selection. methylKit tiles use FIXED windows (boundaries not chosen from the data, so the selection part is sidestepped) but ignore inter-tile correlation. DSS callDMR merges significant CpGs (threshold-then-define).\n\n2. **Region q-values are NOT comparable across tools.** \"I found 4,000 DMRs at q\u003C0.05\" is meaningless without naming the tool and what its q controls. Cross-tool OVERLAP is the real evidence - run two callers and intersect.\n\n3. **Thresholds are conventions, not biology.** delta-beta 25%, min-CpGs 3, max-gap 1000bp, q\u003C0.01 are tutorial folklore. The same data yields radically different DMR sets under different settings. Report and justify every knob; never present one config as correct.\n\nOrganize the analysis around defending these, not around listing functions.\n\n## Tool Taxonomy\n\n| Tool | Citation | Mechanism \u002F role | When |\n|------|----------|------------------|------|\n| dmrseq | Korthauer 2019 *Biostatistics* 20:367 | GLS area statistic + permutation null that re-runs selection; smooths the difference internally | headline WGBS inference; calibrated region FDR; >=2 reps\u002Fgroup |\n| DSS callDMR | Feng 2014 *Nucleic Acids Res* 42:e69; Park & Wu 2016 *Bioinformatics* 32:1446 | per-CpG Bayesian beta-binomial dispersion shrinkage, then merge significant CpGs | small n, complex\u002Fmulti-factor designs; low-coverage with smoothing |\n| methylKit tiles | Akalin 2012 *Genome Biol* 13:R87 | fixed windows + logistic\u002FF test per tile | fast RRBS\u002FWGBS screening; reuses the methylKit object model |\n| bsseq (BSmooth) | Hansen 2012 *Genome Biol* 13:R83 | per-sample local-likelihood smoothing -> smoothed t-statistic | low\u002Funeven-coverage WGBS; superseded by dmrseq for calibrated FDR |\n| DMRcate | Peters 2015 *Epigenetics Chromatin* 8:6; Peters 2021 *Nucleic Acids Res* 49:e109 | Gaussian-kernel smoothing of the per-CpG statistic | arrays (450K\u002FEPIC) and WGBS (different kernel) |\n| metilene | Juhling 2016 *Genome Res* 26:256 | binary segmentation + 2D Kolmogorov-Smirnov; standalone C CLI | fast whole-genome second caller; data-adaptive boundaries; tolerates missingness |\n| comb-p | Pedersen 2012 *Bioinformatics* 28:2986 | ACF + Stouffer-Liptak-Kechris combination + Sidak; Python CLI on any p-values | array EWAS regions; tool-agnostic corroboration of any per-CpG p-values |\n\n## Decision Tree by Scenario\n\n| Scenario | Recommended | Why |\n|----------|-------------|-----|\n| WGBS, >=2 reps\u002Fgroup, headline region inference | dmrseq | only caller whose region FDR accounts for selection |\n| WGBS, small n, multi-factor \u002F covariates | DSS (`DMLtest.multiFactor` -> `callDMR`) | beta-binomial dispersion shrinkage + model formula |\n| Low \u002F uneven coverage WGBS | dmrseq (smooths internally) or DSS `smoothing=TRUE` | smoothing borrows strength across CpGs |\n| RRBS, quick region screen | methylKit tiles (filtered, `cov.bases>=3`) | fixed windows; fast; CpG-island enriched; screening q, not selection-corrected |\n| EPIC\u002F450K array | DMRcate array mode (`cpg.annotate('array')`) or comb-p on limma p | kernel tuned for array spacing; methylKit\u002Fbsseq\u002Fdmrseq are count-based |\n| Corroborate any DMR set | run a second caller, intersect | region q is not comparable across tools |\n| Cancer \u002F aging \u002F placenta \u002F cultured-cell WGBS | segment PMDs FIRST (see domain section) | a focal caller manufactures fake hypo-DMRs from PMD background |\n| Per-CpG, not region | -> differential-cpg-testing | site-level test before aggregating to regions |\n| Long-read modkit bedMethyl input | -> long-read-sequencing\u002Fnanopore-methylation, then any caller here | modkit calls; feed Nmod + Nvalid_cov here for region statistics |\n\n## dmrseq: The Selection-Aware Headline Caller\n\n**Goal:** Call WGBS DMRs with a region-level FDR that survives the region-selection step.\n\n**Approach:** Build a `BSseq` object from raw counts (do NOT pre-smooth), filter loci with zero coverage in any sample, then run `dmrseq`, which detects candidate regions (runs of CpGs whose smoothed methylation-difference coefficient exceeds `cutoff`), computes one GLS area statistic per region, and generates the null by permuting labels and re-running detection.\n\n```r\nlibrary(dmrseq)\nlibrary(bsseq)\n\nbs \u003C- read.bismark(c('ctrl1.cov.gz', 'ctrl2.cov.gz', 'treat1.cov.gz', 'treat2.cov.gz'),\n                   colData = DataFrame(condition = c('ctrl', 'ctrl', 'treat', 'treat')),\n                   rmZeroCov = TRUE, strandCollapse = TRUE)\n\n# dmrseq requires every locus to have non-zero coverage in EVERY sample.\nbs \u003C- bs[rowSums(getCoverage(bs) == 0) == 0, ]\n\n# cutoff=0.1 only SEEDS candidate detection (10% smoothed difference); significance\n# comes from the permutation statistic, so dmrseq does NOT hard-threshold delta-beta.\ndmrs \u003C- dmrseq(bs, testCovariate = 'condition', cutoff = 0.1)\nsig \u003C- dmrs[dmrs$qval \u003C 0.05]   # qval is a REGION FDR that accounts for selection\n```\n\ndmrseq smooths the DIFFERENCE internally (`bpSpan`\u002F`minInSpan`\u002F`maxGapSmooth`); running `BSmooth()` first double-smooths and invalidates the model. The permutation null is COARSE at 2-vs-2 (few distinct label permutations) - the package pools across all candidate regions to compensate, but more replicates give a finer null. Use `adjustCovariate` for nuisance variables and `block = TRUE` for large-scale differential blocks.\n\n## DSS: Beta-Binomial Dispersion Shrinkage\n\n**Goal:** Call DMRs with per-CpG dispersion shrinkage for small n or a multi-factor design.\n\n**Approach:** `DMLtest` does per-CpG Wald tests with a Bayesian beta-binomial dispersion estimate, then `callDMR` merges significant CpGs into regions.\n\n```r\nlibrary(DSS)\n\nbs \u003C- makeBSseqData(list(c1, c2, t1, t2), c('C1', 'C2', 'T1', 'T2'))   # each: chr\u002Fpos\u002FN\u002FX data.frame\ndml \u003C- DMLtest(bs, group1 = c('C1', 'C2'), group2 = c('T1', 'T2'), smoothing = TRUE)   # TRUE for low-cov WGBS\n\n# callDMR defaults (verify on installed build): delta=0, p.threshold=1e-5,\n# minlen=50, minCG=3, dis.merge=100, pct.sig=0.5.\n# delta=0 means NO effect-size floor - SET it explicitly so tiny shifts are not called.\ndmrs \u003C- callDMR(dml, delta = 0.1, p.threshold = 1e-5, minlen = 50, minCG = 3,\n                dis.merge = 100, pct.sig = 0.5)   # pct.sig=0.5: >=50% of region CpGs individually significant\n```\n\ncallDMR merges significant CpGs (threshold-then-define), so its region p is NOT selection-corrected; its strengths are dispersion shrinkage and multi-factor support (`DMLtest.multiFactor` with a model formula).\n\n## bsseq BSmooth\n\n**Goal:** Call DMRs on low\u002Funeven-coverage WGBS by smoothing each sample before testing.\n\n**Approach:** Smooth per sample, compute the smoothed t-statistic, then threshold it into regions.\n\n```r\nlibrary(bsseq)\n\nbs_smooth \u003C- BSmooth(bs, BPPARAM = MulticoreParam(4), verbose = TRUE)\nkeep \u003C- rowSums(getCoverage(bs_smooth) >= 2) == ncol(bs_smooth)   # >=2x in every sample\nbs_filt \u003C- bs_smooth[keep, ]\n\ntstat \u003C- BSmooth.tstat(bs_filt, group1 = c('C1', 'C2'), group2 = c('T1', 'T2'),\n                       estimate.var = 'same', mc.cores = 4)\ndmrs \u003C- dmrFinder(tstat, cutoff = c(-4.6, 4.6))   # t-stat cutoff (Hansen 2012 uses quantile-based cutoffs)\n```\n\n`dmrFinder` needs `BSmooth.tstat` output, not the smoothed `BSseq` object directly. BSmooth gives a RANKED DMR list, not a calibrated region FDR - dmrseq (same lab lineage) supersedes it for region inference. Over-smoothing (too-wide bandwidth) washes out focal promoter DMRs.\n\n## DMRcate: The Array-vs-WGBS Fork\n\n**Goal:** Call DMRs by Gaussian-kernel smoothing of the per-CpG statistic, with the correct kernel for the platform.\n\n**Approach:** Annotate per-CpG statistics through the array OR sequencing entry point, then smooth and extract.\n\n```r\nlibrary(DMRcate)\n\n# ARRAY (450K\u002FEPIC): beta\u002FM matrix; arraytype sets the CpG universe.\ndesign \u003C- model.matrix(~ condition)\nann_array \u003C- cpg.annotate('array', m_values, what = 'M', arraytype = 'EPIC',\n                          analysis.type = 'differential', design = design, coef = 2)\ndmrs_array \u003C- extractRanges(dmrcate(ann_array, lambda = 1000, C = 2))   # array kernel\n\n# WGBS: different entry point AND a much smaller kernel - the array C=2 over-smooths\n# dense sequencing CpGs ~25x. Annotate from a count\u002FedgeR-DSS path, then C=50.\nann_seq \u003C- sequencing.annotate(bs, design = design, coef = 2)\ndmrs_seq \u003C- extractRanges(dmrcate(ann_seq, C = 50))   # WGBS kernel (Peters 2021)\n```\n\nThe default `lambda=1000, C=2` is ARRAY-only; applying it to WGBS produces massively over-smoothed, merged, inflated DMRs. `pcutoff='fdr'` returns no DMRs if the upstream limma\u002FDSS yields no significant CpGs.\n\n## metilene and comb-p (Second Callers)\n\nmetilene is a standalone C CLI taking one tab table (chrom, pos, per-sample methylation rate); binary segmentation + a 2D-KS test find data-adaptive boundaries. comb-p is a Python CLI that takes a BED of per-CpG p-values from ANY upstream test, estimates the p-value autocorrelation, does a Stouffer-Liptak-Kechris combination of neighbors, groups regions, and applies a one-step Sidak correction.\n\n```bash\nmetilene -M 1000 -m 10 -d 0.1 -a g1 -b g2 input.tsv | metilene_output.pl   # -m min CpGs, -d min mean diff\ncomb-p pipeline -c 4 --seed 0.01 --dist 500 --step 50 -p out methyl_pvals.bed   # --seed = p to start a region\n```\n\nBoth combine-and-correct rather than re-select; use them as fast corroboration and intersect with dmrseq.\n\n## Thresholds Are Conventions; Region FDR Is Tool-Specific\n\nEvery caller exposes the same coupled knobs under different names: min-CpGs (`minNumRegion`\u002F`minCG`\u002F`-m`\u002F`min.cpgs`\u002F`cov.bases`), max-gap (`maxGap`\u002F`dis.merge`\u002F`-M`), delta-beta (`cutoff`\u002F`delta`\u002F`-d`\u002F`betacutoff`\u002F`difference`), and a significance cutoff. Shrinking max-gap, raising min-CpGs, and raising delta all reduce the DMR count, and the same data yields wildly different DMR sets. The phrase \"region-level FDR\" means three different objects: a selection-aware permutation FDR (dmrseq), a BH\u002FSidak correction on combined per-CpG p-values (DMRcate\u002Fcomb-p), or per-unit q on independent tiles\u002FCpGs (methylKit\u002FDSS). Report all knobs, name the tool, and use cross-tool overlap as the evidence statement.\n\n## DMR-to-Gene Mapping and the CpG-Density Enrichment Bias\n\n**Goal:** Interpret DMRs without inflating enrichment from CpG-rich genes.\n\n**Approach:** Annotate DMRs to features (annotatr returns one row per DMR-feature overlap; genomation collapses by precedence), then run enrichment with a method that corrects for CpG\u002Fprobe count.\n\n```r\nlibrary(annotatr)\nannots \u003C- build_annotations(genome = 'hg38', annotations = c('hg38_basicgenes', 'hg38_cpg_islands'))\ndmr_ann \u003C- annotate_regions(regions = sig, annotations = annots, ignore.strand = TRUE)   # one row per overlap\n\n# Enrichment: methylation has a CpG-density bias (CpG-rich genes harbor DMRs by chance),\n# so a plain hypergeometric GO test is biased. Use missMethyl goregion (probe\u002FCpG-bias-aware).\n# missMethyl::goregion(sig_ranges, all.cpg=..., collection='GO', array.type='EPIC')\n```\n\nA single DMR commonly overlaps or sits between several genes; mapping DMR -> gene (nearest TSS vs overlap vs within-X-kb) is a modeling choice that changes the gene list. Hand the corrected enrichment to pathway-analysis\u002Fgo-enrichment, flagging that methylation input needs a CpG-bias-aware method (missMethyl `gometh`\u002F`goregion`), not a generic hypergeometric test.\n\n## Single-Sample Domain Structure (NOT Differential)\n\nThis is a DIFFERENT problem from the focal between-group callers above. The mammalian methylome partitions at MEGABASE scale into Highly Methylated Domains (HMDs, ~80-90%, ordered) and Partially Methylated Domains (PMDs, ~40-70%, disordered, high-variance), and PMDs coincide with late replication, Lamina-Associated Domains, and the Hi-C B-compartment (Lister 2009 *Nature* 462:315; Berman 2012 *Nat Genet* 44:40). Cancer \"global hypomethylation\" is a DOMAIN phenomenon - focal CpG-island hypermethylation sitting ON a background of megabase PMD hypomethylation - not a focal one. Domain structure is a SINGLE-SAMPLE, structural question answered by SEGMENTERS, not by any between-group DMR caller (methylKit\u002FDSS\u002Fdmrseq\u002FDMRcate\u002Fmetilene\u002Fcomb-p have no single-sample segmentation mode).\n\n- **MethylSeekR** (Burger 2013 *Nucleic Acids Res* 41:e155) segments one WGBS methylome into UMRs (CpG-rich unmethylated = promoters\u002FCGIs), LMRs (CpG-poor low-methylated ~30% = distal enhancers), and PMDs. Pipeline: `readMethylome()` -> `plotAlphaDistributionOneChr()` (diagnostic: does the sample have PMDs?) -> `segmentPMDs()` (2-state Gaussian HMM, 101-CpG windows) -> `calculateFDRs()` -> `segmentUMRsLMRs(m=0.5, n=..., pmdGRanges=...)`. PMDs MUST be masked before UMR\u002FLMR calling or PMD disorder spawns spurious LMRs.\n- **solo-WCGW** (Zhou 2018 *Nat Genet* 50:591) - an isolated CpG in `[A\u002FT]CG[A\u002FT]` context - loses methylation fastest and most monotonically with cell division and is the most sensitive PMD\u002Fmitotic-clock readout, detecting PMD hypomethylation even in near-normal tissue. Quantify as the mean over the published common-PMD solo-WCGW CpG set, not as a DMR. See epigenetic-clocks for the broader clock taxonomy.\n\nThe warning: running a focal DMR caller on a PMD-bearing genome manufactures thousands of fake hypo-DMRs that are really one phenomenon - the PMD background shifting - chopped into pieces by the max-gap\u002Fmin-CpG knobs. Segment domains FIRST, then EXCLUDE PMD intervals from focal calling or STRATIFY every DMR by in-PMD vs out-of-PMD and report the fraction that is PMD background.\n\n## Per-Method Failure Modes\n\n### PMD background reported as DMRs\n**Trigger:** focal caller on tumor\u002Faged\u002Fplacenta\u002Fcultured WGBS without domain screening. **Mechanism:** megabase PMD hypomethylation chopped into pieces by max-gap\u002Fmin-CpG. **Symptom:** thousands of large hypo-DMRs in gene-desert, late-replicating, low-CpG-density coordinates. **Fix:** segment PMDs (MethylSeekR) first; exclude or stratify; report the PMD fraction.\n\n### Pre-smoothing before dmrseq\n**Trigger:** `BSmooth()` then feeding the smoothed object to `dmrseq`. **Mechanism:** dmrseq smooths the difference internally; pre-smoothing double-smooths. **Symptom:** distorted candidate regions and invalid statistics. **Fix:** feed dmrseq the raw `BSseq` counts.\n\n### DMRcate array defaults on WGBS\n**Trigger:** copying `lambda=1000, C=2` onto sequencing data. **Mechanism:** the array kernel is ~25x too wide for dense WGBS CpGs. **Symptom:** massively over-smoothed, merged, inflated DMRs. **Fix:** `sequencing.annotate()` + `C=50` for WGBS (Peters 2021).\n\n### Threshold-then-test reported as region FDR\n**Trigger:** greping runs of significant per-CpG calls and reporting the per-CpG q. **Mechanism:** the regions were selected for extremeness, then tested on the same data. **Symptom:** anti-conservative, uncalibrated region q. **Fix:** use dmrseq (selection-aware) for the headline; at minimum state that a tile\u002Fmerge q is a screening q.\n\n### Single-CpG tiles\n**Trigger:** `tileMethylCounts` at the default `cov.bases=0`. **Mechanism:** a window with one covered CpG becomes a \"DMR.\" **Symptom:** thousands of single-CpG noisy regions. **Fix:** set `cov.bases >= 3`.\n\n### Cross-tool count comparison\n**Trigger:** comparing \"N DMRs at q\u003C0.05\" between callers. **Mechanism:** each tool's q controls a different object. **Symptom:** apparent disagreement that is really an FDR-definition mismatch. **Fix:** compare OVERLAP, not counts.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|-----------|--------|-----------|\n| dmrseq `cutoff` 0.1 (candidate seed only) | Korthauer 2019 | seeds detection; significance is the permutation statistic, NOT a delta floor |\n| DSS `callDMR(delta=0)` default -> SET it | Park & Wu 2016; DSS docs | delta=0 calls regions with no effect-size floor; set ~0.1 to require a real shift |\n| min-CpGs per region 3-5 | convention | single-CpG \"regions\" are DMPs in disguise; trades sensitivity vs specificity |\n| delta-beta 25% (\"moderate\") | methylKit tutorial folklore | NOT derived; biologically meaningful delta is feature- and purity-dependent |\n| methylKit `tileMethylCounts(cov.bases>=3)` | nuance (default is 0) | the default 0 lets single-CpG tiles through |\n| coverage floor ~10x per CpG | field standard | a single-CpG beta below ~10x is a coin flip |\n| DMRcate WGBS `C=50` (array `C=2`) | Peters 2021 *Nucleic Acids Res* 49:e109 | dense WGBS CpGs need a far narrower kernel than array probes |\n| MethylSeekR `m=0.5`, FDR\u003C5% | Burger 2013 | methylation cutoff for hypomethylated regions; FDR target picks the CpG-count threshold n |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| dmrseq error about zero-coverage loci | a locus has 0 coverage in some sample | filter `rowSums(getCoverage(bs)==0)==0` first |\n| Thousands of huge hypo-DMRs in cancer WGBS | PMD background not segmented | MethylSeekR `segmentPMDs` first; exclude\u002Fstratify |\n| Over-merged WGBS DMRs with DMRcate | array kernel on sequencing | `sequencing.annotate()` + `C=50` |\n| `dmrFinder` errors on a smoothed object | needs `BSmooth.tstat` output | run `BSmooth.tstat` before `dmrFinder` |\n| DMRcate returns no DMRs | `pcutoff='fdr'` and no significant upstream CpGs | check the upstream limma\u002FDSS result first |\n| Biased GO enrichment of DMR genes | plain hypergeometric ignores CpG density | use missMethyl `goregion`\u002F`gometh` |\n\n## References\n\n- Korthauer K, Chakraborty S, Benjamini Y, Irizarry RA. 2019. Detection and accurate false discovery rate control of differentially methylated regions from whole genome bisulfite sequencing. *Biostatistics* 20:367-383.\n- Feng H, Conneely KN, Wu H. 2014. A Bayesian hierarchical model to detect differentially methylated loci from single nucleotide resolution sequencing data. *Nucleic Acids Res* 42:e69.\n- Park Y, Wu H. 2016. Differential methylation analysis for BS-seq data under general experimental design. *Bioinformatics* 32:1446-1453.\n- Hansen KD, Langmead B, Irizarry RA. 2012. BSmooth: from whole genome bisulfite sequencing reads to differentially methylated regions. *Genome Biol* 13:R83.\n- Akalin A, Kormaksson M, Li S, et al. 2012. methylKit: a comprehensive R package for the analysis of genome-wide DNA methylation profiles. *Genome Biol* 13:R87.\n- Peters TJ, Buckley MJ, Statham AL, et al. 2015. De novo identification of differentially methylated regions in the human genome. *Epigenetics Chromatin* 8:6.\n- Peters TJ, Buckley MJ, Chen Y, et al. 2021. Calling differentially methylated regions from whole genome bisulphite sequencing with DMRcate. *Nucleic Acids Res* 49:e109.\n- Juhling F, Kretzmer H, Bernhart SH, Otto C, Stadler PF, Hoffmann S. 2016. metilene: fast and sensitive calling of differentially methylated regions from bisulfite sequencing data. *Genome Res* 26:256-262.\n- Pedersen BS, Schwartz DA, Yang IV, Kechris KJ. 2012. Comb-p: software for combining, analyzing, grouping and correcting spatially correlated P-values. *Bioinformatics* 28:2986-2988.\n- Lister R, Pelizzola M, Dowen RH, et al. 2009. Human DNA methylomes at base resolution show widespread epigenomic differences. *Nature* 462:315-322.\n- Berman BP, Weisenberger DJ, Aman JF, et al. 2012. Regions of focal DNA hypermethylation and long-range hypomethylation in colorectal cancer coincide with nuclear lamina-associated domains. *Nat Genet* 44:40-46.\n- Zhou W, Dinh HQ, Ramjan Z, et al. 2018. DNA methylation loss in late-replicating domains is linked to mitotic cell division. *Nat Genet* 50:591-602.\n- Burger L, Gaidatzis D, Schubeler D, Stadler MB. 2013. Identification of active regulatory regions from DNA methylation data. *Nucleic Acids Res* 41:e155.\n\n## Related Skills\n\n- differential-cpg-testing - Per-site testing before region aggregation\n- methylkit-analysis - methylKit object model and tile construction\n- methylation-calling - Produces the input count tables\n- array-preprocessing - Array beta\u002FM-value input for DMRcate array mode\n- epigenetic-clocks - Mitotic-clock \u002F solo-WCGW overlap (domain section)\n- pathway-analysis\u002Fgo-enrichment - CpG-bias-aware enrichment of DMR genes (missMethyl gometh)\n- long-read-sequencing\u002Fnanopore-methylation - Pipe modkit bedMethyl counts here for region statistics\n- workflows\u002Fmethylation-pipeline - End-to-end bisulfite pipeline\n",{"name":5,"source":24,"license":15,"tool_type":25,"description":7,"imported_at":26,"source_path":27,"primary_tool":28,"source_repository":29},"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills","r","2026-09-20","methylation-analysis\u002Fdmr-detection\u002FSKILL.md","dmrseq","GPTomics\u002FbioSkills","main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fbiology\u002Fbio-methylation-dmr-detection","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous","2026-11-09 11:45:36",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-methylation-dmr-detection",{"tool":42,"command":43},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-methylation-dmr-detection",{"tool":45,"command":46},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-methylation-dmr-detection","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-methylation-dmr-detection\u002FSKILL.md",true,[50,56,60],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"examples\u002Fdmr_dmrseq.R","OTHER","其他",2556,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-methylation-dmr-detection\u002Fexamples\u002Fdmr_dmrseq.R",{"path":57,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":58,"sourceHtmlUrl":59},"examples\u002Fdmr_methylkit.R",3211,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-methylation-dmr-detection\u002Fexamples\u002Fdmr_methylkit.R",{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},"usage-guide.md","REFERENCE","参考文档",5585,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-methylation-dmr-detection\u002Fusage-guide.md",[67,75,82,89,96,103],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":74},"01M7FFFZPC2025JQQHPHDX154J","dei-assessment","Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-assessment\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":74},"01M7FFFWN8H4WA7A6Y398QKB6J","dei-action-plan","Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-action-plan\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":74},"01M7FFFSHTM0QZRVZ2NRJTJ0PY","culture-fit-assessment","Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fculture-fit-assessment\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":74},"01M7FFFMA12RKEQA38KHJSXXPS","cowork-to-code-bridge","Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcowork-to-code-bridge\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":74},"01M7FFFH1F6M8YRGW5V487GH1K","counter-offer-response","Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcounter-offer-response\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":74},"01M7FFFDGEHV8Y7J9N40HZXW52","continuous-feedback-system","Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcontinuous-feedback-system\u002FSKILL.md",[],[]]