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

Error Converting Seurat to SingleCellExperiment Object #4639

Closed
KshitijDeoghar opened this issue Jun 16, 2021 · 9 comments
Closed

Error Converting Seurat to SingleCellExperiment Object #4639

KshitijDeoghar opened this issue Jun 16, 2021 · 9 comments
Labels
more-information-needed We need more information before this can be addressed

Comments

@KshitijDeoghar
Copy link

KshitijDeoghar commented Jun 16, 2021

I am using Seurat v4 and trying to convert a Seurat object 'Abc' to SingleCellExperiment Object using the code below.

Abc_SCE <- as.SingleCellExperiment(Abc)

This is returning me an error message as below :

Error in method(object) : all assays must have the same nrow and ncol

Packages in use:
Seurat v4.0.3
Seurat Object v4.0.2
Single Cell Experiment v1.14.1

sessionInfo()

R>sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_India.1252 LC_CTYPE=English_India.1252 LC_MONETARY=English_India.1252 LC_NUMERIC=C
[5] LC_TIME=English_India.1252

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

other attached packages:
[1] forcats_0.5.1 stringr_1.4.0 purrr_0.3.4 tidyverse_1.3.1
[5] tibble_3.1.2 pheatmap_1.0.12 readr_1.4.0 EnhancedVolcano_1.10.0
[9] ggrepel_0.9.1 MAST_1.18.0 harmony_0.1.0 Rcpp_1.0.6
[13] tidyr_1.1.3 scCATCH_2.1 ggforce_0.3.3 patchwork_1.1.1
[17] scater_1.20.0 scuttle_1.2.0 SingleCellExperiment_1.14.1 SummarizedExperiment_1.22.0
[21] Biobase_2.52.0 GenomicRanges_1.44.0 GenomeInfoDb_1.28.0 IRanges_2.26.0
[25] S4Vectors_0.30.0 BiocGenerics_0.38.0 MatrixGenerics_1.4.0 matrixStats_0.59.0
[29] cowplot_1.1.1 ggpubr_0.4.0 magrittr_2.0.1 clustree_0.4.3
[33] ggraph_2.0.5 dplyr_1.0.6 ggplot2_3.3.4 SeuratObject_4.0.2
[37] Seurat_4.0.3 devtools_2.4.2 usethis_2.0.1 RColorBrewer_1.1-2
[41] installr_0.23.2

loaded via a namespace (and not attached):
[1] rappdirs_0.3.3 rtracklayer_1.52.0 scattermore_0.7 ragg_1.1.3 bit64_4.0.5
[6] irlba_2.3.3 DelayedArray_0.18.0 data.table_1.14.0 rpart_4.1-15 KEGGREST_1.32.0
[11] RCurl_1.98-1.3 AnnotationFilter_1.16.0 generics_0.1.0 GenomicFeatures_1.44.0 ScaledMatrix_1.0.0
[16] callr_3.7.0 RSQLite_2.2.7 RANN_2.6.1 future_1.21.0 bit_4.0.4
[21] lubridate_1.7.10 spatstat.data_2.1-0 xml2_1.3.2 httpuv_1.6.1 assertthat_0.2.1
[26] viridis_0.6.1 xfun_0.24 hms_1.1.0 promises_1.2.0.1 fansi_0.5.0
[31] restfulr_0.0.13 progress_1.2.2 dbplyr_2.1.1 readxl_1.3.1 igraph_1.2.6
[36] DBI_1.1.1 htmlwidgets_1.5.3 spatstat.geom_2.2-0 ellipsis_0.3.2 backports_1.2.1
[41] biomaRt_2.48.1 deldir_0.2-10 sparseMatrixStats_1.4.0 vctrs_0.3.8 remotes_2.4.0
[46] ensembldb_2.16.0 ROCR_1.0-11 abind_1.4-5 cachem_1.0.5 withr_2.4.2
[51] sctransform_0.3.2 GenomicAlignments_1.28.0 prettyunits_1.1.1 goftest_1.2-2 cluster_2.1.2
[56] lazyeval_0.2.2 crayon_1.4.1 labeling_0.4.2 pkgconfig_2.0.3 tweenr_1.0.2
[61] nlme_3.1-152 vipor_0.4.5 pkgload_1.2.1 ProtGenerics_1.24.0 rlang_0.4.11
[66] globals_0.14.0 lifecycle_1.0.0 miniUI_0.1.1.1 filelock_1.0.2 extrafontdb_1.0
[71] BiocFileCache_2.0.0 modelr_0.1.8 rsvd_1.0.5 ggrastr_0.2.3 cellranger_1.1.0
[76] rprojroot_2.0.2 polyclip_1.10-0 lmtest_0.9-38 Matrix_1.3-4 carData_3.0-4
[81] zoo_1.8-9 reprex_2.0.0 beeswarm_0.4.0 ggridges_0.5.3 processx_3.5.2
[86] png_0.1-7 viridisLite_0.4.0 rjson_0.2.20 bitops_1.0-7 KernSmooth_2.23-20
[91] Biostrings_2.60.0 blob_1.2.1 DelayedMatrixStats_1.14.0 parallelly_1.26.0 rstatix_0.7.0
[96] ggsignif_0.6.2 beachmat_2.8.0 scales_1.1.1 memoise_2.0.0 plyr_1.8.6
[101] ica_1.0-2 zlibbioc_1.38.0 compiler_4.1.0 tinytex_0.32 BiocIO_1.2.0
[106] ash_1.0-15 fitdistrplus_1.1-5 Rsamtools_2.8.0 cli_2.5.0 XVector_0.32.0
[111] listenv_0.8.0 pbapply_1.4-3 ps_1.6.0 MASS_7.3-54 mgcv_1.8-36
[116] tidyselect_1.1.1 stringi_1.6.2 textshaping_0.3.5 proj4_1.0-10.1 yaml_2.2.1
[121] BiocSingular_1.8.0 grid_4.1.0 tools_4.1.0 future.apply_1.7.0 rio_0.5.26
[126] rstudioapi_0.13 foreign_0.8-81 gridExtra_2.3 farver_2.1.0 Rtsne_0.15
[131] BiocManager_1.30.16 digest_0.6.27 shiny_1.6.0 car_3.0-10 broom_0.7.7
[136] ggalt_0.4.0 later_1.2.0 RcppAnnoy_0.0.18 httr_1.4.2 AnnotationDbi_1.54.1
[141] colorspace_2.0-1 rvest_1.0.0 XML_3.99-0.6 fs_1.5.0 tensor_1.5
[146] reticulate_1.20 splines_4.1.0 uwot_0.1.10 spatstat.utils_2.2-0 graphlayouts_0.7.1
[151] systemfonts_1.0.2 plotly_4.9.4 sessioninfo_1.1.1 xtable_1.8-4 jsonlite_1.7.2
[156] tidygraph_1.2.0 testthat_3.0.2 R6_2.5.0 pillar_1.6.1 htmltools_0.5.1.1
[161] mime_0.10 glue_1.4.2 fastmap_1.1.0 BiocParallel_1.26.0 BiocNeighbors_1.10.0
[166] codetools_0.2-18 maps_3.3.0 pkgbuild_1.2.0 utf8_1.2.1 lattice_0.20-44
[171] spatstat.sparse_2.0-0 curl_4.3.1 ggbeeswarm_0.6.0 leiden_0.3.8 Rttf2pt1_1.3.8
[176] zip_2.2.0 openxlsx_4.2.4 survival_3.2-11 desc_1.3.0 munsell_0.5.0
[181] GenomeInfoDbData_1.2.6 haven_2.4.1 reshape2_1.4.4 gtable_0.3.0 extrafont_0.17
[186] spatstat.core_2.1-2
PS - I am a completely new user on Github and this is my first post, so any feedback would be appreciated.

