satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.27k stars 910 forks source link

Error with Seurat::CellCycleScoring (Seurat V5) #7977

Closed williamthistle closed 11 months ago

williamthistle commented 11 months ago

Hi,

I'm running into an issue with Seurat::CellCycleScoring() in Seurat V5. It worked fine in Seurat V4, but now produces the following error:

> sc_obj
An object of class Seurat
23341 features across 17601 samples within 1 assay
Active assay: RNA (23341 features, 0 variable features)
 2 layers present: counts.1, counts.2

s.genes <- Seurat::cc.genes.updated.2019$s.genes
g2m.genes <- Seurat::cc.genes.updated.2019$g2m.genes

> sc_obj <- Seurat::CellCycleScoring(object = sc_obj, s.features = s.genes, g2m.features = g2m.genes, set.ident = TRUE)
Error in h(simpleError(msg, call)) :
  error in evaluating the argument 'x' in selecting a method for function 'rowMeans': subscript out of bounds
In addition: Warning message:
Layer ‘data’ is empty

I generated the Seurat object using code like the following:

sc_obj <- Seurat::CreateSeuratObject(counts = all_sc_exp_matrices,
                                           assay = "RNA",
                                           min.cells = 3,
                                           min.features = 3,
                                           project = "unbias")

Here's the sessionInfo():

> sessionInfo()
R version 4.2.3 (2023-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Springdale Open Enterprise Linux 8.8 (Modena)

Matrix products: default
BLAS:   /usr/local/R/4.2.3/lib64/R/lib/libRblas.so
LAPACK: /usr/local/R/4.2.3/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] stats4    grid      stats     graphics  grDevices utils     datasets
[8] methods   base

other attached packages:
 [1] Seurat_5.0.0                SeuratObject_5.0.0
 [3] sp_2.1-1                    SPEEDI_1.1.3.0000
 [5] rhdf5_2.42.1                SummarizedExperiment_1.28.0
 [7] Biobase_2.58.0              MatrixGenerics_1.10.0
 [9] Rcpp_1.0.11                 Matrix_1.6-1.1
[11] GenomicRanges_1.50.2        GenomeInfoDb_1.34.9
[13] IRanges_2.32.0              S4Vectors_0.36.2
[15] BiocGenerics_0.44.0         matrixStats_1.0.0
[17] data.table_1.14.8           stringr_1.5.0
[19] plyr_1.8.9                  magrittr_2.0.3
[21] ggplot2_3.4.4               gtable_0.3.4
[23] gtools_3.9.4                gridExtra_2.3
[25] ArchR_1.0.2

loaded via a namespace (and not attached):
  [1] utf8_1.2.4               spatstat.explore_3.2-5   reticulate_1.34.0
  [4] tidyselect_1.2.0         htmlwidgets_1.6.2        Rtsne_0.16
  [7] devtools_2.4.5           munsell_0.5.0            codetools_0.2-19
 [10] ragg_1.2.6               ica_1.0-3                future_1.33.0
 [13] miniUI_0.1.1.1           withr_2.5.2              spatstat.random_3.2-1
 [16] colorspace_2.1-0         progressr_0.14.0         ROCR_1.0-11
 [19] tensor_1.5               listenv_0.9.0            labeling_0.4.3
 [22] GenomeInfoDbData_1.2.9   polyclip_1.10-6          farver_2.1.1
 [25] rprojroot_2.0.4          parallelly_1.36.0        vctrs_0.6.4
 [28] generics_0.1.3           R6_2.5.1                 doParallel_1.0.17
 [31] ggbeeswarm_0.7.2         bitops_1.0-7             rhdf5filters_1.10.1
 [34] spatstat.utils_3.0-4     cachem_1.0.8             DelayedArray_0.24.0
 [37] promises_1.2.1           scales_1.2.1             beeswarm_0.4.0
 [40] Cairo_1.6-1              globals_0.16.2           processx_3.8.2
 [43] goftest_1.2-3            spam_2.10-0              rlang_1.1.2
 [46] systemfonts_1.0.5        splines_4.2.3            lazyeval_0.2.2
 [49] spatstat.geom_3.2-7      BiocManager_1.30.22      reshape2_1.4.4
 [52] abind_1.4-5              httpuv_1.6.12            tools_4.2.3
 [55] usethis_2.2.2            SeuratData_0.2.2.9001    ellipsis_0.3.2
 [58] RColorBrewer_1.1-3       sessioninfo_1.2.2        ggridges_0.5.4
 [61] zlibbioc_1.44.0          purrr_1.0.2              RCurl_1.98-1.13
 [64] ps_1.7.5                 prettyunits_1.2.0        deldir_1.0-9
 [67] pbapply_1.7-2            cowplot_1.1.1            urlchecker_1.0.1
 [70] zoo_1.8-12               ggrepel_0.9.4            cluster_2.1.4
 [73] fs_1.6.3                 RSpectra_0.16-1          scattermore_1.2
 [76] lmtest_0.9-40            RANN_2.6.1               fitdistrplus_1.1-11
 [79] pkgload_1.3.3            patchwork_1.1.3          mime_0.12
 [82] xtable_1.8-4             fastDummies_1.7.3        compiler_4.2.3
 [85] tibble_3.2.1             KernSmooth_2.23-22       crayon_1.5.2
 [88] htmltools_0.5.7          later_1.3.1              tidyr_1.3.0
 [91] logr_1.3.4               MASS_7.3-60              rappdirs_0.3.3
 [94] cli_3.6.1                parallel_4.2.3           dotCall64_1.1-0
 [97] igraph_1.5.1             pkgconfig_2.0.3          plotly_4.10.3
[100] spatstat.sparse_3.0-3    foreach_1.5.2            vipor_0.4.5
[103] XVector_0.38.0           callr_3.7.3              digest_0.6.33
[106] sctransform_0.4.1        RcppAnnoy_0.0.21         common_1.1.0
[109] spatstat.data_3.0-3      leiden_0.4.3             uwot_0.1.16
[112] pbmcref.SeuratData_1.0.0 curl_5.1.0               shiny_1.7.5.1
[115] lifecycle_1.0.3          nlme_3.1-163             jsonlite_1.8.7
[118] Rhdf5lib_1.20.0          desc_1.4.2               viridisLite_0.4.2
[121] fansi_1.0.5              pillar_1.9.0             lattice_0.22-5
[124] ggrastr_1.0.2            fastmap_1.1.1            httr_1.4.7
[127] pkgbuild_1.4.2           survival_3.5-7           glue_1.6.2
[130] remotes_2.4.2.1          png_0.1-8                iterators_1.0.14
[133] stringi_1.7.12           profvis_0.3.8            textshaping_0.3.7
[136] RcppHNSW_0.5.0           memoise_2.0.1            dplyr_1.1.3
[139] irlba_2.3.5.1            future.apply_1.11.0
samuel-marsh commented 11 months ago

Hi,

Not member of dev team but hopefully can be helpful. See #7942. You need to join layers before running any functions that use module scoring and data must be normalized first before running cell cycle scoring.

Best, Sam

crebli commented 5 months ago

The same problem when I used the latest Seurat_5.1.0.