Repository: satijalab/seurat

Issue #9464: `DietSeurat` doesn't drop layers from objects
Created: 2024-11-08T21:13:43Z
(I have double-checked to confirm that DietSeurat is provided in Seurat and not SeuratObject.)
While working on a reprex to answer a question in another issue on this repo, I found out that each of the following calls:

DietSeurat(pbmc_small, layers = "counts") # Only assay is "RNA"
DietSeurat(pbmc_small, layers = "counts", assays = "RNA")
DietSeurat(pbmc_small, layers = list(RNA = "counts"))

results in an object with all layers retained:
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

Layers not mentioned in the layers argument to DietSeurat should be dropped from the result.

Duplicate issue #8054: DietSeurat does not remove data and scale layers
Created: 2023-11-19T19:26:23Z
While trying to merge data, I wanted to use DietSeurat in order to only keep the "counts" layer.
However, this appears to be impossible at the moment:
DietSeurat(pbmc_small,layers = "counts")->data
data
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

Sessioninfo:
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default


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

other attached packages:
 [1] readxl_1.4.3        DoubletFinder_2.0.3 SCINA_1.2.0         gplots_3.1.3        MASS_7.3-58.1       sleepwalk_0.3.2     lubridate_1.9.3    
 [8] forcats_1.0.0       stringr_1.5.1       dplyr_1.1.3         purrr_1.0.2         readr_2.1.4         tidyr_1.3.0         tibble_3.2.1       
[15] ggplot2_3.4.4       tidyverse_2.0.0     Seurat_5.0.0        SeuratObject_5.0.0  sp_2.1-1           

loaded via a namespace (and not attached):
  [1] Rtsne_0.16             colorspace_2.1-0       deldir_1.0-9           ellipsis_0.3.2         ggridges_0.5.4         RcppHNSW_0.5.0        
  [7] rstudioapi_0.15.0      spatstat.data_3.0-3    leiden_0.4.3           listenv_0.9.0          ggrepel_0.9.4          RSpectra_0.16-1       
 [13] fansi_1.0.5            R.methodsS3_1.8.2      codetools_0.2-18       splines_4.2.2          polyclip_1.10-6        spam_2.10-0           
 [19] jsonlite_1.8.7         ica_1.0-3              cluster_2.1.4          R.oo_1.25.0            png_0.1-8              uwot_0.1.16           
 [25] shiny_1.7.5.1          sctransform_0.4.1      spatstat.sparse_3.0-3  compiler_4.2.2         httr_1.4.7             Matrix_1.6-3          
 [31] fastmap_1.1.1          lazyeval_0.2.2         cli_3.6.1              later_1.3.1            htmltools_0.5.7        tools_4.2.2           
 [37] igraph_1.5.1           dotCall64_1.1-0        gtable_0.3.4           glue_1.6.2             RANN_2.6.1             reshape2_1.4.4        
 [43] Rcpp_1.0.11            scattermore_1.2        cellranger_1.1.0       vctrs_0.6.4            spatstat.explore_3.2-5 nlme_3.1-160          
 [49] progressr_0.14.0       lmtest_0.9-40          spatstat.random_3.2-1  globals_0.16.2         timechange_0.2.0       mime_0.12             
 [55] miniUI_0.1.1.1         lifecycle_1.0.4        irlba_2.3.5.1          gtools_3.9.4           goftest_1.2-3          future_1.33.0         
 [61] jrc_0.6.0              zoo_1.8-12             scales_1.2.1           hms_1.1.3              promises_1.2.1         spatstat.utils_3.0-4  
 [67] parallel_4.2.2         RColorBrewer_1.1-3     reticulate_1.34.0      pbapply_1.7-2          gridExtra_2.3          stringi_1.8.1         
 [73] fastDummies_1.7.3      caTools_1.18.2         bitops_1.0-7           rlang_1.1.2            pkgconfig_2.0.3        matrixStats_1.1.0     
 [79] lattice_0.20-45        ROCR_1.0-11            tensor_1.5             patchwork_1.1.3        htmlwidgets_1.6.2      cowplot_1.1.1         
 [85] tidyselect_1.2.0       parallelly_1.36.0      RcppAnnoy_0.0.21       plyr_1.8.9             magrittr_2.0.3         R6_2.5.1              
 [91] generics_0.1.3         pillar_1.9.0           withr_2.5.2            fitdistrplus_1.1-11    survival_3.4-0         abind_1.4-5           
 [97] future.apply_1.11.0    KernSmooth_2.23-20     utf8_1.2.4             spatstat.geom_3.2-7    plotly_4.10.3          tzdb_0.4.0            
[103] grid_4.2.2             data.table_1.14.8      digest_0.6.33          xtable_1.8-4           httpuv_1.6.12          R.utils_2.12.2        
[109] munsell_0.5.0          viridisLite_0.4.2

Closing comment (2025-02-11T13:51:18Z): Shouldn't this issue be closed given that it is a duplicate of #9464?