Epigenome-Wide Association Studies: a hands-on tutorial

From raw IDATs to annotated hits, using the Grady Trauma Project (GSE132203)

Who this is for

This tutorial is written for rotation students and anyone new to array-based DNA methylation analysis. It walks the full path from raw Illumina IDAT files to a set of annotated, genome-wide association results, running every step for real on a teaching subset of a public dataset. By the end you will have:

  • read raw two-channel IDATs into R and understood what the numbers mean;
  • run the quality-control checks that decide which samples and probes to trust;
  • normalized the data and filtered unreliable probes using ancestry-aware masks;
  • estimated blood cell composition and diagnosed technical batch structure;
  • fit an epigenome-wide model, run it reproducibly as a Snakemake pipeline, and annotated the top CpGs and regions.

The dataset

We use GSE132203, the Grady Trauma Project — whole-blood Illumina MethylationEPIC (v1, 850K) profiles from an adult cohort deeply phenotyped for trauma exposure and PTSD. It was chosen for teaching because it is unusually complete:

Feature Why it matters for teaching
Raw IDATs deposited Lets us start from the true beginning, not a processed matrix
N = 795 (we use a 96-sample subset) Big enough to be realistic, small enough to run live
Deposited cell-type proportions An answer key to validate our own deconvolution
Sentrix barcodes in filenames Real chip/position structure for the batch-effects lesson
Explicit age & sex, multiple exposures Proper covariate modeling, several candidate outcomes

How the teaching subset was chosen

The Grady Trauma Project was selected for this tutorial in specific because I wanted to be able to provide a walkthrough that shows:

  1. How to process from raw IDAT files,
  2. Uses whole blood as the tissue source since this is a common tissue used in methylation studies and requires some additional consideration in statistical modeling.
  3. Has available phenotype data for a disease or trait association testing, as well as sex and age demographic information.

The resulting balance of the 96 samples chosen for the tutorial subset:

Code
bal <- list(
  PTSD          = table(ss$ptsd, useNA = "ifany"),
  Sex           = table(ss$gender),
  Race          = table(ss$race, useNA = "ifany")
)
bal
$PTSD

   Case Control    <NA> 
     32      55       9 

$Sex

Female   Male 
    49     47 

$Race

         AA Other 
    1    91     4 
Code
cat("\nAge: range", paste(range(ss$age, na.rm=TRUE), collapse="-"),
    "| mean", round(mean(ss$age, na.rm=TRUE), 1), "\n")

Age: range 18-66 | mean 42.5 
Code
cat("Chips carrying both PTSD classes:",
    sum(tapply(ss$ptsd, ss$slide, function(x) length(unique(na.omit(x)))>1)),
    "of", length(unique(ss$slide)), "\n")
Chips carrying both PTSD classes: 12 of 12 
NoteA bonus lesson I can teach with the Grady Trauma Project

This cohort is ~95% African American, which means in addition to the main tutorial lessons I wanted to achieve, I also get to showcase using population-specific SNP (single nucleotide polymorphism) masks. Differences in genomic architecture is observed across populations; a variant may be polymorphic in one population, but is not in another, and vice-versa. SNPs in close proximity to a CpG can impact the ability for the CpG probes to measure the methylation status accurately. Thus, CpGs near common SNPs are typically excluded from downstream analyses. However, not all populations share the same SNPs and masking with the wrong population may cause you to lose true-positive signals and retain false-positive signals.

How the notebooks fit together

The preprocessing-through-analysis arc maps onto these notebooks:

  1. Background — what DNA methylation is and how arrays measure it. Skip it if you already work with methylation data.
  2. Setup — downloading the raw IDATs, reading them into R, and what the whole tutorial costs in time, memory, and disk.
  3. Quality control — detection p-values, intensity, predicted sex, SNP identity.
  4. Normalization — within- and between-array normalization.
  5. Probe filtering — detection-p, cross-reactive, and ancestry-aware SNP masks.
  6. Cell composition — reference-based deconvolution, validated against deposited proportions.
  7. Batch effects — chip and array-position diagnosis; ComBat, and surrogate variables for what remains.
  8. EWAS — the association model, adjusted for sex, age, smoking, array position, cell composition, and surrogate variables.
  9. Snakemake pipeline — the same analysis as a versioned, one-command reproducible workflow, with BACON and sex-stratified meta-analysis.
  10. Annotation — mapping top CpGs to genes, regions (DMRs), and regulatory context.

Each notebook loads the object saved by the previous one, so you can work through them in order or jump to any step and pick up the saved checkpoint.