Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubleshooting Converting Seurat Object to Hummus Object with 10X-Multiome Dataset #4

Closed
inhyeoklee opened this issue Mar 21, 2024 · 8 comments
Assignees
Labels

Comments

@inhyeoklee
Copy link

Hello,

Thank you for creating this wonderful package. I'm excited to give it a test run with my 10X-Multiome dataset. As I started to follow along with your vignette using my own dataset, I encountered an error message when transitioning into a hummus object: "hummus <- as(pbmc, 'hummus_object')". The error is as follows: Error in validObject(object = .Object) : invalid class "Seurat" object: 'assays' must be a named list.

Here's what my "pbmc" object looks like:
An object of class Seurat
324407 features across 23619 samples within 8 assays
Active assay: RNA (36601 features, 0 variable features)
6 layers present: counts.Gene Expression.RNA_280, counts.Gene Expression.RNA_302, counts.Gene Expression.RNA_72, counts.Gene Expression.RNA_203, counts.Gene Expression.RNA_271, counts.Gene Expression.RNA_294
7 other assays present: SCT, integrated, prediction.score.celltype.l1, prediction.score.celltype.l2, prediction.score.celltype.l3, ATAC, peaks
5 dimensional reductions calculated: pca, integrated_dr, ref.umap, lsi, umap

Could you give me some suggestions on what may be worth trying from here?

Thanks,
Daniel

@r-trimbour r-trimbour added the bug Something isn't working label Mar 21, 2024
@r-trimbour
Copy link
Member

Dear Daniel,

Thanks you for your interest in HuMMuS !

This error might be related to the versions of Seurat and Signac. Is it a Seurat v5 object ?
HuMMuS has been developped mostly using Seurat v4, so it might still have some difficulties with seurat v5 objects.

You can maybe give a first try to start a new RSession, then precise options(Seurat.object.assay.version = 'v4') at the beginning of your code.
You can then reduce the seurat object you're passing to hummus to only the relevant assays for HuMMuS to limit unknown factors in the debugging process :
new_seurat <- SeuratObject::CreateSeuratObject(pbmc[['RNA']]@counts)
new_seurat[['peaks']] <- Signac::CreateChromatinAssay(pbmc[['peaks']]@counts (or 'ATAC' depending of the one relevant for you here)

Let me know if enforcing the Seurat assay version works ! :)
Otherwise you can load both Signac and SeuratObject, and post here the sessionInfo() and SeuratObject::Version(pbmc) outputs so we can explore it a bit more.

Best,
Rémi

@inhyeoklee
Copy link
Author

inhyeoklee commented Mar 29, 2024

Hi Rémi, I apologize for my delayed response here (had some urgent family matter).

I ran the scripts as you suggested, but I'm still getting the same error when I eventually get to creating a hummus object stage. It turns out when I run "SeuratObject::Version(pbmc)", my Seurat object version is still "5.0.0". I'm thinking about downgrading library versions for both Signac and Seurat and then give another try at downgrading my Seurat object. I'll also share my session info later today.

@inhyeoklee
Copy link
Author

Here's my session info:
R version 4.3.2 (2023-10-31)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /projects/p31353/tjq4954/conda/daniel-sc-env/lib/libopenblasp-r0.3.25.so; LAPACK version 3.11.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
[8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: UTC
tzcode source: system (glibc)

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

other attached packages:
[1] parallelly_1.37.1-9000 BSgenome.Hsapiens.UCSC.hg38_1.4.5 BSgenome_1.70.2 rtracklayer_1.62.0 BiocIO_1.12.0
[6] Biostrings_2.70.2 XVector_0.42.0 Azimuth_0.5.0 shinyBS_0.61.1 EnsDb.Hsapiens.v86_2.99.0
[11] ensembldb_2.26.0 AnnotationFilter_1.26.0 GenomicFeatures_1.54.3 AnnotationDbi_1.64.1 Biobase_2.62.0
[16] future_1.33.1 GenomicRanges_1.54.1 GenomeInfoDb_1.38.7 IRanges_2.36.0 S4Vectors_0.40.2
[21] BiocGenerics_0.48.1 Signac_1.12.0 pbmcref.SeuratData_1.0.0 SeuratData_0.2.2.9001 SeuratDisk_0.0.0.9021
[26] Seurat_5.0.2 SeuratObject_5.0.1 sp_2.1-3 HuMMuS_0.0.1

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

@r-trimbour
Copy link
Member

r-trimbour commented Apr 8, 2024

Dear Daniel,

Sorry for late answer, I was off then a lot of work to catch up. I hope everything is now fine about your family matters. :)

I finally identified the problem with SeuratV5, thanks a lot for pointing out this incompatibility. I should update HuMMuS in the week and let you know as soon as I'm done so you can test it ! :)

Have a great day,
Rémi

@r-trimbour
Copy link
Member

r-trimbour commented Apr 10, 2024

Dear Daniel,

You can install the new version of HuMMuS with devtools::install_github("cantinilab/HuMMuS", ref="dev_SeuratV5").
It should solve your issue and issues with SeuratV5 in general 🙂

Let me know if it works !
Rémi

@r-trimbour r-trimbour removed the bug Something isn't working label Apr 10, 2024
@r-trimbour r-trimbour self-assigned this Apr 10, 2024
@inhyeoklee
Copy link
Author

inhyeoklee commented Apr 10, 2024

It works now! What was the issue with Seurat V5 if you don't mind sharing?

Thanks,
Daniel

@r-trimbour
Copy link
Member

So in the previous version, Hummus objects were built on top of Seurat objects, which allowed to apply all Seurat functions to it.

If I understood correctly the update, with Seurat V5 they changed the way of how their functions extract the names of the assays stored in the SeuratObject. They are now checking before running the functions if it's a SeuratObject and its version, which was annoying when creating a new type of class on top of it.
--> Error in validObject(object = .Object) : invalid class "Seurat" object: 'assays' must be a named list.

To solve this but keep HuMMuS usable with both Seurat package version, I chose made Hummus_Object class more independent from SeuratObjects now.

I added a Hummus_Object@assays slot, that will contain only the Seurat Assays.
I then added/adapted some methods to work with this @assays slot instead of the whole previously stored Seurat Object

It should give lighter Hummus_Objects and reduce compatibility issues as long as they don't modify too much Assays stuctures. 🙂

@inhyeoklee
Copy link
Author

Ah What a clever workaround! Thanks for your work, Rémi. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants