seurat icon indicating copy to clipboard operation
seurat copied to clipboard

Error in `rownames<-`(`*tmp*`, value = genes_step1) : attempt to set 'rownames' on an object with no dimensions

Open alexandruioanvoda opened this issue 2 years ago • 2 comments

SCTransform gives me a very weird error for no apparent reason (data appears to be just fine, attached a reproducible slice).

Reproducible example: exp.rds.zip

exp <- readRDS("exp.rds")
data <- CreateSeuratObject(counts = exp,
                           project = "", min.cells = 0, min.features = 0)
data[["percent.mt"]] <- PercentageFeatureSet(data, pattern = "^MT-")
data <- subset(data, subset = nFeature_RNA > 200 & nFeature_RNA < 2500 & nCount_RNA < 20000 & percent.mt < 5)
data <- SCTransform(data, method = "glmGamPoi", vars.to.regress = "percent.mt", verbose = FALSE,
                                 residual_type = "pearson")

Given error is:

Error in `rownames<-`(`*tmp*`, value = genes_step1) : 
  attempt to set 'rownames' on an object with no dimensions

My sessionInfo():

> sessionInfo() R version 3.6.1 (2019-07-05) Platform: x86_64-pc-linux-gnu (64-bit) Running under: CentOS release 6.7 (Final)  Matrix products: default BLAS:   /gfs/apps/apps/R-3.6.1/lib64/R/lib/libRblas.so LAPACK: /gfs/apps/apps/R-3.6.1/lib64/R/lib/libRlapack.so  locale:  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8     [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C         attached base packages: [1] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base       other attached packages:  [1] Rcpp_1.0.3                  SingleR_1.0.5               SummarizedExperiment_1.16.1 DelayedArray_0.12.2         BiocParallel_1.20.1         matrixStats_0.55.0           [7] Biobase_2.46.0              GenomicRanges_1.38.0        GenomeInfoDb_1.22.0         IRanges_2.20.2              S4Vectors_0.24.3            BiocGenerics_0.32.0         [13] Seurat_3.1.4                 loaded via a namespace (and not attached):   [1] AnnotationHub_2.18.0          BiocFileCache_1.10.2          sn_1.5-5                      plyr_1.8.5                    igraph_1.2.4.2                  [6] lazyeval_0.2.2                splines_3.6.1                 listenv_0.8.0                 ggplot2_3.3.3                 TH.data_1.0-10                 [11] digest_0.6.29                 htmltools_0.5.1.1             gdata_2.18.0                  fansi_0.4.1                   magrittr_2.0.1                 [16] memoise_1.1.0                 cluster_2.1.0                 ROCR_1.0-7                    globals_0.14.0                sandwich_2.5-1                 [21] colorspace_1.4-1              blob_1.2.1                    rappdirs_0.3.1                ggrepel_0.8.2                 dplyr_1.0.6                    [26] crayon_1.4.1                  RCurl_1.98-1.1                jsonlite_1.7.2                survival_3.1-12               zoo_1.8-7                      [31] ape_5.3                       glue_1.4.2                    gtable_0.3.0                  zlibbioc_1.32.0               XVector_0.26.0                 [36] leiden_0.3.3                  future.apply_1.7.0            scales_1.1.0                  mvtnorm_1.1-0                 DBI_1.1.0                      [41] bibtex_0.4.2.2                metap_1.3                     plotrix_3.7-7                 xtable_1.8-4                  viridisLite_0.4.0              [46] reticulate_1.22-9000          bit_1.1-15.1                  rsvd_1.0.3                    tsne_0.1-3                    htmlwidgets_1.5.1              [51] httr_1.4.2                    gplots_3.0.3                  RColorBrewer_1.1-2            TFisher_0.2.0                 ellipsis_0.3.0                 [56] ica_1.0-2                     pkgconfig_2.0.3               uwot_0.1.8                    dbplyr_2.1.1                  utf8_1.1.4                     [61] here_1.0.1                    AnnotationDbi_1.48.0          later_1.0.0                   tidyselect_1.1.1              rlang_0.4.11                   [66] reshape2_1.4.3                munsell_0.5.0                 BiocVersion_3.10.1            tools_3.6.1                   generics_0.0.2                 [71] RSQLite_2.2.0                 ExperimentHub_1.12.0          ggridges_0.5.2                fastmap_1.0.1                 stringr_1.4.0                  [76] yaml_2.2.1                    npsurv_0.4-0                  bit64_0.9-7                   fitdistrplus_1.0-14           caTools_1.18.0                 [81] purrr_0.3.4                   RANN_2.6.1                    pbapply_1.4-2                 future_1.21.0                 nlme_3.1-140                   [86] mime_0.9                      compiler_3.6.1                plotly_4.9.2                  curl_4.3                      png_0.1-7                      [91] interactiveDisplayBase_1.24.0 lsei_1.2-0                    tibble_3.1.1                  stringi_1.4.5                 lattice_0.20-38                [96] Matrix_1.2-17                 multtest_2.42.0               vctrs_0.3.8                   mutoss_0.1-12                 pillar_1.6.0                  [101] lifecycle_1.0.0               BiocManager_1.30.10           Rdpack_0.11-1                 lmtest_0.9-37                 RcppAnnoy_0.0.16              [106] BiocNeighbors_1.4.2           data.table_1.12.8             cowplot_1.0.0                 bitops_1.0-6                  irlba_2.3.3                   [111] gbRd_0.4-11                   httpuv_1.5.2                  patchwork_1.0.0               R6_2.4.1                      promises_1.1.0                [116] KernSmooth_2.23-15            gridExtra_2.3                 parallelly_1.22.0             codetools_0.2-16              MASS_7.3-51.4                 [121] gtools_3.8.1                  assertthat_0.2.1              rprojroot_2.0.2               sctransform_0.2.1             mnormt_1.5-6                  [126] multcomp_1.4-12               GenomeInfoDbData_1.2.2        grid_3.6.1                    tidyr_1.1.3                   DelayedMatrixStats_1.8.0      [131] Rtsne_0.15                    shiny_1.4.0                   numDeriv_2016.8-1.1

alexandruioanvoda avatar May 10 '22 11:05 alexandruioanvoda

Version with verbose=TRUE:

> data <- SCTransform(data, method = "glmGamPoi", vars.to.regress = "percent.mt", verbose = TRUE,
+                                  residual_type = "pearson")
Calculating cell attributes for input UMI matrix
Variance stabilizing transformation of count matrix of size 665 by 20
Model formula is y ~ log_umi
Get Negative Binomial regression parameters per gene
Using 665 genes, 20 cells
  |=============================================================================================================================================================================| 100%
Error in `rownames<-`(`*tmp*`, value = genes_step1) : 
  attempt to set 'rownames' on an object with no dimensions

alexandruioanvoda avatar May 10 '22 11:05 alexandruioanvoda

Can you update to a more recent version of sctransform? I am unable to reproduce this with the latest version:

data <- SCTransform(data, method = "glmGamPoi")
Calculating cell attributes from input UMI matrix: log_umi
Variance stabilizing transformation of count matrix of size 665 by 20
Model formula is y ~ log_umi
Get Negative Binomial regression parameters per gene
Using 665 genes, 20 cells
  |==============================================================================| 100%
Found 28 outliers - those will be ignored in fitting/regularization step

Second step: Get residuals using fitted parameters for 665 genes
  |==============================================================================| 100%
Computing corrected count matrix for 665 genes
  |==============================================================================| 100%
Calculating gene attributes
Wall clock passed: Time difference of 1.5068 secs
Determine variable features
Place corrected count matrix in counts slot
Centering data matrix
  |==============================================================================| 100%
Set default assay to SCT

saketkc avatar May 10 '22 13:05 saketkc

Closing due to inactivity. Feel free to reopen if you are still facing issues.

saketkc avatar Jun 30 '23 19:06 saketkc