@torkencz
Copy link
Collaborator

Hi, Could you give some information on your object. Number of assays, nrows,ncols etc.?

@torkencz torkencz reopened this Jun 18, 2021
@torkencz torkencz added the more-information-needed We need more information before this can be addressed label Jun 18, 2021
@torkencz
Copy link
Collaborator

From what I am seeing this is a returning issue. #4633. Will take a look. This should be a temporary fix.
Abc_Object_Diet <- DietSeurat(Abc, graphs = "pca")
SCE <- as.SingleCellExperiment(Abc_Object_Diet)

@KshitijDeoghar
Copy link
Author

@torkencz Thank you so much for providing the temporary fix. It worked.
Could you please tell me what is the issue with the original function and why is it returning an error (without trimming it using DietSeurat) ?

@no-response no-response bot removed the more-information-needed We need more information before this can be addressed label Jun 21, 2021
@ka-lw
Copy link

ka-lw commented Jun 21, 2021

I am experiencing the same issue - possibly a bug with the new update? Thanks for the work around code, will use that for now.

@torkencz
Copy link
Collaborator

Hi can someone share an object (or a subsampled / dummy version that reproduces the issue) with us at seuratpackage@gmail.com so we can fix this issue?

@torkencz torkencz added the more-information-needed We need more information before this can be addressed label Jun 25, 2021
@torkencz
Copy link
Collaborator

torkencz commented Jul 2, 2021

I found what was happening. In the in line 1187 in as.SingleCellExperiment
scaledata = GetAssayData(object = x, assay = assayn, slot = "scale.data")) breaks things if you have less than all features as variable. I will try to fix it and see if it needs to be removed or not. Diet Seurat fixes that for now.

@no-response
Copy link

no-response bot commented Jul 9, 2021

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@no-response no-response bot closed this as completed Jul 9, 2021
@andrewwbutler
Copy link
Collaborator

Hi all,

This bug should be resolved now on the develop branch. Please try installing (instructions here) to fix the issue.

@maggiebr0wn
Copy link

Hello, I've tried the DietSeurat suggestions and the newest "develop" branch and am still facing the issues described above.

sle_ascs.sce <- as.SingleCellExperiment(Seurat_Object_Diet)
Error in method(object) : all assays must have the same nrow and ncol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more-information-needed We need more information before this can be addressed
Projects
None yet
Development

No branches or pull requests

5 participants