[BioC] urgent help: meet an error in using edgeR

Martin Morgan mtmorgan at fhcrc.org
Sun Aug 26 23:03:33 CEST 2012


On 08/26/2012 12:52 PM, wang peter wrote:
>> 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)
>> >dge <- estimateGLMCommonDisp(dge, design)#估计tag wise方差,必须先估计common方差
>> >dge <- estimateGLMTagwiseDisp(dge, design)
>> >glmfit.dge <- glmFit(dge, design, dispersion=dge$tagwise.dispersion)#注意推荐使用tag wise方差
>> >t0_c0 = makeContrasts("t0h-c0h",levels=design)
>> >lrt.dge <- glmLRT(dge, glmfit.dge, contrast = t0_c0)

provide the _vector_ rather than matrix to contrast

   lrt.dge <- glmLRT(dge, glmfit.dge, contrast = t0_c0[,1])

(this is a subtle issue in glmLRT, where with contrast as a matrix 
argument, in

   tab <- data.frame(logFC = logFC, logCPM = (glmfit$abundance +
     log(1e+06))/log(2), LR = LR, PValue = LRT.pvalue, row.names = rn)

logFC is also a matrix and 'tab' has first column named after the matrix 
column, rather than 'logFC').

Martin

>> >result <- topTags(lrt.dge, n=dim(dge)[1], adjust.method="BH", sort.by="p.value")


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioconductor mailing list