chanzuckerberg / cellxgene-census

CZ CELLxGENE Discover Census
https://chanzuckerberg.github.io/cellxgene-census/
MIT License
81 stars 20 forks source link

get_seurat not working with Seurat V5 #816

Open mihem opened 11 months ago

mihem commented 11 months ago

Describe the bug

get_seurat works fine with Seurat v4, but does not work with Seurat v5, which is still in beta, but is widely used and will be submitted to CRAN on the 23th of October (https://satijalab.org/seurat/)

To Reproduce

Install Seurat V5 (https://satijalab.org/seurat/articles/install) Run the official Quick Start instructions https://chanzuckerberg.github.io/cellxgene-census/cellxgene_census_docsite_quick_start.html#installation

library(Seurat)
library(cellxgene.census)

census <-  open_soma()

organism <-  "Homo sapiens"
gene_filter <-  "feature_id %in% c('ENSG00000107317', 'ENSG00000106034')"
cell_filter <-   "cell_type == 'sympathetic neuron'"
cell_columns <-  c("assay", "cell_type", "tissue", "tissue_general", "suspension_type", "disease")

seurat_obj <-  get_seurat(
   census = census,
   organism = organism,
   var_value_filter = gene_filter,
   obs_value_filter = cell_filter,
   obs_column_names = cell_columns
)

This fails with

Error in match.arg(arg = layer, choices = Layers(object = object, search = FALSE)) : 
  'arg' should be one of “counts”, “data”, “scale.data”

traceback

9: stop(sprintf(ngettext(length(chs <- unique(choices[nzchar(choices)])), 
       "'arg' should be %s", "'arg' should be one of %s"), paste(dQuote(chs), 
       collapse = ", ")), domain = NA)
8: match.arg(arg = layer, choices = Layers(object = object, search = FALSE))
7: `LayerData<-.Assay`(object = `*tmp*`, layer = i, ..., value = value)
6: `LayerData<-`(object = `*tmp*`, layer = i, ..., value = value)
5: `[[<-`(`*tmp*`, names(var), value = structure(list(feature_name = c("CPED1", 
   "PTGDS"), feature_length = c(7683L, 2712L)), row.names = c("ENSG00000106034", 
   "ENSG00000107317"), class = "data.frame"))
4: `[[<-`(`*tmp*`, names(var), value = structure(list(feature_name = c("CPED1", 
   "PTGDS"), feature_length = c(7683L, 2712L)), row.names = c("ENSG00000106034", 
   "ENSG00000107317"), class = "data.frame"))
3: self$to_seurat_assay(X_layers = X_layers, obs_index = obs_index, 
       var_index = var_index, var_column_names = var_column_names)
2: expt_query$to_seurat(X_layers = X_layers, obs_column_names = obs_column_names, 
       var_column_names = var_column_names, var_index = var_index)
1: get_seurat(census = census, organism = organism, var_value_filter = gene_filter, 
       obs_value_filter = cell_filter, obs_column_names = cell_columns)

When I use Seurat v4, this runs successfully.

Environment

R version 4.3.1 (2023-06-16)
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;  LAPACK version 3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=de_DE.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

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

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

other attached packages:
[1] Seurat_4.9.9.9067       SeuratObject_4.9.9.9091 sp_2.1-0               
[4] RcppSpdlog_0.0.14       cellxgene.census_1.6.0 

loaded via a namespace (and not attached):
  [1] RColorBrewer_1.1-3      jsonlite_1.8.7          magrittr_2.0.3         
  [4] spatstat.utils_3.0-3    fs_1.6.3                zlibbioc_1.46.0        
  [7] vctrs_0.6.3             ROCR_1.0-11             spatstat.explore_3.2-3 
 [10] RCurl_1.98-1.12         base64enc_0.1-3         htmltools_0.5.6.1      
 [13] curl_5.1.0              sctransform_0.4.0       parallelly_1.36.0      
 [16] KernSmooth_2.23-22      htmlwidgets_1.6.2       ica_1.0-3              
 [19] plyr_1.8.9              plotly_4.10.2           zoo_1.8-12             
 [22] igraph_1.5.1            mime_0.12               lifecycle_1.0.3        
 [25] pkgconfig_2.0.3         Matrix_1.6-1.1          R6_2.5.1               
 [28] fastmap_1.1.1           GenomeInfoDbData_1.2.10 fitdistrplus_1.1-11    
 [31] future_1.33.0           shiny_1.7.5             digest_0.6.33          
 [34] colorspace_2.1-0        tiledb_0.20.3           patchwork_1.1.3        
 [37] S4Vectors_0.38.2        tensor_1.5              RSpectra_0.16-1        
 [40] irlba_2.3.5.1           aws.signature_0.6.0     GenomicRanges_1.52.1   
 [43] progressr_0.14.0        spatstat.sparse_3.0-2   fansi_1.0.5            
 [46] urltools_1.7.3          polyclip_1.10-6         abind_1.4-5            
 [49] httr_1.4.7              compiler_4.3.1          bit64_4.0.5            
 [52] fastDummies_1.7.3       MASS_7.3-60             tiledbsoma_1.4.4       
 [55] tools_4.3.1             lmtest_0.9-40           httpuv_1.6.11          
 [58] future.apply_1.11.0     goftest_1.2-3           glue_1.6.2             
 [61] nlme_3.1-163            promises_1.2.1          grid_4.3.1             
 [64] Rtsne_0.16              cluster_2.1.4           reshape2_1.4.4         
 [67] generics_0.1.3          gtable_0.3.4            spatstat.data_3.0-1    
 [70] tidyr_1.3.0             data.table_1.14.8       xml2_1.3.5             
 [73] utf8_1.2.3              XVector_0.40.0          spatstat.geom_3.2-5    
 [76] BiocGenerics_0.46.0     BPCells_0.1.0           RcppAnnoy_0.0.21       
 [79] ggrepel_0.9.3           RANN_2.6.1              pillar_1.9.0           
 [82] stringr_1.5.0           spam_2.9-1              RcppHNSW_0.5.0         
 [85] later_1.3.1             splines_4.3.1           dplyr_1.1.3            
 [88] lattice_0.21-9          deldir_1.0-9            renv_1.0.3             
 [91] survival_3.5-7          bit_4.0.5               tidyselect_1.2.0       
 [94] miniUI_0.1.1.1          pbapply_1.7-2           gridExtra_2.3          
 [97] IRanges_2.34.1          RcppCCTZ_0.2.12         scattermore_1.2        
[100] stats4_4.3.1            matrixStats_1.0.0       stringi_1.7.12         
[103] lazyeval_0.2.2          codetools_0.2-19        tibble_3.2.1           
[106] BiocManager_1.30.22     cli_3.6.1               uwot_0.1.16            
[109] arrow_13.0.0.1          xtable_1.8-4            reticulate_1.32.0      
[112] munsell_0.5.0           Rcpp_1.0.11             GenomeInfoDb_1.36.4    
[115] spatstat.random_3.1-6   globals_0.16.2          triebeard_0.4.1        
[118] png_0.1-8               parallel_4.3.1          ellipsis_0.3.2         
[121] ggplot2_3.4.3           assertthat_0.2.1        dotCall64_1.0-2        
[124] aws.s3_0.3.21           bitops_1.0-7            listenv_0.9.0          
[127] spdl_0.0.5              viridisLite_0.4.2       scales_1.2.1           
[130] ggridges_0.5.4          leiden_0.4.3            purrr_1.0.2            
[133] rlang_1.1.1             cowplot_1.1.1           nanotime_0.3.7      

@johnkerl maybe, because of your previous great support https://github.com/chanzuckerberg/cellxgene-census/issues/809

Thank you.

johnkerl commented 11 months ago

cc @mojaveazure