seurat icon indicating copy to clipboard operation
seurat copied to clipboard

Error in LayerData.Assay5 with integration workflow in Seurat V5

Open lynnhlee opened this issue 1 year ago • 12 comments

Hi all. Great software, but I've run into an issue I can't find documented anywhere here. I'm integrating 8 datasets following the integration vignette. Everything works fine until I get to the IntegrateLayers step, and I get the following error:

allbm <- IntegrateLayers(object = allbm, method=CCAIntegration, orig.reduction="pca", new.reduction="integrated.cca", verbose=FALSE) Error in LayerData.Assay5(object = x, layer = DefaultLayer(object = x)[1L], : features are not found

I've tried restarting my session, reloading packages, and someone suggested trying JoinLayers() and re-splitting the SeuratObject() but no success. I've more or less followed the vignette to the letter (except merging 8 datasets instead of 2) although the only deviation would be I ran the objects initially through the Azimuth web portal and added the results back with AddAzimuthResults() in my R session. Any ideas would be greatly appreciated...

`R version 4.3.1 (2023-06-16 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

time zone: America/New_York tzcode source: internal

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

other attached packages: [1] SeuratWrappers_0.3.2 ifnb.SeuratData_3.0.0 SeuratData_0.2.2.9001 Seurat_5.0.1
[5] SeuratObject_5.0.1 sp_2.1-2

loaded via a namespace (and not attached): [1] deldir_2.0-2 pbapply_1.7-2 gridExtra_2.3 remotes_2.4.2.1
[5] rlang_1.1.1 magrittr_2.0.3 RcppAnnoy_0.0.21 matrixStats_1.0.0
[9] ggridges_0.5.4 compiler_4.3.1 spatstat.geom_3.2-7 png_0.1-8
[13] vctrs_0.6.3 reshape2_1.4.4 stringr_1.5.1 crayon_1.5.2
[17] pkgconfig_2.0.3 fastmap_1.1.1 ellipsis_0.3.2 utf8_1.2.3
[21] promises_1.2.1 purrr_1.0.2 jsonlite_1.8.7 goftest_1.2-3
[25] later_1.3.1 spatstat.utils_3.0-4 irlba_2.3.5.1 parallel_4.3.1
[29] cluster_2.1.4 R6_2.5.1 ica_1.0-3 stringi_1.7.12
[33] RColorBrewer_1.1-3 spatstat.data_3.0-3 reticulate_1.34.0 parallelly_1.36.0
[37] lmtest_0.9-40 scattermore_1.2 Rcpp_1.0.11 tensor_1.5
[41] future.apply_1.11.0 zoo_1.8-12 R.utils_2.12.3 sctransform_0.4.1
[45] httpuv_1.6.12 Matrix_1.6-4 splines_4.3.1 igraph_1.5.1
[49] tidyselect_1.2.0 rstudioapi_0.15.0 abind_1.4-5 spatstat.random_3.2-2 [53] codetools_0.2-19 miniUI_0.1.1.1 spatstat.explore_3.2-5 listenv_0.9.0
[57] lattice_0.21-8 tibble_3.2.1 plyr_1.8.8 shiny_1.8.0
[61] ROCR_1.0-11 Rtsne_0.16 future_1.33.0 fastDummies_1.7.3
[65] survival_3.5-7 polyclip_1.10-6 fitdistrplus_1.1-11 BiocManager_1.30.22
[69] pillar_1.9.0 KernSmooth_2.23-22 plotly_4.10.3 generics_0.1.3
[73] RcppHNSW_0.5.0 ggplot2_3.4.4 munsell_0.5.0 scales_1.3.0
[77] globals_0.16.2 xtable_1.8-4 glue_1.6.2 lazyeval_0.2.2
[81] tools_4.3.1 data.table_1.14.8 RSpectra_0.16-1 RANN_2.6.1
[85] leiden_0.4.3.1 dotCall64_1.1-1 cowplot_1.1.1 grid_4.3.1
[89] tidyr_1.3.0 colorspace_2.1-0 nlme_3.1-163 patchwork_1.1.3
[93] rsvd_1.0.5 cli_3.6.1 rappdirs_0.3.3 spatstat.sparse_3.0-3 [97] spam_2.10-0 fansi_1.0.4 viridisLite_0.4.2 dplyr_1.1.3
[101] uwot_0.1.16 gtable_0.3.4 R.methodsS3_1.8.2 digest_0.6.33
[105] progressr_0.14.0 ggrepel_0.9.4 htmlwidgets_1.6.4 R.oo_1.25.0
[109] htmltools_0.5.7 lifecycle_1.0.4 httr_1.4.7 mime_0.12
[113] MASS_7.3-60 `

lynnhlee avatar Dec 12 '23 16:12 lynnhlee

I've had this exact problem too - even tried with the provided ifnb dataset to make sure it wasn't an issue with my data and got the same error

plhelmer avatar Dec 13 '23 20:12 plhelmer

Same issue. Downgrading to 4.9.9.9050 solved this.

zehualilab avatar Dec 14 '23 04:12 zehualilab

We have explored this but have been unable to reproduce the issue using the Ifnb dataset. It appears to be something specific to individual users/environments - though we recognize that multiple people may be running into this.

  1. Can you ensure that your installations of Seurat, SeuratObject, and SeuratData are all up-to-date? See install instructions here

  2. After updating, Can you confirm that you can reproduce this error - running exactly the code from https://satijalab.org/seurat/articles/integration_introduction

  3. If you still get this error, can you post the output of your sessionInfo(), as this is possibly/likely an. issue related to package versions

rsatija avatar Dec 21 '23 21:12 rsatija

I've had this exact problem too - even tried with the provided ifnb dataset to make sure it wasn't an issue with my data and got the same error

Have you find a solution? If yes, mind sharing?

yixiaobio avatar Jan 26 '24 23:01 yixiaobio

it was working before for sct normalisation, now I am getting this error for sct : "AP003396.1", "PATE2", or "COPDA1", not "data". ℹ Did you mean "DAOA"? Backtrace:

  1. Seurat::IntegrateLayers(...)
  2. Seurat (local) method(...)
  3. base::sapply(...)
  4. base::lapply(X = X, FUN = FUN, ...)
  5. Seurat (local) FUN(X[[i]], ...)
  6. SeuratObject:::[.Assay(object, x)
  7. SeuratObject:::LayerData.Assay(features = i)

and when I am tried on RNA I got this: Error in LayerData.Assay5(object = x, layer = DefaultLayer(object = x)[1L], : features are not found

I don't have any issue for IntegrateLayers() function when I change it to other methods.

mreza-ef avatar Feb 05 '24 23:02 mreza-ef

Also here: patient_split_list <- SplitObject(sobj, split.by = "patient") sobj_patient <- patient_split_list[[p]] sobj_patient <- Seurat::PercentageFeatureSet(sobj_patient, pattern = "^MT-|^mt-", col.name ="percent_mt") Backtrace:

  1. Seurat::PercentageFeatureSet(...)
  2. SeuratObject:::[.Assay(object[[assay]], layer)
  3. SeuratObject:::LayerData.Assay(features = i)

[1] SingleR_2.4.0 scRNAseq_2.16.0 SingleCellExperiment_1.24.0 celldex_1.12.0 openxlsx_4.2.5.2
[6] psych_2.3.9 qdapRegex_0.7.8 tidyr_1.3.0 dplyr_1.1.4 tibble_3.2.1
[11] stringr_1.5.1 reshape2_1.4.4 randomcoloR_1.1.0.1 RColorBrewer_1.1-3 ggpubr_0.6.0
[16] DT_0.30 clustree_0.5.1 ggraph_2.1.0 cowplot_1.1.1 ggridges_0.5.4
[21] patchwork_1.1.3 gridExtra_2.3 pheatmap_1.0.12 ggVennDiagram_1.2.3 ggrepel_0.9.4
[26] ggthemes_5.0.0 gplots_3.1.3 caret_6.0-94 lattice_0.22-5 ggplot2_3.4.4
[31] UCell_2.6.2 harmony_1.2.0 glmGamPoi_1.14.0 Seurat_5.0.1 Signac_1.12.0
[36] fgsea_1.28.0 msigdbr_7.5.1 presto_1.0.0 data.table_1.14.8 Rcpp_1.0.11
[41] DESeq2_1.42.0 SummarizedExperiment_1.32.0 MatrixGenerics_1.14.0 matrixStats_1.1.0 BSgenome.Hsapiens.UCSC.hg38_1.4.5 [46] BSgenome.Mmusculus.UCSC.mm10_1.4.3 BSgenome_1.70.1 rtracklayer_1.62.0 BiocIO_1.12.0 Biostrings_2.70.1
[51] XVector_0.42.0 EnsDb.Mmusculus.v79_2.99.0 EnsDb.Hsapiens.v86_2.99.0 ensembldb_2.26.0 AnnotationFilter_1.26.0
[56] GenomicFeatures_1.54.1 AnnotationDbi_1.64.1 Biobase_2.62.0 GenomicRanges_1.54.1 GenomeInfoDb_1.38.1
[61] IRanges_2.36.0 S4Vectors_0.40.2 BiocGenerics_0.48.1 reticulate_1.34.0 SeuratObject_5.0.1
[66] sp_2.1-1 Matrix_1.6-3 What can be done?

efratsh12 avatar Feb 06 '24 14:02 efratsh12

@efratsh12 Not sure if using split.by is supported in Seurat5 and if it could be the cause of getting the error? Try this: obj[["RNA"]] <- split(obj[["RNA"]], f = obj$Method) and please check if you have a layer for each sample or not?

mreza-ef avatar Feb 07 '24 08:02 mreza-ef

@mreza-ef Thank you for the idea, but also when I'm using the full object, without split, I get the same error: sobj<- Seurat::PercentageFeatureSet(sobj, pattern = "^MT-|^mt-", col.name ="percent_mt")

efratsh12 avatar Feb 07 '24 08:02 efratsh12

@efratsh12 are you following this vignettes? https://satijalab.org/seurat/articles/seurat5_integration

mreza-ef avatar Feb 07 '24 10:02 mreza-ef

@mreza-ef It is data I downloaded from broad institute, and did nothing to it except load it to seurat object. When I downgrade to version 4, the same code is working. The same code and version 5.0.1 worked on other cohorts.

efratsh12 avatar Feb 07 '24 12:02 efratsh12

@lynnhlee

Hi, Have you fixed this? I've encountered a similar problem with Seurat v5.

Thanks!

FionaL720 avatar Mar 07 '24 06:03 FionaL720

Hi,Sorry, no, I downgraded to seurat 4... On Thursday, March 7, 2024 at 08:09:21 AM GMT+2, FionaL720 @.***> wrote:

@lynnhlee

Hi, Have you fixed this? I've encountered a similar problem with Seurat v5.

Thanks!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

efratsh12 avatar Mar 07 '24 10:03 efratsh12

I've run into this issue as well when trying to integrate my own data using IntegrateLayers.

I went back to the vignette (https://satijalab.org/seurat/articles/seurat5_integration) and ran exactly as described and encountered the issue when running obj <- RunAzimuth(obj, reference = "pbmcref")

Received this error: Error in LayerData(object = x, layer = DefaultLayer(object = x)[1L], cells = j, : followed by a list of what appears to be all genes and ending with "CTD-2060L22.1", "RP11-107E5.4", or "RP11-299P2.2", not "counts".

R version 4.3.3 (2024-02-29) 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/blas/libblas.so.3.10.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

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
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: America/Los_Angeles tzcode source: system (glibc)

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

other attached packages: [1] Azimuth_0.5.0 shinyBS_0.61.1 pbmcsca.SeuratData_3.0.0 pbmcref.SeuratData_1.0.0
[5] SeuratData_0.2.2.9001 patchwork_1.2.0 clustree_0.5.1 ggraph_2.2.1
[9] cowplot_1.1.3 furrr_0.3.1 future_1.33.1 qs_0.26.1
[13] BSgenome.LStriataDom.Brainard.lonStrDom2.ucsc_2.0.0 BSgenome_1.70.2 rtracklayer_1.62.0 BiocIO_1.12.0
[17] Biostrings_2.70.3 XVector_0.42.0 GenomicRanges_1.54.1 GenomeInfoDb_1.38.7
[21] IRanges_2.36.0 S4Vectors_0.40.2 BiocGenerics_0.48.1 lubridate_1.9.3
[25] forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2
[29] readr_2.1.5 tidyr_1.3.1 tibble_3.2.1 ggplot2_3.5.0
[33] tidyverse_2.0.0 SeuratWrappers_0.3.4 Seurat_5.0.3 SeuratObject_5.0.1
[37] sp_2.1-3 Signac_1.12.0

loaded via a namespace (and not attached): [1] R.methodsS3_1.8.2 progress_1.2.3 poweRlaw_0.80.0 goftest_1.2-3 DT_0.32 vctrs_0.6.5
[7] spatstat.random_3.2-3 RApiSerialize_0.1.2 digest_0.6.35 png_0.1-8 ggrepel_0.9.5 deldir_2.0-4
[13] parallelly_1.37.1 MASS_7.3-55 reshape2_1.4.4 httpuv_1.6.14 withr_3.0.0 xfun_0.42
[19] ellipsis_0.3.2 survival_3.2-13 EnsDb.Hsapiens.v86_2.99.0 memoise_2.0.1 zoo_1.8-12 gtools_3.9.5
[25] pbapply_1.7-2 R.oo_1.26.0 prettyunits_1.2.0 KEGGREST_1.42.0 promises_1.2.1 httr_1.4.7
[31] restfulr_0.0.15 globals_0.16.3 fitdistrplus_1.1-11 rhdf5filters_1.14.1 stringfish_0.16.0 rhdf5_2.46.1
[37] rstudioapi_0.15.0 miniUI_0.1.1.1 generics_0.1.3 curl_5.2.1 zlibbioc_1.48.2 polyclip_1.10-6
[43] GenomeInfoDbData_1.2.11 SparseArray_1.2.4 xtable_1.8-4 pracma_2.4.4 evaluate_0.23 S4Arrays_1.2.1
[49] BiocFileCache_2.10.1 hms_1.1.3 irlba_2.3.5.1 colorspace_2.1-0 filelock_1.0.3 hdf5r_1.3.10
[55] ROCR_1.0-11 reticulate_1.35.0 spatstat.data_3.0-4 magrittr_2.0.3 lmtest_0.9-40 later_1.3.2
[61] viridis_0.6.5 lattice_0.20-45 spatstat.geom_3.2-9 future.apply_1.11.1 scattermore_1.2 XML_3.99-0.16.1
[67] matrixStats_1.2.0 RcppAnnoy_0.0.22 pillar_1.9.0 nlme_3.1-155 caTools_1.18.2 compiler_4.3.3
[73] RSpectra_0.16-1 stringi_1.8.3 tensor_1.5 SummarizedExperiment_1.32.0 GenomicAlignments_1.38.2 plyr_1.8.9
[79] crayon_1.5.2 abind_1.4-5 googledrive_2.1.1 graphlayouts_1.1.1 bit_4.0.5 fastmatch_1.1-4
[85] codetools_0.2-18 plotly_4.10.4 mime_0.12 splines_4.3.3 Rcpp_1.0.12 fastDummies_1.7.3
[91] dbplyr_2.4.0 cellranger_1.1.0 knitr_1.45 blob_1.2.4 utf8_1.2.4 seqLogo_1.68.0
[97] AnnotationFilter_1.26.0 fs_1.6.3 listenv_0.9.1 Matrix_1.6-5 tzdb_0.4.0 tweenr_2.0.3
[103] pkgconfig_2.0.3 tools_4.3.3 cachem_1.0.8 RSQLite_2.3.5 viridisLite_0.4.2 DBI_1.2.2
[109] fastmap_1.1.1 rmarkdown_2.26 scales_1.3.0 grid_4.3.3 ica_1.0-3 shinydashboard_0.7.2
[115] Rsamtools_2.18.0 BiocManager_1.30.22 dotCall64_1.1-1 RANN_2.6.1 farver_2.1.1 tidygraph_1.3.1
[121] yaml_2.3.8 MatrixGenerics_1.14.0 cli_3.6.2 leiden_0.4.3.1 lifecycle_1.0.4 uwot_0.1.16
[127] Biobase_2.62.0 presto_1.0.0 BSgenome.Hsapiens.UCSC.hg38_1.4.5 BiocParallel_1.36.0 annotate_1.80.0 timechange_0.3.0
[133] gtable_0.3.4 rjson_0.2.21 ggridges_0.5.6 progressr_0.14.0 parallel_4.3.3 jsonlite_1.8.8
[139] RcppHNSW_0.6.0 TFBSTools_1.40.0 bitops_1.0-7 bit64_4.0.5 Rtsne_0.17 spatstat.utils_3.0-4
[145] RcppParallel_5.1.7 CNEr_1.38.0 shinyjs_2.1.0 SeuratDisk_0.0.0.9021 R.utils_2.12.3 lazyeval_0.2.2
[151] shiny_1.8.0 htmltools_0.5.7 GO.db_3.18.0 sctransform_0.4.1 rappdirs_0.3.3 ensembldb_2.26.0
[157] glue_1.7.0 TFMPvalue_0.0.9 spam_2.10-0 googlesheets4_1.1.1 RCurl_1.98-1.14 gridExtra_2.3
[163] JASPAR2020_0.99.10 igraph_2.0.3 R6_2.5.1 RcppRoll_0.3.0 GenomicFeatures_1.54.4 cluster_2.1.2
[169] Rhdf5lib_1.24.2 gargle_1.5.2 DirichletMultinomial_1.44.0 DelayedArray_0.28.0 tidyselect_1.2.1 ProtGenerics_1.34.0
[175] ggforce_0.4.2 xml2_1.3.6 AnnotationDbi_1.64.1 rsvd_1.0.5 munsell_0.5.0 KernSmooth_2.23-20
[181] data.table_1.15.2 htmlwidgets_1.6.4 RColorBrewer_1.1-3 biomaRt_2.58.2 rlang_1.1.3 spatstat.sparse_3.0-3
[187] spatstat.explore_3.2-6 remotes_2.4.2.1 fansi_1.0.6

colquittlab avatar Mar 22 '24 16:03 colquittlab

reviving this since I am running into the same error with running Azimuth or Integration

ajsapre avatar Mar 28 '24 22:03 ajsapre

Hi, we have been unable to reproduce these issues on our end. I am closing this issue for now, but if problems persist even with updated versions of Seurat, SeuratObject, and Matrix, please open a new issue with the following details:

  1. Describe your issue:

    • A clear and concise description of what the bug is — avoid just pasting in the error message.
  2. Reproducing Code Example:

    • Provide a minimal reproducible example that demonstrates the issue using one of the datasets available through SeuratData. Paste the code in a code block.
    • The code example should make use of pbmc_small or one of the datasets available through SeuratData.
  3. Error Message:

    • If any, paste the full error message (starting from line Traceback) in a code block.
    • If no error is raised, consider writing a simple test case that explicitly raises an error if the
  4. System Information:

    • Run sessionInfo() and paste the result in a code block.

igrabski avatar Jun 24 '24 16:06 igrabski