samuel-marsh / scCustomize

R package with collection of functions created and/or curated to aid in the visualization and analysis of single-cell data using R.
https://samuel-marsh.github.io/scCustomize/
GNU General Public License v3.0
201 stars 21 forks source link

Seurat V5 Compatibility Update (Dev Note/Plan) #101

Closed samuel-marsh closed 10 months ago

samuel-marsh commented 1 year ago

Note from Dev:

Thank you everyone for your support and use of scCustomize, I’m really happy so many people find it useful!

As many of you are aware the Satija lab released a major update to Seurat in the form of Seurat V5 (currently in beta).

The current development plan for Seurat V5 is this:

In meantime if you are using Seurat V5 please be aware some functions may not work as intended.

I would also greatly appreciate it if anyone using Seurat V5 who notices issues with scCustomize function/interaction with Seurat could post on this issue with:

Thanks so much!! Sam

samuel-marsh commented 1 year ago

Notes to Self:

samuel-marsh commented 1 year ago

Functions using slot param to be altered:

samuel-marsh commented 1 year ago

Potential New Functions

samuel-marsh commented 1 year ago

Vignette Updates

samuel-marsh commented 1 year ago

Fix/Updates:

pkhoueiry commented 1 year ago

Add_Mito_Ribo_Seurat() is throwing the message:

 Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'colSums': subscript out of bounds
samuel-marsh commented 1 year ago

@pkhoueiry Thanks for posting this!

Can you try one thing for me. Do you get any errors if you run this? (change the pattern if not human data)

OBJ[["percent_mito"]] <- PercentageFeatureSet(object = OBJ, pattern = "^MT-")

Can you also send copy of sessionInfo()

Thanks! Sam

pkhoueiry commented 1 year ago

Indeed this works. This is how I overcame the issue.

sessionInfo()

R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Berlin
tzcode source: internal

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

other attached packages:
 [1] Seurat.utils_1.9.4      ggExpress_0.7.1         MarkdownHelpers_0.2.2  
 [4] ggpubr_0.6.0            CodeAndRoll2_2.5.2      Stringendo_0.3.5       
 [7] Azimuth_0.4.6           shinyBS_0.61.1          ggplot2_3.4.3          
[10] scCustomize_1.1.3       doParallel_1.0.17       iterators_1.0.14       
[13] foreach_1.5.2           cowplot_1.1.1           HGNChelper_0.8.1       
[16] Seurat_4.9.9.9059       SeuratObject_4.9.9.9091 sp_2.0-0               
[19] tidyr_1.3.0             dplyr_1.1.2            

loaded via a namespace (and not attached):
  [1] RcppAnnoy_0.0.21         splines_4.3.1            later_1.3.1             
  [4] R.oo_1.25.0              tibble_3.2.1             cellranger_1.1.0        
  [7] polyclip_1.10-4          janitor_2.2.0            fastDummies_1.7.3       
 [10] lifecycle_1.0.3          rstatix_0.7.2            vroom_1.6.3             
 [13] globals_0.16.2           lattice_0.21-8           hdf5r_1.3.8             
 [16] MASS_7.3-60              backports_1.4.1          magrittr_2.0.3          
 [19] openxlsx_4.2.5.2         plotly_4.10.2            sm_2.2-5.7.1            
 [22] httpuv_1.6.11            sctransform_0.3.5        zip_2.3.0               
 [25] spam_2.9-1               sessioninfo_1.2.2        spatstat.sparse_3.0-2   
 [28] reticulate_1.31          pbapply_1.7-2            RColorBrewer_1.1-3      
 [31] lubridate_1.9.2          abind_1.4-5              Rtsne_0.16              
 [34] R.utils_2.12.2           purrr_1.0.2              presto_1.0.0            
 [37] rappdirs_0.3.3           circlize_0.4.15          ggrepel_0.9.3           
 [40] irlba_2.3.5.1            listenv_0.9.0            spatstat.utils_3.0-3    
 [43] gdata_2.19.0             pheatmap_1.0.12          goftest_1.2-3           
 [46] RSpectra_0.16-1          spatstat.random_3.1-5    fitdistrplus_1.1-11     
 [49] parallelly_1.36.0        leiden_0.4.3             codetools_0.2-19        
 [52] DT_0.28                  tidyselect_1.2.0         shape_1.4.6             
 [55] SoupX_1.6.2              matrixStats_1.0.0        spatstat.explore_3.2-1  
 [58] ReadWriter_0.2.9         googledrive_2.1.1        jsonlite_1.8.7          
 [61] vioplot_0.4.0            ellipsis_0.3.2           progressr_0.14.0        
 [64] ggridges_0.5.4           survival_3.5-7           tictoc_1.2              
 [67] tools_4.3.1              ica_1.0-3                Rcpp_1.0.11             
 [70] glue_1.6.2               gridExtra_2.3            MatrixGenerics_1.12.3   
 [73] shinydashboard_0.7.2     withr_2.5.0              fastmap_1.1.1           
 [76] fansi_1.0.4              shinyjs_2.1.0            digest_0.6.33           
 [79] MarkdownReports_4.5.9    timechange_0.2.0         R6_2.5.1                
 [82] mime_0.12                ggprism_1.0.4            colorspace_2.1-0        
 [85] scattermore_1.2          gtools_3.9.4             tensor_1.5              
 [88] spatstat.data_3.0-1      R.methodsS3_1.8.2        googlesheets4_1.1.1     
 [91] utf8_1.2.3               generics_0.1.3           data.table_1.14.8       
 [94] httr_1.4.7               htmlwidgets_1.6.2        uwot_0.1.16             
 [97] pkgconfig_2.0.3          gtable_0.3.3             lmtest_0.9-40           
