satijalab / seurat

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

Error in `IntegrateLayers()`: ! None of the features provided are found in this assay #9098

Closed IrohaShiro closed 1 week ago

IrohaShiro commented 3 weeks ago

I'm trying to follow the vignette here https://satijalab.org/seurat/articles/integration_introduction. However, I got the following error:

warning: No layers found matching search pattern provided
Error in `IntegrateLayers()`:
! None of the features provided are found in this assay

Here is my code:

library(Seurat)
library(SeuratData)
library(patchwork)
ifnb <- InstallData("ifnb")
ifnb <- LoadData("ifnb")
ifnb[["RNA"]] <- split(ifnb[["RNA"]], f = ifnb$stim)
ifnb <- IntegrateLayers(object = ifnb, method = CCAIntegration, orig.reduction = "pca", new.reduction = "integrated.cca", verbose = FALSE)

My Seurat version is 5.1.0, SeuratObject version is 5.0.2, and SeuratData version is 0.2.2.9001.

IrohaShiro commented 3 weeks ago

Here is my session info:

R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.utf8  LC_CTYPE=Chinese (Simplified)_China.utf8    LC_MONETARY=Chinese (Simplified)_China.utf8
[4] LC_NUMERIC=C                                LC_TIME=Chinese (Simplified)_China.utf8    

time zone: Asia/Shanghai
tzcode source: internal

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

other attached packages:
[1] ifnb.SeuratData_3.1.0 patchwork_1.2.0       SeuratData_0.2.2.9001 Seurat_5.1.0          SeuratObject_5.0.2    sp_2.1-4             

loaded via a namespace (and not attached):
  [1] deldir_2.0-4           pbapply_1.7-2          gridExtra_2.3          remotes_2.5.0          rlang_1.1.4            magrittr_2.0.3        
  [7] RcppAnnoy_0.0.22       spatstat.geom_3.2-9    matrixStats_1.3.0      ggridges_0.5.6         compiler_4.4.1         png_0.1-8             
 [13] callr_3.7.6            vctrs_0.6.5            reshape2_1.4.4         stringr_1.5.1          crayon_1.5.3           pkgconfig_2.0.3       
 [19] fastmap_1.2.0          utf8_1.2.4             promises_1.3.0         ps_1.7.7               purrr_1.0.2            jsonlite_1.8.8        
 [25] goftest_1.2-3          later_1.3.2            spatstat.utils_3.0-5   irlba_2.3.5.1          parallel_4.4.1         cluster_2.1.6         
 [31] R6_2.5.1               ica_1.0-3              stringi_1.8.4          RColorBrewer_1.1-3     spatstat.data_3.1-2    reticulate_1.38.0     
 [37] parallelly_1.37.1      lmtest_0.9-40          scattermore_1.2        Rcpp_1.0.12            tensor_1.5             future.apply_1.11.2   
 [43] zoo_1.8-12             sctransform_0.4.1      httpuv_1.6.15          Matrix_1.7-0           splines_4.4.1          igraph_2.0.3          
 [49] tidyselect_1.2.1       abind_1.4-5            spatstat.random_3.2-3  codetools_0.2-20       miniUI_0.1.1.1         spatstat.explore_3.2-7
 [55] curl_5.2.1             processx_3.8.4         listenv_0.9.1          pkgbuild_1.4.4         lattice_0.22-6         tibble_3.2.1          
 [61] plyr_1.8.9             shiny_1.8.1.1          ROCR_1.0-11            Rtsne_0.17             future_1.33.2          fastDummies_1.7.3     
 [67] desc_1.4.3             survival_3.7-0         polyclip_1.10-6        fitdistrplus_1.1-11    pillar_1.9.0           KernSmooth_2.23-24    
 [73] plotly_4.10.4          generics_0.1.3         RcppHNSW_0.6.0         ggplot2_3.5.1          munsell_0.5.1          scales_1.3.0          
 [79] globals_0.16.3         xtable_1.8-4           glue_1.7.0             lazyeval_0.2.2         tools_4.4.1            data.table_1.15.4     
 [85] RSpectra_0.16-1        RANN_2.6.1             leiden_0.4.3.1         dotCall64_1.1-1        cowplot_1.1.3          grid_4.4.1            
 [91] tidyr_1.3.1            colorspace_2.1-0       nlme_3.1-165           cli_3.6.3              rappdirs_0.3.3         spatstat.sparse_3.1-0 
 [97] spam_2.10-0            fansi_1.0.6            viridisLite_0.4.2      dplyr_1.1.4            uwot_0.2.2             gtable_0.3.5          
[103] digest_0.6.36          progressr_0.14.0       ggrepel_0.9.5          htmlwidgets_1.6.4      htmltools_0.5.8.1      lifecycle_1.0.4       
[109] httr_1.4.7             mime_0.12              MASS_7.3-61   
mhkowalski commented 1 week ago

Hi,

Thanks for posting! You're encountering this error because you're trying to use the pca reduction, but this isn't present in the object.

If you run PCA on this object, you should be able to run IntegrateLayers using the code you've written.

ifnb <- LoadData("ifnb")
ifnb[["RNA"]] <- split(ifnb[["RNA"]], f = ifnb$stim)
ifnb <- FindVariableFeatures(ifnb)
ifnb <- ScaleData(ifnb)
ifnb <- RunPCA(ifnb)
ifnb <- IntegrateLayers(object = ifnb, method = CCAIntegration, orig.reduction = "pca", new.reduction = "integrated.cca", verbose = FALSE)

I think that this isn't the most informative error, so we will consider updating this message in the future, thanks.