minfi dmpFinder: is SVA correction built-in?

278 views
Skip to first unread message

Shraddha Pai

unread,
Mar 22, 2016, 9:05:56 PM3/22/16
to Epigenomics forum
Hi everyone,

I'd like to account for batch effects when running minfi::dmpFinder. 
The R code for dmpFinder suggests that it is already doing this; can someone please confirm whether this interpretation is correct?

When shrinkVar=FALSE (assume type="categorical"), dmpFinder seems to be running an F-test comparing a null model to a full model:

Code from dmpFInder (minfi version 1.16.1) : 

 if (type == "categorical") {
        pheno <- factor(as.character(pheno))
        design <- model.matrix(~pheno)
        fit <- lmFit(M, design) # full model
        if (shrinkVar) {
            fit <- contrasts.fit(fit, contrasts(pheno))
            fit <- eBayes(fit)
            tab <- data.frame(intercept=fit$coefficients[, 1], f=fit$F, pval=fit$F.p.value)
        } else {
            fit1 <- lmFit(M) # null model
            RSS1 <- rowSums((M - fitted(fit1))^2)
            RSS <- rowSums((M - fitted(fit))^2)
            df1 <- length(levels(pheno)) - 1
            df2 <- n - length(levels(pheno))
            F <- ((RSS1 - RSS)/df1)/(RSS/df2)
            if (df2 > 1e+06) {
                F.p.value <- pchisq(df1 * F, df1, lower.tail=FALSE)
            }
            else {
                F.p.value <- pf(F, df1, df2, lower.tail=FALSE)
            }
            tab <- data.frame(intercept=fit$coefficients[, 1], f=F, pval=F.p.value)
        }

This seems somewhat similar to the code recommended for SVA in this BioC tutorial (https://www.bioconductor.org/help/course-materials/2015/BioC2015/methylation450k.html):

mod <- model.matrix(~as.factor(status), data=pheno) mod0 <- model.matrix(~1, data=pheno) sva.results <- sva(mval, mod, mod0)

Does this mean batch effects are implicitly controlled for in this situation? If batch effects are all we want to control for, is there any value to doing SVA in addition?

Thanks,
Shraddha
----
Shraddha Pai
Postdoctoral Fellow, http://baderlab.org, University of Toronto
Affiliate Scientist, The Centre for Addiction and Mental Health, Toronto

Kasper Daniel Hansen

unread,
Mar 22, 2016, 9:16:45 PM3/22/16
to epigenom...@googlegroups.com
No, its not correcting for batch effects.

Look, I see many people using dmpFinder, as if its something special.  But really, its nothing magical, just a 10 minute hack for doing a completely standard limma analysis on M or beta values.  With two groups, the code basically reduces to doing (moderated) t-tests (moderated if shrinkVar = TRUE).

Best,
Kasper

--
You received this message because you are subscribed to the Google Groups "Epigenomics forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to epigenomicsfor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages