Skip to contents

This tutorial shows a minimal end-to-end workflow for easyEWAS.

Download Annotation by Chip Type (Must Read)

Supported chipType values:

  • 27K — Infinium HumanMethylation27 BeadChip
  • 450K — Infinium HumanMethylation450 BeadChip
  • EPICV1 — Infinium MethylationEPIC BeadChip (v1.0)
  • EPICV2 — Infinium MethylationEPIC BeadChip (v2.0)
  • MSA — Infinium Methylation Screening Array

Function signature:

downloadAnnotEWAS(
  chipType = c("EPICV2", "EPICV1", "450K", "27K", "MSA"),
  cache_dir = NULL,
  force = FALSE,
  base_url = getOption(
    "easyEWAS.annotation_base_url",
    "https://github.com/ytwangZero/easyEWAS_materials/raw/main/annotation"
  ),
  quiet = FALSE
)

Common usage examples:

# 1) Download one chip annotation (most common)
downloadAnnotEWAS(chipType = "EPICV2")

# 2) Download multiple chips at once
downloadAnnotEWAS(chipType = c("EPICV2", "450K"))

# 3) Force refresh existing cache files
downloadAnnotEWAS(chipType = "EPICV2", force = TRUE)

# 4) Use a custom cache folder
downloadAnnotEWAS(chipType = "EPICV2", cache_dir = "/path/to/annotation_cache")

1. Run a minimal EWAS workflow

By default, initEWAS() keeps results in memory only. In this quickstart, we enable file export so output files will be written under the current working directory.


res <- initEWAS(outpath = getwd(), export = TRUE)

data("sampledata", package = "easyEWAS")
data("methydata", package = "easyEWAS")

res <- loadEWAS(
  input = res,
  ExpoData = sampledata,
  MethyData = methydata
)

res <- transEWAS(
  input = res,
  Vars = "cov1",
  TypeTo = "factor"
)

res <- startEWAS(
  input = res,
  model = "lm",
  expo = "var",
  cov = "cov1,cov2",
  chipType = "EPICV2"
)

2. Optional downstream analyses


res <- plotEWAS(
  input = res,
  p = "PVAL",
  threshold = 0.05,
  file = "jpg"
)

res <- bootEWAS(
  input = res,
  filterP = "PVAL",
  cutoff = 0.001,
  times = 100
)

res <- enrichEWAS(
  input = res,
  method = "GO",
  filterP = "PVAL",
  cutoff = 0.05
)

For DMR analysis, install DMRcate first:


BiocManager::install("DMRcate")

res <- dmrEWAS(
  input = res,
  chipType = "EPICV2",
  what = "Beta",
  expo = "var",
  cov = "cov1,cov2",
  genome = "hg38"
)

3. Output files

When export = TRUE, outputs are written to the EWASresult folder created by initEWAS(). If export = FALSE, results stay in the returned object instead of being saved to disk.

  • EWASresult/ewasresult.csv
  • Plot files from plotEWAS()
  • Optional downstream result files (bootresult.csv, enrichresult.csv, DMRresult.csv)