Question: DMRcate: incorporating covariates to find DMRs in methylation data?
gravatar for Brian Smith
4.1 years ago by
Brian Smith120
United States
Brian Smith120 wrote:


I was trying to use DMRcate to find differentially methylated regions in illumina 450k methylation data. However, I need to account for covariates (e.g. age). I usually use the 'lm' function to find t-statistics and p-values associated with each CpG. However, with the DMRcate package, I can't see how I can incorporate the co-variates in the analysis.

Did I miss something?



ADD COMMENTlink modified 4.1 years ago by Tim Peters80 • written 4.1 years ago by Brian Smith120
Answer: DMRcate: incorporating covariates to find DMRs in methylation data?
gravatar for Tim Peters
4.1 years ago by
Tim Peters80
Tim Peters80 wrote:

Hi Brian,

The DMRcate experimental setup mirrors that of limma, so all you have to do is pass your design matrix (with covariates), contrast matrix (optional) and coefficient of interest to cpg.annotate(), which contains the calls to lmFit() and internally. So if you have a binary contrast "mytype" with types "1" and "2" and your covariates "mycovariate1", "mycovariate2" and so on, some boilerplate would be:

type <- factor(mytype)
covariate1 <- as.numeric(mycovariate1)
covariate2 <- as.numeric(mycovariate2)

design <- model.matrix(~0 + type + covariate1 + covariate2) #etc as needed
cont.mat <- makeContrasts(c=type1-type2, levels=design)
groupanno <- cpg.annotate(myMs, analysis.type="differential", design=design, contrasts=T, cont.matrix=cont.mat, coef="c")


Best of luck,



ADD COMMENTlink written 4.1 years ago by Tim Peters80

According to ?cpg.annotate, this is only possible with array data. I'd like to do the same with WGBS data - is this not possible with DMRcate?

ADD REPLYlink written 8 months ago by Steven Lockton10

Hi Steven,

This is indeed possible using datatype="sequencing" - please look at the second half of the vignette for a worked example.



Edit My bad, I hadn't realised that the example included only contained output from DSS::DMLtest, not DSS::DMLtest.multiFactor. If you use output from DMLtest.multiFactor (and change some of the colnames so that they reflect the output of DSS:DMLtest) then it should work. See the DSS manual for how to incorporate your covariates.

Cheers, Tim

ADD REPLYlink modified 8 weeks ago • written 4 months ago by Tim Peters80
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 118 users visited in the last hour