[100] htmltools_0.5.6          carData_3.0-5            dotCall64_1.0-2         
[103] tidyverse_2.0.0          scales_1.2.1             SeuratData_0.2.2        
[106] png_0.1-8                snakecase_0.11.0         rstudioapi_0.15.0       
[109] tzdb_0.4.0               reshape2_1.4.4           nlme_3.1-163            
[112] ggcorrplot_0.1.4         zoo_1.8-12               GlobalOptions_0.1.2     
[115] stringr_1.5.0            KernSmooth_2.23-22       miniUI_0.1.1.1          
[118] vipor_0.4.5              ggrastr_1.0.2            pillar_1.9.0            
[121] grid_4.3.1               vctrs_0.6.3              RANN_2.6.1              
[124] promises_1.2.1           car_3.1-2                princurve_2.1.6         
[127] xtable_1.8-4             cluster_2.1.4            SeuratDisk_0.0.0.9020   
[130] beeswarm_0.4.0           paletteer_1.5.0          readr_2.1.4             
[133] cli_3.6.1                compiler_4.3.1           rlang_1.1.1             
[136] crayon_1.5.2             future.apply_1.11.0      ggsignif_0.6.4          
[139] rematch2_2.1.2           plyr_1.8.8               forcats_1.0.0           
[142] fs_1.6.3                 ggbeeswarm_0.7.2         stringi_1.7.12          
[145] viridisLite_0.4.2        deldir_1.0-9             munsell_0.5.0           
[148] lazyeval_0.2.2           spatstat.geom_3.2-4      Matrix_1.6-1            
[151] RcppHNSW_0.4.1           hms_1.1.3                patchwork_1.1.3         
[154] sparseMatrixStats_1.12.2 bit64_4.0.5              future_1.33.0           
[157] shiny_1.7.5              ROCR_1.0-11              clipr_0.8.0             
[160] gargle_1.5.2             igraph_1.5.1             broom_1.0.5             
[163] bit_4.0.5     
samuel-marsh commented 1 year ago

ok let thanks! one more thing. After the error could you run traceback() and send that output?

Thanks! Sam

pkhoueiry commented 1 year ago

I don't have the error if I specify the DefaultAssay as RNA for all objects in my list.

project <- lapply(project, function(x){
     DefaultAssay(x) <- "RNA"
     x <- Add_Mito_Ribo_Seurat(seurat_object = x, species = "Human")
     x
})
samuel-marsh commented 1 year ago

ok that's interesting. Was the default assay something other than RNA before this step?

The assay specification to PercentageFeatureSet should get set automatically during the function with this: https://github.com/samuel-marsh/scCustomize/blob/2bb2b138edefee5946c523a5d1b2e418974a5d39/R/Object_Utilities.R#L114C1-L115C59

Thanks again really appreciate you help!

pkhoueiry commented 1 year ago

As I am working with Cite-seq, it can be that the assay was set to HTO during the first time I run the counts. Best and thanks for your help too, P.

samuel-marsh commented 1 year ago

Gotcha!! Ok ya that is likely issue. I'll work on adding check for that in function.

Best, Sam

samuel-marsh commented 1 year ago

layers <- Layers(object, search = layers %||% 'data')