Context: I've been doing some in silico research involving large-scale simulations with various DGE packages. I detected an error (detailed below) in my simulations that seemed new to edgeR 4.2.1 and did not occur in earlier versions.
The following example might involve some non-sensical data, but I was able to reduce the original, meaningful, large-scale simulation dataset to this 3 by 3 one for debugging convenience.
count <- data.frame( c1=c(2,0,0), c2=c(1,2,4), c3=c(2,0,1))
norms <- c(0.65001, 1, 1.7)
groups <- c('case', 'control', 'case')
genes <- c('G1', 'G2', 'G3')
libsize <- c(1,1,1)
library(edgeR)
dglist <- DGEList(count, libsize, norms, group=groups, genes=genes )
library(stats)
dm <- model.matrix( ~ groups )
dglist <- estimateGLMCommonDisp(dglist, design=dm)
dglist <- estimateGLMTrendedDisp(dglist, design=dm)
dglist <- estimateGLMTagwiseDisp(dglist, design=dm)
fit <- glmQLFit(dglist, dm)
And this leads to the error:
Error in .compressOffsets(y, lib.size = lib.size, offset = offset) :
offsets must be finite values
Some further observations:
- Weird enough, if "0.65001" was changed into "0.65", there wouldn't be any such error and the GLM fit would go through.
- If "4" in the count matrix was changed into "3", there wouldn't be this error.
- A cursory dive into the source code tells me that in
.compressOffsets()
, theoffset
is obtained fromgetOffset(dglist)
, which is completely specified by my inputs and should be equal tolog(norms)
. Indeed, if I entergetOffset(dglist)
, I get the correct values-0.4307814 0.0000000 0.5306283
. The error here, however, is only supposed to be raised when these offsets are infinite. - This happens with edgeR version 4.2.1 on both my local PC (Windows) and server (Linux). But this did not happen with earlier version 4.0.x, as I remember.
Regards,
Hongjian
hjnwang [at] cmu [dot] edu