This skill covers the design-and-inference layer of an epigenome-wide association study (EWAS) on 450K/EPIC array or bisulfite methylation - the part that decides whether a hit is credible, which lives BEFORE the per-CpG test. It teaches the confounding hierarchy (cell composition as the dominant confounder, then batch/Sentrix chip/array position, age/sex, smoking, genetic ancestry/mQTL, and reverse causation/tissue relevance), how to randomize samples to chips at design time, how to remove unwanted variation with surrogate variable analysis (sva/SmartSVA), ComBat, and RUVm without over-correcting, how to handle genomic inflation with BACON instead of GWAS genomic control, which genome-wide significance threshold to use per array, how to power an EWAS with pwrEWAS, how to meta-analyze, how to replicate via the EWAS Catalog/Atlas, and how to build and interpret a methylation risk score (MRS).
The idea that reframes the whole analysis: an EWAS hit is a cell-composition difference until proven otherwise, and the signal (often under 2% methylation) is smaller than every confounder, so the p-value is the last and least interesting thing.
R / Bioconductor packages:
BiocManager::install(c('meffil', 'sva', 'bacon', 'limma', 'missMethyl', 'minfi'))
install.packages('SmartSVA')
BiocManager::install('pwrEWAS') # power estimation
Python (optional helper for layout balance checks):
pip install pandas numpy
Conceptual prerequisites: - A normalized methylation matrix (betas and/or M-values) with samples in columns and CpGs in rows, plus a sample sheet carrying phenotype, age, sex, Sentrix chip/position, and plate. - Cell-type proportions are estimated upstream (see cell-type-deconvolution) and supplied here as covariates. - ComBat and per-CpG modeling run on M-values (logit of beta); effect sizes are reported back on the beta / delta-beta scale. - The array version (450K vs EPIC v1 vs EPIC v2) sets the genome-wide threshold - confirm against the manifest.
Tell your AI agent what you want to do: - "Design a balanced chip layout for my case-control methylation study" - "Pick the covariate set for a blood EWAS of my phenotype" - "Run an EWAS and correct genomic inflation with BACON" - "Choose the genome-wide significance threshold for an EPIC array" - "Power an EWAS to detect a 2% methylation difference" - "Check whether my top CpG is a known smoking/age hit before claiming novelty" - "Use a methylation smoking score as a covariate instead of self-report"
"I have whole-blood EPIC data for 200 cases and 200 controls. Build the EWAS covariate model, explain why cell composition is the dominant confounder, and tell me which covariates to include and why."
"I am about to run 384 samples on EPIC BeadChips. Randomize sample-to-chip and sample-to-position so case/control, age, and sex are balanced across chips, and verify no chip is single-group."
"My EWAS QQ plot looks inflated with lambda 1.3. Explain why GWAS genomic control is wrong here, and correct the bias and inflation with BACON, reporting the empirical-null bias and inflation."
"I am adding surrogate variables with SmartSVA. Show me how to monitor the smoking positive control cg05575921 through the correction so I do not over-correct."
"Set the genome-wide significance threshold for my 450K study, report both FWER and FDR hits with delta-beta effect sizes, and tell me how to triage hits against the EWAS Catalog."
"Power an EWAS to detect a 2% delta-beta at genome-wide significance in blood using pwrEWAS, and explain why we will likely need meta-analysis."
"Explain the difference between a polygenic risk score and a methylation risk score, and whether I should treat my DNAm score for disease X as a cause or a consequence."