-
Notifications
You must be signed in to change notification settings - Fork 28
Running EWAS
epzjlm edited this page Apr 4, 2018
·
10 revisions
Meffil has four different EWAS models implemented:
- none=no covariates
- all=user covariates
- sva=surrogate variables in addition to user covariates
- isva=independent surrogate variables in addition to user covariates
See here for a link to the sva paper and here for the isva paper.
load(beta_file) # methylation betas: CpGs in rows, samples in cols
# assume that it loads a matrix called 'norm.beta'
covs <- read.table(covs_file, he=T, stringsAsFactors=FALSE) #covariate file: samples in rows, covs in cols
# assume that the rownames of 'covs' correspond to the column names of 'norm.beta'
phen <- read.table(phen_file, he=T, stringsAsFactors=FALSE) #phenotype file: samples in rows, phenotypes in cols
# assume that the rownames of 'phen' correspond to the column names of 'norm.beta'
# assume that the first column of 'phen' is the phenotype of interest for the EWAS
phen<-na.omit(phen)
norm.beta <- norm.beta[, colnames(norm.beta) %in% rownames(phen)]
phen <- phen[match(colnames(norm.beta), rownames(phen)), , drop=FALSE]
stopifnot(identical(rownames(phen), colnames(norm.beta)))
covs <- covs[match(colnames(norm.beta), rownames(covs)), , drop=FALSE]
stopifnot(identical(rownames(covs), colnames(norm.beta)))
set.seed(123456) #to make siva and sva reproducible you need to set a seed.
ewas.ret <- meffil.ewas(norm.beta, variable=phen[,1], covariates=covs, isva=F)
save(ewas.ret, file="myewas.Robj")
# This function sets your default model and your significance threshold. It will show statistics for all four models for all CpGs that pass significance threshold with the default model.
ewas.parameters <- meffil.ewas.parameters(sig.threshold=1e-7, ## EWAS p-value threshold
max.plots=100, ## plot at most 100 CpG sites
qq.inflation.method="median", ## measure inflation using median
model="sva") ## select default EWAS model;
ewas.summary<-meffil.ewas.summary(ewas.ret,norm.beta,parameters=ewas.parameters)
meffil.ewas.report(ewas.summary, output.file=paste(report_file,".ewas.report.html",sep=""))
- Installation
- Sample QC
- Functional normalization
- Functional normalizing separate datasets
- Extracting structural variants
- Estimating cellular composition
- Removing chrX and chrY probes
- Running EWAS
- Extracting CpG annotations
- Extracting SNP annotations
- Extracting detection p-values
- Extracting methylated and unmethylated intensities
- Generate normalization report from normalised betas
- Full pipeline for analysing massive datasets
- Common problems
- Citation