The code that used to work in R 3.6.1 is giving me an error in R 4.0. The exact error is discussed in the github thread at github/Bioconductor/SummarizedExperiment/ but I have trouble understanding how to address the issue based on the discussion there. The culprit is the following line:
DESeqDataSetFromMatrix(countData=RNASeqCnts$counts, colData=cData, design=~sex+group)
Which gives the error:
Error in `assays<-`(`*tmp*`, withDimnames = withDimnames, ..., value = `*vtmp*`) : please use 'assay(x, withDimnames=FALSE)) <- value' or 'assays(x, withDimnames=FALSE)) <- value' when the dimnames on the supplied assay(s) are not identical to the dimnames on RangedSummarizedExperiment object 'x'
The variablle RNASeqCnts$counts
is the output of the ReadsPerGene files from STAR. Head of the file looks like this:
Samples
Tags PM10LTA PM11LTA PM12LTA PM14LTA PM17RTA PM1LTA PM21LTA
ENSMUSG1 0 0 0 0 0 0 0
ENSMUSG2 0 0 0 0 0 0 0
ENSMUSG3 0 0 2 0 0 0 0
ENSMUSG4 0 0 0 0 0 0 0
Please let me know if dim() information is also needed, and for which variables if that would help. I have included both sessionInfos at the end.
Thank you.
R version 4.0.0 (2020-04-24)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.10 (Santiago)
Matrix products: default
BLAS: /share/pkg/R/4.0.0_gcc/lib64/R/lib/libRblas.so
LAPACK: /share/pkg/R/4.0.0_gcc/lib64/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats4 stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] biomaRt_2.46.0 dplyr_1.0.2
[3] edgeR_3.32.0 limma_3.46.0
[5] DESeq2_1.30.0 SummarizedExperiment_1.20.0
[7] Biobase_2.50.0 MatrixGenerics_1.2.0
[9] matrixStats_0.57.0 GenomicRanges_1.42.0
[11] GenomeInfoDb_1.26.2 IRanges_2.24.1
[13] S4Vectors_0.28.1 BiocGenerics_0.36.0
[15] WGCNA_1.69 fastcluster_1.1.25
[17] dynamicTreeCut_1.63-1
loaded via a namespace (and not attached):
[1] bitops_1.0-6 bit64_4.0.5 progress_1.2.2
[4] doParallel_1.0.15 RColorBrewer_1.1-2 httr_1.4.2
[7] tools_4.0.0 backports_1.2.1 R6_2.5.0
[10] rpart_4.1-15 Hmisc_4.4-2 DBI_1.1.0
[13] colorspace_2.0-0 nnet_7.3-14 prettyunits_1.1.1
[16] tidyselect_1.1.0 gridExtra_2.3 curl_4.3
[19] bit_4.0.4 compiler_4.0.0 preprocessCore_1.52.0
[22] htmlTable_2.1.0 xml2_1.3.2 DelayedArray_0.16.0
[25] scales_1.1.1 checkmate_2.0.0 genefilter_1.72.0
[28] askpass_1.1 rappdirs_0.3.1 stringr_1.4.0
[31] digest_0.6.25 foreign_0.8-78 XVector_0.30.0
[34] base64enc_0.1-3 jpeg_0.1-8.1 pkgconfig_2.0.3
[37] htmltools_0.5.0 dbplyr_2.0.0 htmlwidgets_1.5.1
[40] rlang_0.4.8 rstudioapi_0.11 RSQLite_2.2.1
[43] impute_1.64.0 generics_0.1.0 BiocParallel_1.24.1
[46] RCurl_1.98-1.2 magrittr_1.5 GO.db_3.12.1
[49] GenomeInfoDbData_1.2.4 Formula_1.2-4 Matrix_1.2-18
[52] Rcpp_1.0.5 munsell_0.5.0 lifecycle_0.2.0
[55] stringi_1.4.6 zlibbioc_1.36.0 BiocFileCache_1.14.0
[58] grid_4.0.0 blob_1.2.1 crayon_1.3.4
[61] lattice_0.20-41 splines_4.0.0 annotate_1.68.0
[64] hms_0.5.3 locfit_1.5-9.4 knitr_1.28
[67] pillar_1.4.4 geneplotter_1.68.0 codetools_0.2-18
[70] XML_3.99-0.5 glue_1.4.1 latticeExtra_0.6-29
[73] data.table_1.13.6 png_0.1-7 vctrs_0.3.5
[76] foreach_1.5.0 openssl_1.4.1 gtable_0.3.0
[79] purrr_0.3.4 assertthat_0.2.1 ggplot2_3.3.3
[82] xfun_0.14 xtable_1.8-4 survival_3.1-12
[85] tibble_3.0.1 iterators_1.0.12 AnnotationDbi_1.52.0
[88] memoise_1.1.0 cluster_2.1.0 ellipsis_0.3.1
I tried running the suggested BiocManager::install() but I always end up with these packages installing with a non-zero status. Is any of them needed for DESeq2?
This could explain the error you are seeing, but if you want to just fix the error without dealing with installation, you can try my alternative approach (remove conflicting names).
Thank you!
Hi Michael,
I have had this issue since the update to the Summarized Experiment and I was checking if there was an update to the issue I've had previously. Until recently I couldn't get my installation to be valid but a recent update to the packages fixed that. Before that I have been keeping a separate R 3.6 installation just for the generation of the DESeq data matrix.
But, now I have a valid installation and according to your answer above, my rownames of colData and the colnames of counts are both identical and I still get this error. Let me know if there is anything else I can do. I'm replying to this comment because it is relevant to the original post, but if the etiquette is to open a new question, I can do that.
Thank you.
[1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
Try restarting your R session. I think this was limited to those with mixed installations.
We’ve never had this issue on the bioc build machines for example.
If that fails you can remove dimnames from the count matrix, and then add rownames after.
Restarting the R session did not work. But your other suggestion worked. Thank you.
For the future readers, addition of the following lines worked.
Excuse me,Sir. I wonder which location should I put these word in?
You have to remove dimnames before the line with DESeqDataSetFromMatrix() and assign the dimnames again after that.
Hope this helps.