Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Error when running DESeqDataSetFromMatrix inside Rstudio or inside a loop #117

@MiguelJulia

Description

@MiguelJulia

Hi,

Since a week ago, I have beeing facing this error when rerunning old Rmd files that used to work without any issue:

dds <- DESeqDataSetFromMatrix(countData=as.matrix(round(countData)), colData=metaData, design= ~ dex )

Returns this error when executed inside Rstudio in a Rmarkdown or when trying to Knit it into an html:

converting counts to integer mode Error in validObject(.Object) : invalid class “DESeqDataSet” object: 'NAMES' slot must be set to NULL at all time

BUT, when running it in the terminal using same R version and same DESEQ2 version, it runs without errors. The error returns inside the terminal when running the function inside a loop, like in this example which used to work before:

metaData$dex <- as.factor(metaData$dex)

for(i in 1:(length(levels(metaData$dex)))){
  dex1 <- levels(metaData$dex)[i]
  
  metaData$tmp <- as.character(metaData$dex)
  metaData$tmp[metaData$tmp != dex1] <- "others"
  metaData$tmp <- as.factor(metaData$tmp)
  
  dds <- DESeqDataSetFromMatrix(countData=round(countData), 
                              colData=metaData, 
                              design= ~ tmp )
}

Why is this happening?

This is my session.info():

> sessionInfo()
R version 4.5.1 (2025-06-13)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0  LAPACK version 3.12.0

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       

time zone: Europe/Madrid
tzcode source: system (glibc)

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] ggrepel_0.9.6               dplyr_1.1.4                
 [3] ggplot2_3.5.2               DESeq2_1.48.1              
 [5] SummarizedExperiment_1.38.1 Biobase_2.68.0             
 [7] MatrixGenerics_1.20.0       matrixStats_1.5.0          
 [9] GenomicRanges_1.60.0        GenomeInfoDb_1.44.1        
[11] IRanges_2.42.0              S4Vectors_0.46.0           
[13] BiocGenerics_0.54.0         generics_0.1.3             

loaded via a namespace (and not attached):
 [1] Matrix_1.7-3            gtable_0.3.6            jsonlite_2.0.0         
 [4] compiler_4.5.1          crayon_1.5.3            tidyselect_1.2.1       
 [7] Rcpp_1.1.0              parallel_4.5.1          scales_1.3.0           
[10] BiocParallel_1.42.1     lattice_0.22-7          R6_2.6.1               
[13] XVector_0.48.0          S4Arrays_1.8.1          tibble_3.2.1           
[16] DelayedArray_0.34.1     munsell_0.5.1           GenomeInfoDbData_1.2.14
[19] pillar_1.11.0           rlang_1.1.6             SparseArray_1.8.1      
[22] cli_3.6.5               withr_3.0.2             magrittr_2.0.3         
[25] locfit_1.5-9.12         grid_4.5.1              lifecycle_1.0.4        
[28] vctrs_0.6.5             glue_1.8.0              codetools_0.2-20       
[31] abind_1.4-8             colorspace_2.1-1        httr_1.4.7             
[34] pkgconfig_2.0.3         tools_4.5.1             UCSC.utils_1.4.0      

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions