satijalab / seurat

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

subset() function stopped working #8110

Closed cbuff1 closed 11 months ago

cbuff1 commented 11 months ago

Please help fix, I've been re-analyzing scRNAseq data and tried to use subset() to pull out cluster populations but subset() stopped working. It gives me the following error code: Error in isVirtualExt(exti) : trying to get slot "virtual" from an object of a basic class ("NULL") with no slots

This is the code that worked previously but no longer works:

Idents(IL12.all.cluster) <- "seurat_clusters" levels(IL12.all.cluster) [1] "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" IL12.all.cluster.3 <- subset(x = IL12.all.cluster, idents = c("3"), invert = FALSE) Error in isVirtualExt(exti) : trying to get slot "virtual" from an object of a basic class ("NULL") with no slots

I've also tried this line of code with Seurat's pbmc_small dataset and the error is reproducible, see below. Not sure if this is a bug issue:

pbmc_small An object of class Seurat 230 features across 80 samples within 1 assay Active assay: RNA (230 features, 20 variable features) 3 layers present: counts, data, scale.data 2 dimensional reductions calculated: pca, tsne p <- pbmc_small View(p) Idents(p) <- "letter.idents" levels(p) [1] "A" "B" p_A. <- subset(x = p, idents = c("A"), invert = FALSE) Error in isVirtualExt(exti) : trying to get slot "virtual" from an object of a basic class ("NULL") with no slots

Session info: R version 4.2.3 (2023-03-15) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 22.04.3 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.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 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

loaded via a namespace (and not attached): [1] nlme_3.1-162 spatstat.sparse_3.0-3 matrixStats_1.1.0 RcppAnnoy_0.0.21 RColorBrewer_1.1-3 httr_1.4.7 sctransform_0.4.1 tools_4.2.3 utf8_1.2.4 R6_2.5.1 irlba_2.3.5.1 KernSmooth_2.23-20
[13] uwot_0.1.16 lazyeval_0.2.2 colorspace_2.1-0 sp_2.1-1 tidyselect_1.2.0 gridExtra_2.3 compiler_4.2.3 progressr_0.14.0 cli_3.6.1 spatstat.explore_3.2-5 plotly_4.10.3 Seurat_4.4.0
[25] scales_1.2.1 spatstat.data_3.0-3 lmtest_0.9-40 ggridges_0.5.4 pbapply_1.7-2 goftest_1.2-3 stringr_1.5.0 digest_0.6.33 spatstat.utils_3.0-4 pkgconfig_2.0.3 htmltools_0.5.7 parallelly_1.36.0
[37] fastmap_1.1.1 htmlwidgets_1.6.2 rlang_1.1.2 rstudioapi_0.15.0 shiny_1.7.5.1 generics_0.1.3 zoo_1.8-12 jsonlite_1.8.7 spatstat.random_3.2-1 ica_1.0-3 dplyr_1.1.3 magrittr_2.0.3
[49] dotCall64_1.1-0 patchwork_1.1.3 Matrix_1.6-2 Rcpp_1.0.11 munsell_0.5.0 fansi_1.0.5 abind_1.4-5 reticulate_1.34.0 lifecycle_1.0.4 stringi_1.7.12 MASS_7.3-58.2 Rtsne_0.16
[61] plyr_1.8.9 grid_4.2.3 parallel_4.2.3 listenv_0.9.0 promises_1.2.1 ggrepel_0.9.4 deldir_1.0-9 miniUI_0.1.1.1 lattice_0.20-45 cowplot_1.1.1 splines_4.2.3 tensor_1.5
[73] pillar_1.9.0 igraph_1.5.1 spatstat.geom_3.2-7 future.apply_1.11.0 reshape2_1.4.4 codetools_0.2-19 leiden_0.4.3 glue_1.6.2 SeuratObject_5.0.0 data.table_1.14.8 png_0.1-8 vctrs_0.6.4
[85] spam_2.10-0 httpuv_1.6.12 polyclip_1.10-6 gtable_0.3.4 RANN_2.6.1 purrr_1.0.2 tidyr_1.3.0 scattermore_1.2 future_1.33.0 ggplot2_3.4.4 mime_0.12 xtable_1.8-4
[97] later_1.3.1 survival_3.5-3 viridisLite_0.4.2 tibble_3.2.1 cluster_2.1.4 globals_0.16.2 fitdistrplus_1.1-11 ellipsis_0.3.2 ROCR_1.0-11

cbuff1 commented 11 months ago

Problem was solved by downgrading packages Matrix (1.6-1.1), SeuratObject (4.1.4) and Seurat (4.3.0.1).

p_A. <- subset(x = p, idents = c("A"), invert = FALSE) levels(p_A.) [1] "A"

mhkowalski commented 11 months ago

Hi, thanks for reporting this. The problem might be related to the fact that you have Seurat 4.4 and SeuratObject 5.0. I'd suggest trying to run this with the latest versions of Seurat and SeuratObject.