[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EEB7VMSBNCGQSAW5B2XNTA":3,"skill-same:01M7EEB7VMSBNCGQSAW5B2XNTA":62},{"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},"01M7EEB7VMSBNCGQSAW5B2XNTA","bio-methylation-array-preprocessing",null,"Turns raw Illumina Infinium methylation BeadChip IDATs (450K, EPIC, EPICv2) into a defensible beta\u002FM matrix with sesame (openSesame\u002FSigDF) or minfi (RGChannelSet -> MethylSet -> GenomicRatioSet). Covers Type I vs Type II probe chemistry and why raw Type II beta is compressed, the signal-to-beta math (beta = M\u002F(M+U+100)) and M-value logit, detection-p \u002F pOOBAH masking including the out-of-band deletion-artifact catch, dye-bias correction, and the normalization decision (noob, funnorm, quantile, SWAN, BMIQ, dasen, sesame QCDPB). Use when reading IDATs, choosing a normalization for a 450K\u002FEPIC\u002FEPICv2 cohort, deciding beta vs M, masking failed probes, or producing the corrected matrix before testing. For probe\u002Fsample filtering, EPICv2 replicate collapse, and sample-identity QC see array-qc-filtering; for native long-read 5mC see long-read-sequencing\u002Fnanopore-methylation (a different platform).","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-array-preprocessing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-methylation-array-preprocessing\ndescription: Turns raw Illumina Infinium methylation BeadChip IDATs (450K, EPIC, EPICv2) into a defensible beta\u002FM matrix with sesame (openSesame\u002FSigDF) or minfi (RGChannelSet -> MethylSet -> GenomicRatioSet). Covers Type I vs Type II probe chemistry and why raw Type II beta is compressed, the signal-to-beta math (beta = M\u002F(M+U+100)) and M-value logit, detection-p \u002F pOOBAH masking including the out-of-band deletion-artifact catch, dye-bias correction, and the normalization decision (noob, funnorm, quantile, SWAN, BMIQ, dasen, sesame QCDPB). Use when reading IDATs, choosing a normalization for a 450K\u002FEPIC\u002FEPICv2 cohort, deciding beta vs M, masking failed probes, or producing the corrected matrix before testing. For probe\u002Fsample filtering, EPICv2 replicate collapse, and sample-identity QC see array-qc-filtering; for native long-read 5mC see long-read-sequencing\u002Fnanopore-methylation (a different platform).\ntool_type: r\nprimary_tool: sesame\nsource: \"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills\"\nsource_repository: \"GPTomics\u002FbioSkills\"\nsource_path: \"methylation-analysis\u002Farray-preprocessing\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n\n## Version Compatibility\n\nReference examples tested with: sesame 1.20+, minfi 1.48+, ChAMP 2.32+, wateRmelon 2.8+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\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 ARRAY VERSION and GENOME BUILD are versions that matter as much as the package. EPICv2 REQUIRES sesame (mainstream minfi does not auto-detect it and returns \"Unknown\"); the manifest\u002Fannotation packages are array-version- and genome-build-specific (450K and EPICv1 are hg19; EPICv2 is hg38-native). sesame pulls platform\u002Faddress data from its own hub, so `sesameDataCache()` must run once before processing. Record the array (450K\u002FEPIC\u002FEPICv2) and the genome build in any output, the way a sequencing run records its reference.\n\n# Array Preprocessing\n\n**\"Give me a clean methylation matrix from my IDATs\"** -> Read the raw two-channel intensities, correct the Type I\u002FII design mismatch, dye\u002Fbackground bias, and failed probes, then emit beta (for reporting) and M (for testing) - because an Infinium beta is a two-chemistry fluorescence ratio, not a methylation value, until those corrections are applied.\n- R: `openSesame(idat_dir, prep='QCDPB', func=getBetas)` (sesame) or `preprocessFunnorm(rgSet)` (minfi)\n\nScope: IDAT -> corrected, masked, normalized beta\u002FM matrix for one array version. Probe filtering (cross-reactive\u002FSNP\u002Fsex), EPICv2 replicate collapse, and sample-identity QC -> array-qc-filtering. Per-CpG testing -> differential-cpg-testing. Region calling -> dmr-detection. Native long-read 5mC -> long-read-sequencing\u002Fnanopore-methylation. Bisulfite-sequencing (Bismark\u002FWGBS\u002FRRBS) is the other modality in this category, not this skill.\n\n## The Single Most Important Modern Insight -- An Infinium Beta Value Is a Two-Chemistry Fluorescence Ratio, Not a Methylation Measurement\n\nAn Infinium array does not measure methylation - it measures the relative fluorescence of a methylated vs unmethylated allele at a fixed, manufacturer-chosen set of CpGs, glued together from two incompatible chemistries. A raw beta becomes a comparable methylation estimate only after preprocessing; preprocessing IS the measurement, not optional cleanup. Three corollaries every misuse violates:\n\n1. **The manifest is the experiment.** The array interrogates \u003C3% of human CpGs, and a DIFFERENT \u003C3% across 450K (~485K), EPIC (~865K), and EPICv2 (~935K). \"Absent\" almost always means \"not on this array,\" and a 450K-trained clock or EWAS does not transfer to EPICv2 without intersecting probe sets. Do not start from a supplied beta matrix when IDATs exist - the raw two-channel intensities, control probes, and out-of-band signal that noob\u002Ffunnorm\u002FpOOBAH need are already gone.\n2. **Type I and Type II betas disagree by design.** Type II probes (one bead, two dyes) have a narrower dynamic range and dye-incorporation bias, so raw Type II betas are compressed toward 0.5 relative to Type I (two beads, one channel). Mixing the two chemistries without a design correction (BMIQ\u002FSWAN\u002Fsesame matchDesign) injects a probe-type artifact that can exceed the biological effect. The diagnostic is a per-type beta-density plot showing two mismatched peaks.\n3. **Raw beta is uninterpretable until detection-masked.** Failed probes - low signal, germline\u002Fsomatic deletions, cross-reactive, SNP-hit - return confident-looking betas that are pure noise. pOOBAH \u002F detection-p masking is what separates a number from a measurement of nothing; pOOBAH additionally catches deletion-driven false-intermediate methylation that negative-control detection-p misses.\n\nOrganize the work around DELIVERING a defensible matrix (read -> correct -> mask -> normalize), not around listing minfi functions.\n\n## Three Modalities of the Same Biology\n\nDNA methylation is measured three ways, each with different tradeoffs - state which one the data is before choosing tools:\n\n| Modality | Readout | Coverage | Cohort-comparability | This skill |\n|----------|---------|----------|----------------------|------------|\n| Infinium array (450K\u002FEPIC\u002FEPICv2) | intensity ratio, no depth | fixed \u003C3% of CpGs, regulatory-enriched | high (shared manifest, no alignment) | YES |\n| WGBS \u002F RRBS bisulfite | count ratio, depth-gated | genome-wide (WGBS) or enriched (RRBS) | needs alignment + matched genome | -> bismark-alignment, methylkit-analysis |\n| Long-read native (ONT\u002FPacBio) | per-molecule modification calls | genome-wide, phased | growing | -> long-read-sequencing\u002Fnanopore-methylation |\n\nArrays dominate human epigenetic epidemiology (essentially every published clock and large EWAS is array-based) because cost is a fraction of WGBS and the fixed manifest makes cohorts directly comparable.\n\n## Object Models (do not start from a beta matrix)\n\nThe raw output per sample is a pair of binary IDATs (`_Grn.idat`, `_Red.idat`); background, dye, and detection-p correction REQUIRE these plus the control probes.\n\n- **minfi:** `RGChannelSet` (raw red\u002Fgreen) -> a `preprocess*` step -> `MethylSet` (M\u002FU intensities) -> `RatioSet` (beta\u002FM) -> `GenomicRatioSet` (genome-mapped). `read.metharray.exp()` reads IDATs; `getBeta()`, `getM()`, `getCN()` extract values.\n- **sesame:** a `SigDF` (one signal data.frame per sample). `readIDATpair()` reads one sample; `openSesame()` drives the whole pipeline across a directory and returns a betas matrix directly.\n\n## Tool Taxonomy\n\n| Tool | Citation | Mechanism \u002F role | When |\n|------|----------|------------------|------|\n| sesame | Zhou 2018 *Nucleic Acids Res* 46:e123 | SigDF; openSesame QCDPB; pOOBAH OOB masking; EPICv2-native | EPICv2; best detection masking; the modern default |\n| minfi | Aryee 2014 *Bioinformatics* 30:1363 | RGChannelSet->GenomicRatioSet; noob\u002Ffunnorm\u002Fquantile\u002FSWAN | 450K\u002FEPICv1; large downstream ecosystem (DMRcate, conumee) |\n| ChAMP | Tian 2017 *Bioinformatics* 33:3982 | end-to-end pipeline; BMIQ default | one-call newcomer pipeline on 450K\u002FEPICv1 |\n| wateRmelon | Pidsley 2013 *BMC Genomics* 14:293 | dasen\u002Fnasen + metric-driven normalization eval | dasen default; normalization benchmarking |\n\n## Normalization Decision Tree by Scenario\n\nSeparate the two correction layers that get conflated: (a) background + dye bias (within-sample): noob, sesame dyeBias, dasen background step; (b) Type I\u002FII design correction + between-array harmonization: SWAN, BMIQ, quantile, funnorm, dasen quantile step. A complete pipeline does both.\n\n| Scenario | Recommended | Why |\n|----------|-------------|-----|\n| EPICv2 (any design) | sesame `openSesame(prep='QCDPB')` | EPICv2-native; pOOBAH; minfi mis-handles duplicate IDs |\n| Cancer \u002F cross-tissue (global differences expected) | minfi `preprocessFunnorm` (noob + control-PCs) | preserves real global shifts; quantile would erase them |\n| Subtle blood EWAS (no global difference expected) | `preprocessQuantile` or wateRmelon `dasen` | marginal distributions assumed equal; safe to harmonize |\n| Strong Type I\u002FII design correction wanted | BMIQ (Teschendorff 2013) or SWAN (Maksimovic 2012) | dilate Type II onto the Type I distribution; pair with a between-array step |\n| Single-sample \u002F clinical \u002F streaming | ssNoob or per-IDAT openSesame | reproducible without re-normalizing the cohort |\n| Probe\u002Fsample filtering, EPICv2 collapse, identity | -> array-qc-filtering | this skill stops at the corrected matrix |\n| Per-CpG testing on the matrix | -> differential-cpg-testing | test on M-values; report delta-beta |\n\nThere is no universally best normalization (Pidsley 2013 favored dasen; Fortin 2014 favored funnorm for global-difference studies; Welsh 2023 ranked a sesame\u002FpOOBAH pipeline best and quantile worst on EPIC replicate-concordance). Key the choice on array version + whether global differences are expected + single-sample vs cohort, and verify against current benchmarks rather than hard-coding one method.\n\n## Signal -> Beta -> M\n\n- **Beta:** `beta = M \u002F (M + U + alpha)`, M = methylated-allele intensity, U = unmethylated, `alpha = 100` (minfi default) stabilizes the ratio when both intensities are near zero. beta in [0,1] is interpretable but HETEROSCEDASTIC (variance collapses near 0 and 1), violating the constant-variance assumption of linear models.\n- **M-value:** `M = log2((M_int + alpha) \u002F (U_int + alpha))`, the logit of beta. Approximately homoscedastic; the correct scale for limma\u002Ft-tests (Du 2010 *BMC Bioinformatics* 11:587). Rule: test on M-values, report delta-beta for effect size - the same rule as bisulfite sequencing.\n\n## Process IDATs with sesame (the EPICv2-safe default)\n\n**Goal:** Produce a corrected, detection-masked betas matrix from a directory of IDAT pairs without manually juggling manifest packages.\n\n**Approach:** Cache the sesame data hub once, then run openSesame with the default `QCDPB` prep (qualityMask, inferInfiniumIChannel, dyeBiasNL, pOOBAH, noob, in that order), which auto-detects the platform and returns betas; pOOBAH writes NA into failed probes in place.\n\n```r\nlibrary(sesame)\nsesameDataCache()                          # once per machine; pulls platform\u002Faddress data\nbetas \u003C- openSesame('idat_dir', prep = 'QCDPB', func = getBetas)\n# prep codes: Q qualityMask  C inferInfiniumIChannel  D dyeBiasNL  P pOOBAH  B noob\n# pOOBAH masks (sets NA) probes whose out-of-band signal is indistinguishable from background,\n# catching deletion-driven false-intermediate methylation that negative-control detection-p misses\nmvals \u003C- log2(betas \u002F (1 - betas))         # M-values for statistical testing (logit of beta)\n```\n\nFor EPICv2, openSesame detects the platform automatically; the replicate-probe collapse (`betasCollapseToPfx`) belongs to the next stage and is documented in array-qc-filtering.\n\n## Process IDATs with minfi (450K \u002F EPICv1)\n\n**Goal:** Build a normalized GenomicRatioSet and extract beta and M, choosing the normalization by whether global methylation differences are expected.\n\n**Approach:** Read IDATs into an RGChannelSet, compute a detection-p mask before normalizing, then apply funnorm (global differences) or quantile (no global differences); extract beta and M with the offset-100 defaults.\n\n```r\nlibrary(minfi)\nrgSet \u003C- read.metharray.exp(base = 'idat_dir')\ndetP \u003C- detectionP(rgSet)                   # neg-control-based; pre-normalization probe-failure map\n\ngrSet \u003C- preprocessFunnorm(rgSet, nPCs = 2) # noob first, then 2 control-probe PCs; preserves global shifts\n# preprocessQuantile(rgSet) instead when NO global difference is expected (subtle blood EWAS)\n\nbeta \u003C- getBeta(grSet)                       # GenomicRatioSet holds precomputed betas (offset applied upstream)\nmval \u003C- getM(grSet)                          # log2(beta\u002F(1-beta)) on the ratio set\nbeta[detP[rownames(beta), colnames(beta)] > 0.01] \u003C- NA   # mask probes failing detection-p (0.01)\n```\n\nEPICv2 is NOT handled by mainstream minfi (it returns \"Unknown\" and duplicates probe IDs); use sesame for EPICv2.\n\n## Per-Method Failure Modes\n\n### Starting from a supplied beta matrix\n**Trigger:** processing begins from a `.csv`\u002F`.RData` beta matrix instead of IDATs. **Mechanism:** a beta matrix has discarded the raw two-channel intensities, control probes, and out-of-band signal. **Symptom:** noob\u002Ffunnorm\u002FpOOBAH\u002Fdye correction cannot run; detection-p cannot be recomputed. **Fix:** obtain the raw IDAT pairs; treat a beta matrix as a last resort and document that preprocessing could not be applied.\n\n### Type I\u002FII mismatch left in the data\n**Trigger:** testing on raw or only background-corrected betas. **Mechanism:** Type II betas are compressed toward 0.5 relative to Type I. **Symptom:** \"differential\" probes that are design artifacts; a two-peak per-type beta density. **Fix:** apply BMIQ\u002FSWAN or sesame matchDesign (or use openSesame, which corrects channel\u002Fdye) before testing; confirm the two per-type peaks align.\n\n### minfi on EPICv2\n**Trigger:** `read.metharray.exp` on EPICv2 IDATs with mainstream minfi. **Mechanism:** EPICv2 is not auto-detected; 5,483 loci carry duplicate IDs. **Symptom:** array reads as \"Unknown\"; `getBeta()` returns repeated rownames so `match()`-based merges silently misbehave. **Fix:** use sesame (EPICv2-native), or install a third-party EPICv2 manifest\u002Fanno, tag the annotation manually, and collapse replicates in array-qc-filtering.\n\n### Quantile-normalizing a global-difference contrast\n**Trigger:** `preprocessQuantile` on cancer vs normal or cross-tissue data. **Mechanism:** between-array quantile assumes equal marginal beta distributions. **Symptom:** real global hypomethylation flattened away. **Fix:** use funnorm (control-probe PCs preserve global shifts); reserve quantile\u002Fdasen for subtle no-global-difference designs.\n\n### Testing on beta instead of M\n**Trigger:** limma\u002Ft-tests run directly on beta. **Mechanism:** beta is heteroscedastic (variance collapses near 0 and 1). **Symptom:** miscalibrated variance; inflated or deflated p-values at extreme methylation. **Fix:** test on M-values, report delta-beta for effect size.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|-----------|--------|-----------|\n| beta offset `alpha = 100` | Aryee 2014; minfi default | stabilizes the ratio when M and U are both near zero |\n| detection-p `> 0.01` = failed | minfi convention | signal indistinguishable from background; beta is noise |\n| pOOBAH default p ~ 0.05 | Zhou 2018 | OOB-based mask; also catches deletion-driven false intermediate methylation |\n| funnorm `nPCs = 2` | Fortin 2014 | first 2 control-probe PCs absorb technical variation without erasing biology |\n| Test on M-values, report delta-beta | Du 2010 | M is homoscedastic for modeling; beta is interpretable for effect size |\n| sesame prep `QCDPB` (ordered) | Zhou 2018 | Q quality, C channel, D dye, P pOOBAH, B noob - the validated default order |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| Array reads as \"Unknown\" | EPICv2 in mainstream minfi | use sesame; or third-party manifest + manual annotation tag |\n| `getBeta()` has repeated rownames | EPICv2 duplicate probe IDs | collapse replicates (array-qc-filtering); do not merge by ID first |\n| Two-peak beta density per probe type | Type I\u002FII design bias uncorrected | BMIQ\u002FSWAN\u002FopenSesame before testing |\n| Global signal vanished after normalization | quantile applied to a global-difference study | use funnorm |\n| `sesameDataCache` \u002F platform-not-found | hub not cached | run `sesameDataCache()` once before processing |\n| Coordinates misalign merging EPICv2 with 450K | EPICv2 is hg38, 450K\u002FEPICv1 hg19 | track build per array; liftover before merging (array-qc-filtering) |\n\n## References\n\n- Aryee MJ, Jaffe AE, Corrada-Bravo H, et al. 2014. Minfi: a flexible and comprehensive Bioconductor package for the analysis of Infinium DNA methylation microarrays. *Bioinformatics* 30:1363-1369.\n- Zhou W, Triche TJ Jr, Laird PW, Shen H. 2018. SeSAMe: reducing artifactual detection of DNA methylation by Infinium BeadChips in genomic deletions. *Nucleic Acids Res* 46:e123.\n- Triche TJ Jr, Weisenberger DJ, Van Den Berg D, Laird PW, Siegmund KD. 2013. Low-level processing of Illumina Infinium DNA methylation BeadArrays. *Nucleic Acids Res* 41:e90.\n- Fortin JP, Labbe A, Lemire M, et al. 2014. Functional normalization of 450k methylation array data improves replication in large cancer studies. *Genome Biol* 15:503.\n- Maksimovic J, Gordon L, Oshlack A. 2012. SWAN: subset-quantile within array normalization for Illumina Infinium HumanMethylation450 BeadChips. *Genome Biol* 13:R44.\n- Teschendorff AE, Marabita F, Lechner M, et al. 2013. A beta-mixture quantile normalization method for correcting probe design bias in Illumina Infinium 450k DNA methylation data. *Bioinformatics* 29:189-196.\n- Pidsley R, Wong CCY, Volta M, Lunnon K, Mill J, Schalkwyk LC. 2013. A data-driven approach to preprocessing Illumina 450K methylation array data. *BMC Genomics* 14:293.\n- Du P, Zhang X, Huang CC, et al. 2010. Comparison of Beta-value and M-value methods for quantifying methylation levels by microarray analysis. *BMC Bioinformatics* 11:587.\n- Tian Y, Morris TJ, Webster AP, et al. 2017. ChAMP: updated methylation analysis pipeline for Illumina BeadChips. *Bioinformatics* 33:3982-3984.\n- Kaur D, Lee SM, Goldberg D, et al. 2023. Comprehensive evaluation of the Infinium human MethylationEPIC v2 BeadChip. *Epigenetics Commun* 3:6.\n\n## Related Skills\n\n- array-qc-filtering - Probe and sample QC\u002Ffiltering downstream of preprocessing\n- differential-cpg-testing - Per-CpG testing on the resulting beta\u002FM matrix\n- dmr-detection - DMRcate array-mode region calling\n- cell-type-deconvolution - Consumes the clean beta matrix\n- epigenetic-clocks - Consumes the clean beta matrix\n- ewas-design - Study design, batch, and inference layer\n- long-read-sequencing\u002Fnanopore-methylation - Native long-read methylation (different platform)\n- workflows\u002Fmethylation-pipeline - End-to-end pipeline\n","## Version Compatibility\n\nReference examples tested with: sesame 1.20+, minfi 1.48+, ChAMP 2.32+, wateRmelon 2.8+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\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 ARRAY VERSION and GENOME BUILD are versions that matter as much as the package. EPICv2 REQUIRES sesame (mainstream minfi does not auto-detect it and returns \"Unknown\"); the manifest\u002Fannotation packages are array-version- and genome-build-specific (450K and EPICv1 are hg19; EPICv2 is hg38-native). sesame pulls platform\u002Faddress data from its own hub, so `sesameDataCache()` must run once before processing. Record the array (450K\u002FEPIC\u002FEPICv2) and the genome build in any output, the way a sequencing run records its reference.\n\n# Array Preprocessing\n\n**\"Give me a clean methylation matrix from my IDATs\"** -> Read the raw two-channel intensities, correct the Type I\u002FII design mismatch, dye\u002Fbackground bias, and failed probes, then emit beta (for reporting) and M (for testing) - because an Infinium beta is a two-chemistry fluorescence ratio, not a methylation value, until those corrections are applied.\n- R: `openSesame(idat_dir, prep='QCDPB', func=getBetas)` (sesame) or `preprocessFunnorm(rgSet)` (minfi)\n\nScope: IDAT -> corrected, masked, normalized beta\u002FM matrix for one array version. Probe filtering (cross-reactive\u002FSNP\u002Fsex), EPICv2 replicate collapse, and sample-identity QC -> array-qc-filtering. Per-CpG testing -> differential-cpg-testing. Region calling -> dmr-detection. Native long-read 5mC -> long-read-sequencing\u002Fnanopore-methylation. Bisulfite-sequencing (Bismark\u002FWGBS\u002FRRBS) is the other modality in this category, not this skill.\n\n## The Single Most Important Modern Insight -- An Infinium Beta Value Is a Two-Chemistry Fluorescence Ratio, Not a Methylation Measurement\n\nAn Infinium array does not measure methylation - it measures the relative fluorescence of a methylated vs unmethylated allele at a fixed, manufacturer-chosen set of CpGs, glued together from two incompatible chemistries. A raw beta becomes a comparable methylation estimate only after preprocessing; preprocessing IS the measurement, not optional cleanup. Three corollaries every misuse violates:\n\n1. **The manifest is the experiment.** The array interrogates \u003C3% of human CpGs, and a DIFFERENT \u003C3% across 450K (~485K), EPIC (~865K), and EPICv2 (~935K). \"Absent\" almost always means \"not on this array,\" and a 450K-trained clock or EWAS does not transfer to EPICv2 without intersecting probe sets. Do not start from a supplied beta matrix when IDATs exist - the raw two-channel intensities, control probes, and out-of-band signal that noob\u002Ffunnorm\u002FpOOBAH need are already gone.\n2. **Type I and Type II betas disagree by design.** Type II probes (one bead, two dyes) have a narrower dynamic range and dye-incorporation bias, so raw Type II betas are compressed toward 0.5 relative to Type I (two beads, one channel). Mixing the two chemistries without a design correction (BMIQ\u002FSWAN\u002Fsesame matchDesign) injects a probe-type artifact that can exceed the biological effect. The diagnostic is a per-type beta-density plot showing two mismatched peaks.\n3. **Raw beta is uninterpretable until detection-masked.** Failed probes - low signal, germline\u002Fsomatic deletions, cross-reactive, SNP-hit - return confident-looking betas that are pure noise. pOOBAH \u002F detection-p masking is what separates a number from a measurement of nothing; pOOBAH additionally catches deletion-driven false-intermediate methylation that negative-control detection-p misses.\n\nOrganize the work around DELIVERING a defensible matrix (read -> correct -> mask -> normalize), not around listing minfi functions.\n\n## Three Modalities of the Same Biology\n\nDNA methylation is measured three ways, each with different tradeoffs - state which one the data is before choosing tools:\n\n| Modality | Readout | Coverage | Cohort-comparability | This skill |\n|----------|---------|----------|----------------------|------------|\n| Infinium array (450K\u002FEPIC\u002FEPICv2) | intensity ratio, no depth | fixed \u003C3% of CpGs, regulatory-enriched | high (shared manifest, no alignment) | YES |\n| WGBS \u002F RRBS bisulfite | count ratio, depth-gated | genome-wide (WGBS) or enriched (RRBS) | needs alignment + matched genome | -> bismark-alignment, methylkit-analysis |\n| Long-read native (ONT\u002FPacBio) | per-molecule modification calls | genome-wide, phased | growing | -> long-read-sequencing\u002Fnanopore-methylation |\n\nArrays dominate human epigenetic epidemiology (essentially every published clock and large EWAS is array-based) because cost is a fraction of WGBS and the fixed manifest makes cohorts directly comparable.\n\n## Object Models (do not start from a beta matrix)\n\nThe raw output per sample is a pair of binary IDATs (`_Grn.idat`, `_Red.idat`); background, dye, and detection-p correction REQUIRE these plus the control probes.\n\n- **minfi:** `RGChannelSet` (raw red\u002Fgreen) -> a `preprocess*` step -> `MethylSet` (M\u002FU intensities) -> `RatioSet` (beta\u002FM) -> `GenomicRatioSet` (genome-mapped). `read.metharray.exp()` reads IDATs; `getBeta()`, `getM()`, `getCN()` extract values.\n- **sesame:** a `SigDF` (one signal data.frame per sample). `readIDATpair()` reads one sample; `openSesame()` drives the whole pipeline across a directory and returns a betas matrix directly.\n\n## Tool Taxonomy\n\n| Tool | Citation | Mechanism \u002F role | When |\n|------|----------|------------------|------|\n| sesame | Zhou 2018 *Nucleic Acids Res* 46:e123 | SigDF; openSesame QCDPB; pOOBAH OOB masking; EPICv2-native | EPICv2; best detection masking; the modern default |\n| minfi | Aryee 2014 *Bioinformatics* 30:1363 | RGChannelSet->GenomicRatioSet; noob\u002Ffunnorm\u002Fquantile\u002FSWAN | 450K\u002FEPICv1; large downstream ecosystem (DMRcate, conumee) |\n| ChAMP | Tian 2017 *Bioinformatics* 33:3982 | end-to-end pipeline; BMIQ default | one-call newcomer pipeline on 450K\u002FEPICv1 |\n| wateRmelon | Pidsley 2013 *BMC Genomics* 14:293 | dasen\u002Fnasen + metric-driven normalization eval | dasen default; normalization benchmarking |\n\n## Normalization Decision Tree by Scenario\n\nSeparate the two correction layers that get conflated: (a) background + dye bias (within-sample): noob, sesame dyeBias, dasen background step; (b) Type I\u002FII design correction + between-array harmonization: SWAN, BMIQ, quantile, funnorm, dasen quantile step. A complete pipeline does both.\n\n| Scenario | Recommended | Why |\n|----------|-------------|-----|\n| EPICv2 (any design) | sesame `openSesame(prep='QCDPB')` | EPICv2-native; pOOBAH; minfi mis-handles duplicate IDs |\n| Cancer \u002F cross-tissue (global differences expected) | minfi `preprocessFunnorm` (noob + control-PCs) | preserves real global shifts; quantile would erase them |\n| Subtle blood EWAS (no global difference expected) | `preprocessQuantile` or wateRmelon `dasen` | marginal distributions assumed equal; safe to harmonize |\n| Strong Type I\u002FII design correction wanted | BMIQ (Teschendorff 2013) or SWAN (Maksimovic 2012) | dilate Type II onto the Type I distribution; pair with a between-array step |\n| Single-sample \u002F clinical \u002F streaming | ssNoob or per-IDAT openSesame | reproducible without re-normalizing the cohort |\n| Probe\u002Fsample filtering, EPICv2 collapse, identity | -> array-qc-filtering | this skill stops at the corrected matrix |\n| Per-CpG testing on the matrix | -> differential-cpg-testing | test on M-values; report delta-beta |\n\nThere is no universally best normalization (Pidsley 2013 favored dasen; Fortin 2014 favored funnorm for global-difference studies; Welsh 2023 ranked a sesame\u002FpOOBAH pipeline best and quantile worst on EPIC replicate-concordance). Key the choice on array version + whether global differences are expected + single-sample vs cohort, and verify against current benchmarks rather than hard-coding one method.\n\n## Signal -> Beta -> M\n\n- **Beta:** `beta = M \u002F (M + U + alpha)`, M = methylated-allele intensity, U = unmethylated, `alpha = 100` (minfi default) stabilizes the ratio when both intensities are near zero. beta in [0,1] is interpretable but HETEROSCEDASTIC (variance collapses near 0 and 1), violating the constant-variance assumption of linear models.\n- **M-value:** `M = log2((M_int + alpha) \u002F (U_int + alpha))`, the logit of beta. Approximately homoscedastic; the correct scale for limma\u002Ft-tests (Du 2010 *BMC Bioinformatics* 11:587). Rule: test on M-values, report delta-beta for effect size - the same rule as bisulfite sequencing.\n\n## Process IDATs with sesame (the EPICv2-safe default)\n\n**Goal:** Produce a corrected, detection-masked betas matrix from a directory of IDAT pairs without manually juggling manifest packages.\n\n**Approach:** Cache the sesame data hub once, then run openSesame with the default `QCDPB` prep (qualityMask, inferInfiniumIChannel, dyeBiasNL, pOOBAH, noob, in that order), which auto-detects the platform and returns betas; pOOBAH writes NA into failed probes in place.\n\n```r\nlibrary(sesame)\nsesameDataCache()                          # once per machine; pulls platform\u002Faddress data\nbetas \u003C- openSesame('idat_dir', prep = 'QCDPB', func = getBetas)\n# prep codes: Q qualityMask  C inferInfiniumIChannel  D dyeBiasNL  P pOOBAH  B noob\n# pOOBAH masks (sets NA) probes whose out-of-band signal is indistinguishable from background,\n# catching deletion-driven false-intermediate methylation that negative-control detection-p misses\nmvals \u003C- log2(betas \u002F (1 - betas))         # M-values for statistical testing (logit of beta)\n```\n\nFor EPICv2, openSesame detects the platform automatically; the replicate-probe collapse (`betasCollapseToPfx`) belongs to the next stage and is documented in array-qc-filtering.\n\n## Process IDATs with minfi (450K \u002F EPICv1)\n\n**Goal:** Build a normalized GenomicRatioSet and extract beta and M, choosing the normalization by whether global methylation differences are expected.\n\n**Approach:** Read IDATs into an RGChannelSet, compute a detection-p mask before normalizing, then apply funnorm (global differences) or quantile (no global differences); extract beta and M with the offset-100 defaults.\n\n```r\nlibrary(minfi)\nrgSet \u003C- read.metharray.exp(base = 'idat_dir')\ndetP \u003C- detectionP(rgSet)                   # neg-control-based; pre-normalization probe-failure map\n\ngrSet \u003C- preprocessFunnorm(rgSet, nPCs = 2) # noob first, then 2 control-probe PCs; preserves global shifts\n# preprocessQuantile(rgSet) instead when NO global difference is expected (subtle blood EWAS)\n\nbeta \u003C- getBeta(grSet)                       # GenomicRatioSet holds precomputed betas (offset applied upstream)\nmval \u003C- getM(grSet)                          # log2(beta\u002F(1-beta)) on the ratio set\nbeta[detP[rownames(beta), colnames(beta)] > 0.01] \u003C- NA   # mask probes failing detection-p (0.01)\n```\n\nEPICv2 is NOT handled by mainstream minfi (it returns \"Unknown\" and duplicates probe IDs); use sesame for EPICv2.\n\n## Per-Method Failure Modes\n\n### Starting from a supplied beta matrix\n**Trigger:** processing begins from a `.csv`\u002F`.RData` beta matrix instead of IDATs. **Mechanism:** a beta matrix has discarded the raw two-channel intensities, control probes, and out-of-band signal. **Symptom:** noob\u002Ffunnorm\u002FpOOBAH\u002Fdye correction cannot run; detection-p cannot be recomputed. **Fix:** obtain the raw IDAT pairs; treat a beta matrix as a last resort and document that preprocessing could not be applied.\n\n### Type I\u002FII mismatch left in the data\n**Trigger:** testing on raw or only background-corrected betas. **Mechanism:** Type II betas are compressed toward 0.5 relative to Type I. **Symptom:** \"differential\" probes that are design artifacts; a two-peak per-type beta density. **Fix:** apply BMIQ\u002FSWAN or sesame matchDesign (or use openSesame, which corrects channel\u002Fdye) before testing; confirm the two per-type peaks align.\n\n### minfi on EPICv2\n**Trigger:** `read.metharray.exp` on EPICv2 IDATs with mainstream minfi. **Mechanism:** EPICv2 is not auto-detected; 5,483 loci carry duplicate IDs. **Symptom:** array reads as \"Unknown\"; `getBeta()` returns repeated rownames so `match()`-based merges silently misbehave. **Fix:** use sesame (EPICv2-native), or install a third-party EPICv2 manifest\u002Fanno, tag the annotation manually, and collapse replicates in array-qc-filtering.\n\n### Quantile-normalizing a global-difference contrast\n**Trigger:** `preprocessQuantile` on cancer vs normal or cross-tissue data. **Mechanism:** between-array quantile assumes equal marginal beta distributions. **Symptom:** real global hypomethylation flattened away. **Fix:** use funnorm (control-probe PCs preserve global shifts); reserve quantile\u002Fdasen for subtle no-global-difference designs.\n\n### Testing on beta instead of M\n**Trigger:** limma\u002Ft-tests run directly on beta. **Mechanism:** beta is heteroscedastic (variance collapses near 0 and 1). **Symptom:** miscalibrated variance; inflated or deflated p-values at extreme methylation. **Fix:** test on M-values, report delta-beta for effect size.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|-----------|--------|-----------|\n| beta offset `alpha = 100` | Aryee 2014; minfi default | stabilizes the ratio when M and U are both near zero |\n| detection-p `> 0.01` = failed | minfi convention | signal indistinguishable from background; beta is noise |\n| pOOBAH default p ~ 0.05 | Zhou 2018 | OOB-based mask; also catches deletion-driven false intermediate methylation |\n| funnorm `nPCs = 2` | Fortin 2014 | first 2 control-probe PCs absorb technical variation without erasing biology |\n| Test on M-values, report delta-beta | Du 2010 | M is homoscedastic for modeling; beta is interpretable for effect size |\n| sesame prep `QCDPB` (ordered) | Zhou 2018 | Q quality, C channel, D dye, P pOOBAH, B noob - the validated default order |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| Array reads as \"Unknown\" | EPICv2 in mainstream minfi | use sesame; or third-party manifest + manual annotation tag |\n| `getBeta()` has repeated rownames | EPICv2 duplicate probe IDs | collapse replicates (array-qc-filtering); do not merge by ID first |\n| Two-peak beta density per probe type | Type I\u002FII design bias uncorrected | BMIQ\u002FSWAN\u002FopenSesame before testing |\n| Global signal vanished after normalization | quantile applied to a global-difference study | use funnorm |\n| `sesameDataCache` \u002F platform-not-found | hub not cached | run `sesameDataCache()` once before processing |\n| Coordinates misalign merging EPICv2 with 450K | EPICv2 is hg38, 450K\u002FEPICv1 hg19 | track build per array; liftover before merging (array-qc-filtering) |\n\n## References\n\n- Aryee MJ, Jaffe AE, Corrada-Bravo H, et al. 2014. Minfi: a flexible and comprehensive Bioconductor package for the analysis of Infinium DNA methylation microarrays. *Bioinformatics* 30:1363-1369.\n- Zhou W, Triche TJ Jr, Laird PW, Shen H. 2018. SeSAMe: reducing artifactual detection of DNA methylation by Infinium BeadChips in genomic deletions. *Nucleic Acids Res* 46:e123.\n- Triche TJ Jr, Weisenberger DJ, Van Den Berg D, Laird PW, Siegmund KD. 2013. Low-level processing of Illumina Infinium DNA methylation BeadArrays. *Nucleic Acids Res* 41:e90.\n- Fortin JP, Labbe A, Lemire M, et al. 2014. Functional normalization of 450k methylation array data improves replication in large cancer studies. *Genome Biol* 15:503.\n- Maksimovic J, Gordon L, Oshlack A. 2012. SWAN: subset-quantile within array normalization for Illumina Infinium HumanMethylation450 BeadChips. *Genome Biol* 13:R44.\n- Teschendorff AE, Marabita F, Lechner M, et al. 2013. A beta-mixture quantile normalization method for correcting probe design bias in Illumina Infinium 450k DNA methylation data. *Bioinformatics* 29:189-196.\n- Pidsley R, Wong CCY, Volta M, Lunnon K, Mill J, Schalkwyk LC. 2013. A data-driven approach to preprocessing Illumina 450K methylation array data. *BMC Genomics* 14:293.\n- Du P, Zhang X, Huang CC, et al. 2010. Comparison of Beta-value and M-value methods for quantifying methylation levels by microarray analysis. *BMC Bioinformatics* 11:587.\n- Tian Y, Morris TJ, Webster AP, et al. 2017. ChAMP: updated methylation analysis pipeline for Illumina BeadChips. *Bioinformatics* 33:3982-3984.\n- Kaur D, Lee SM, Goldberg D, et al. 2023. Comprehensive evaluation of the Infinium human MethylationEPIC v2 BeadChip. *Epigenetics Commun* 3:6.\n\n## Related Skills\n\n- array-qc-filtering - Probe and sample QC\u002Ffiltering downstream of preprocessing\n- differential-cpg-testing - Per-CpG testing on the resulting beta\u002FM matrix\n- dmr-detection - DMRcate array-mode region calling\n- cell-type-deconvolution - Consumes the clean beta matrix\n- epigenetic-clocks - Consumes the clean beta matrix\n- ewas-design - Study design, batch, and inference layer\n- long-read-sequencing\u002Fnanopore-methylation - Native long-read methylation (different platform)\n- workflows\u002Fmethylation-pipeline - End-to-end 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\u002Farray-preprocessing\u002FSKILL.md","sesame","GPTomics\u002FbioSkills","main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fbiology\u002Fbio-methylation-array-preprocessing","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-array-preprocessing",{"tool":42,"command":43},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-methylation-array-preprocessing",{"tool":45,"command":46},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-methylation-array-preprocessing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-methylation-array-preprocessing\u002FSKILL.md",true,[50,56],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"examples\u002Farray_preprocessing.R","OTHER","其他",1451,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-methylation-array-preprocessing\u002Fexamples\u002Farray_preprocessing.R",{"path":57,"resourceType":58,"resourceTypeDesc":59,"sizeBytes":60,"sourceHtmlUrl":61},"usage-guide.md","REFERENCE","参考文档",5628,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-methylation-array-preprocessing\u002Fusage-guide.md",[63,71,78,85,92,99],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":70},"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":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":70},"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":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":70},"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":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":70},"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":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":70},"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":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":70},"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",[],[]]