[BioC] how to make makeContrast in edgeR?

wang peter wng.peter at gmail.com
Sun Aug 26 04:35:08 CEST 2012


contrasts.fit cannnot work on glmFit
such is my coding:

d <- DGEList(counts = d, lib.size = lib_size)
#normalization
dge <- calcNormFactors(d)
rm(d)

fac=factor(c('c0h','c0h','c0h','c24h','c24h','c24h','t0h','t0h','t0h','t6h','t6h','t6h','t6h','t12h','t12h','t12h','t12h','t18h','t18h','t18h','t18h',
             't24h','t24h','t24h','t36h','t36h','t36h','t48h','t48h','t48h','c6h','c12h','c18h','c36h','c48h'))
design = model.matrix(~fac)
colnames(design) <- levels(fac)
contrast.matrix =
makeContrasts("t0h-c0h","t6h-c6h","t12h-c12h","t18h-c18h","t24h-c24h","t36h-c36h","t48h-c48h","t48h-c0h",levels=design)

dge <- estimateGLMCommonDisp(dge, design)#
dge <- estimateGLMTagwiseDisp(dge, design)
glmfit.dge <- glmFit(dge, design, dispersion=dge$tagwise.dispersion)#

fit1 <- contrasts.fit(glmfit.dge, contrast.matrix)

Error in cov2cor(fit$cov.coefficients) :
  'V' is not a square numeric matrix

fit2 <- eBayes(fit1)
topTable(fit2, coef=1, adjust="BH")



More information about the Bioconductor mailing list