edgeR: problem with the quasi-likelihood F-test
1
1
Entering edit mode
@estel-kitsune-8393
Last seen 6.4 years ago
Sweden

Hi,

I have a question regarding edgeR, more specifically the glmQLFTest function. I cannot run glmQLFTest, whereas I have no troubles running  glmLRT on the same dataset. Here's my code:

#Creation of the DGElist object
sceset_filt <- readRDS("../intermediate/sceset_filt.rds")  #this is a SingleCellExperiment object
group <- colData(sceset_filt)$cell_identity
counts <- counts(sceset_filt)
y <- DGEList(counts = counts, group = group)
y$genes <- rowData(sceset_filt)$symbol

#Filter to remove low counts
keep <- rowSums(edgeR::cpm(y) > 0.5) >= 2
y$counts <- y$counts[keep,]
y$genes <- y$genes[keep]

y <- calcNormFactors(y)
design <- model.matrix(~ 0 + group)
colnames(design) <- levels(group)
y <- estimateDisp(y, design = design)
con1 <- makeContrasts("Brain_double_positive - Ubrain_double_positive", levels=design)

#when trying to perform quasi-likelihood F-test
fit <- glmQLFit(y, design = design)
res <- glmQLFTest(fit, coef = ncol(fit$design), contrast = con1)
Error in object[[a]][i, , drop = FALSE] : incorrect number of dimensions
#when performing LRT test
fit2 <- glmFit(y,design = design)
lrt <- glmLRT(fit2, coef = ncol(fit2$design), contrast = con1)
topTags(lrt)
Coefficient:  1*Brain_double_positive -1*Ubrain_double_positive
                          ID     logFC    logCPM        LR       PValue
ENSMUSG00000020591     Ntsr2 -5.067292 10.211872 170.58070 5.525055e-39
ENSMUSG00000031760       Mt3 -4.659873 10.607507 164.66813 1.080953e-37
ENSMUSG00000017390     Aldoc -3.601116 12.490920 124.93592 5.256501e-29
...

My "fit" seems like a valid object of class "DGEGLM". In RStudio, the traceback shows:

Error in object[[a]][i, , drop = FALSE] : incorrect number of dimensions

4. subsetListOfArrays(object, i, j, IJ = IJ, IX = IX, I = I, JX = JX)

3. [.DGEGLM`(glmfit, i, )

2. glmfit[i, ]

1. glmQLFTest(fit, contrast = con1)

 

Can someone help me understand what the problem is?

Thanks!

 

> sessionInfo()

R version 3.5.0 (2018-04-23)

Platform: x86_64-apple-darwin15.6.0 (64-bit)

Running under: macOS High Sierra 10.13.5

 

Matrix products: default

BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib

LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

 

locale:

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

 

attached base packages:

[1] stats4    parallel  stats     graphics  grDevices utils     datasets

[8] methods   base     

 

other attached packages:

[1] scater_1.8.0                SingleCellExperiment_1.2.0

[3] SummarizedExperiment_1.10.1 DelayedArray_0.6.1         

[5] BiocParallel_1.14.1         matrixStats_0.53.1         

[7] GenomicRanges_1.32.3        GenomeInfoDb_1.16.0        

[9] IRanges_2.14.10             S4Vectors_0.18.3           

[11] ggplot2_2.2.1               Biobase_2.40.0             

[13] BiocGenerics_0.26.0         edgeR_3.22.3               

[15] limma_3.36.2                BiocInstaller_1.30.0       

 

loaded via a namespace (and not attached):

[1] Rcpp_0.12.17             locfit_1.5-9.1           lattice_0.20-35         

[4] assertthat_0.2.0         digest_0.6.15            mime_0.5                

[7] R6_2.2.2                 plyr_1.8.4               pillar_1.2.3            

[10] zlibbioc_1.26.0          rlang_0.2.1              lazyeval_0.2.1          

[13] data.table_1.11.4        Matrix_1.2-14            splines_3.5.0           

[16] stringr_1.3.1            RCurl_1.95-4.10          munsell_0.5.0           

[19] shiny_1.1.0              compiler_3.5.0           httpuv_1.4.4.1          

[22] vipor_0.4.5              pkgconfig_2.0.1          ggbeeswarm_0.6.0        

[25] htmltools_0.3.6          tximport_1.8.0           tidyselect_0.2.4        

[28] tibble_1.4.2             gridExtra_2.3            GenomeInfoDbData_1.1.0

[31] viridisLite_0.3.0        dplyr_0.7.5              later_0.7.3             

[34] bitops_1.0-6             grid_3.5.0               xtable_1.8-2            

[37] gtable_0.2.0             magrittr_1.5             scales_0.5.0            

[40] stringi_1.2.3            XVector_0.20.0           reshape2_1.4.3          

[43] viridis_0.5.1            promises_1.0.1           bindrcpp_0.2.2          

[46] DelayedMatrixStats_1.2.0 rjson_0.2.20             Rhdf5lib_1.2.1          

[49] tools_3.5.0              glue_1.2.0               beeswarm_0.2.3          

[52] purrr_0.2.5              colorspace_1.3-2         rhdf5_2.24.0            

[55] shinydashboard_0.7.0     bindr_0.1.1             

 

edgeR glmQLFTest • 1.9k views
ADD COMMENT
2
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 8 hours ago
The city by the bay

I'm willing to bet that the problem is caused by the fact that y$genes should be a data.frame, not a character vector. Tryre-running the code after replacing your y$genes <- assignment with:

y$genes <- data.frame(Symbol=rowData(sceset_filt)$symbol)
ADD COMMENT
0
Entering edit mode

It works! Thanks a lot Aaron!

ADD REPLY

Login before adding your answer.

Traffic: 813 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6