seurat icon indicating copy to clipboard operation
seurat copied to clipboard

Can't merge subsetted objects following integration

Open ifyouseqamy opened this issue 2 years ago • 2 comments

Hello,

I have the following two objects:

OBJECTA An object of class Seurat 43818 features across 10019 samples within 3 assays Active assay: integrated (9269 features, 3000 variable features) 2 other assays present: RNA, SCT 2 dimensional reductions calculated: pca, umap

OBJECTB An object of class Seurat 43818 features across 314 samples within 3 assays Active assay: integrated (9269 features, 3000 variable features) 2 other assays present: RNA, SCT 2 dimensional reductions calculated: pca, umap

I want to merge them, but I can't:

OBJECTC <- merge(x = OBJECTA, y = OBJECTB) Error in apply(X = GetAssayData(object = object, assay = assay, slot = "scale.data")[, : dim(X) must have a positive length

Some background:

Both objects have been subsetted out of the same, integrated object. In short, I split the integrated object into two and am trying to merge a piece from the second half back into the first.

I can't integrate by changing the default assay of these objects to 'RNA' or 'integrated'.

Any ideas?

sessionInfo() R version 4.0.2 (2020-06-22) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS 10.16

Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

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

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

other attached packages: [1] metap_1.8 CVRCFunc_0.1.0 FCVFunc_0.3.2
[4] TSCAN_2.0.0 Cairo_1.5-12.2 dittoSeq_1.2.6
[7] pheatmap_1.0.12 scRNAseq_2.4.0 SingleCellExperiment_1.12.0 [10] celldex_1.0.0 SingleR_1.4.1 SummarizedExperiment_1.20.0 [13] GenomicRanges_1.42.0 GenomeInfoDb_1.26.2 MatrixGenerics_1.2.0
[16] matrixStats_0.61.0 biomaRt_2.46.0 cowplot_1.1.1
[19] Matrix_1.4-0 org.Mm.eg.db_3.12.0 AnnotationDbi_1.52.0
[22] IRanges_2.24.0 S4Vectors_0.28.1 Biobase_2.50.0
[25] BiocGenerics_0.36.0 sctransform_0.3.3 ggsignif_0.6.3.9000
[28] ggplot2_3.3.5 patchwork_1.1.1 presto_1.0.0
[31] data.table_1.14.2 Rcpp_1.0.8 SeuratWrappers_0.3.0
[34] remotes_2.4.2 SeuratObject_4.0.4 Seurat_4.1.0
[37] dplyr_1.0.8

loaded via a namespace (and not attached): [1] rappdirs_0.3.3 SparseM_1.78 rtracklayer_1.50.0
[4] scattermore_0.8 R.methodsS3_1.8.1 tidyr_1.2.0
[7] bit64_4.0.5 multcomp_1.4-18 irlba_2.3.5
[10] DelayedArray_0.16.0 R.utils_2.11.0 rpart_4.1-15
[13] RCurl_1.98-1.2 AnnotationFilter_1.14.0 generics_0.1.2
[16] GenomicFeatures_1.42.1 TH.data_1.1-0 callr_3.7.0
[19] usethis_2.0.0 RSQLite_2.2.1 RANN_2.6.1
[22] combinat_0.0-8 future_1.24.0 bit_4.0.4
[25] mutoss_0.1-12 spatstat.data_2.1-2 xml2_1.3.2
[28] httpuv_1.6.5 assertthat_0.2.1 viridis_0.6.1
[31] hms_1.1.0 promises_1.2.0.1 fansi_1.0.2
[34] progress_1.2.2 caTools_1.18.2 dbplyr_2.1.1
[37] tmvnsim_1.0-2 geneplotter_1.68.0 igraph_1.2.11
[40] DBI_1.1.0 htmlwidgets_1.5.4 spatstat.geom_2.3-2
[43] purrr_0.3.4 ellipsis_0.3.2 RSpectra_0.16-0
[46] annotate_1.68.0 deldir_1.0-6 sparseMatrixStats_1.2.0
[49] vctrs_0.3.8 ensembldb_2.14.0 ROCR_1.0-11
[52] abind_1.4-5 withr_2.5.0 grr_0.9.5
[55] GenomicAlignments_1.26.0 prettyunits_1.1.1 mnormt_2.0.2
[58] mclust_5.4.9 goftest_1.2-3 cluster_2.1.0
[61] ExperimentHub_1.16.1 lazyeval_0.2.2 crayon_1.5.0
[64] genefilter_1.72.0 labeling_0.4.2 edgeR_3.32.0
[67] pkgconfig_2.0.3 qqconf_1.2.1 nlme_3.1-149
[70] pkgload_1.1.0 ProtGenerics_1.22.0 devtools_2.3.2
[73] rlang_1.0.1 globals_0.14.0 lifecycle_1.0.1
[76] miniUI_0.1.1.1 sandwich_3.0-1 BiocFileCache_1.14.0
[79] mathjaxr_1.0-1 rsvd_1.0.5 AnnotationHub_2.22.0
[82] rprojroot_2.0.2 polyclip_1.10-0 lmtest_0.9-39
[85] graph_1.68.0 Matrix.utils_0.9.8 zoo_1.8-9
[88] ggridges_0.5.3 GlobalOptions_0.1.2 processx_3.5.2
[91] png_0.1-7 viridisLite_0.4.0 rjson_0.2.20
[94] bitops_1.0-7 R.oo_1.24.0 KernSmooth_2.23-18
[97] Biostrings_2.58.0 blob_1.2.1 DelayedMatrixStats_1.12.1
[100] shape_1.4.6 stringr_1.4.0 parallelly_1.30.0
[103] spatstat.random_2.1-0 beachmat_2.6.2 scales_1.1.1
[106] memoise_1.1.0 magrittr_2.0.2 plyr_1.8.6
[109] ica_1.0-2 gplots_3.1.1 zlibbioc_1.36.0
[112] compiler_4.0.2 RColorBrewer_1.1-2 plotrix_3.7-8
[115] clue_0.3-59 DESeq2_1.30.0 fitdistrplus_1.1-6
[118] Rsamtools_2.6.0 cli_3.2.0 XVector_0.30.0
[121] listenv_0.8.0 pbapply_1.5-0 ps_1.5.0
[124] MASS_7.3-53 mgcv_1.8-33 tidyselect_1.1.2
[127] stringi_1.7.6 yaml_2.3.5 BiocSingular_1.6.0
[130] askpass_1.1 locfit_1.5-9.4 ggrepel_0.9.1
[133] grid_4.0.2 tools_4.0.2 matrixcalc_1.0-5
[136] future.apply_1.8.1 circlize_0.4.13 rstudioapi_0.13
[139] gridExtra_2.3 farver_2.1.0 Rtsne_0.15
[142] digest_0.6.29 BiocManager_1.30.16 shiny_1.7.1
[145] BiocVersion_3.12.0 later_1.3.0 RcppAnnoy_0.0.19
[148] org.Hs.eg.db_3.12.0 httr_1.4.2 ComplexHeatmap_2.6.2
[151] Rdpack_2.1.4 colorspace_2.0-3 topGO_2.42.0
[154] fs_1.5.2 XML_3.99-0.5 tensor_1.5
[157] reticulate_1.24 splines_4.0.2 uwot_0.1.11
[160] sn_2.0.2 spatstat.utils_2.3-0 multtest_2.46.0
[163] sessioninfo_1.1.1 plotly_4.10.0 xtable_1.8-4
[166] jsonlite_1.8.0 testthat_3.0.0 R6_2.5.1
[169] TFisher_0.2.0 pillar_1.7.0 htmltools_0.5.2
[172] mime_0.12 glue_1.6.2 fastmap_1.1.0
[175] BiocParallel_1.24.1 BiocNeighbors_1.8.2 interactiveDisplayBase_1.28.0 [178] codetools_0.2-18 mvtnorm_1.1-1 pkgbuild_1.1.0
[181] utf8_1.2.2 lattice_0.20-41 spatstat.sparse_2.1-0
[184] tibble_3.1.6 numDeriv_2016.8-1.1 curl_4.3.2
[187] leiden_0.3.9 gtools_3.9.2 GO.db_3.12.1
[190] openssl_2.0.0 survival_3.2-7 limma_3.46.0
[193] desc_1.2.0 fastICA_1.2-3 munsell_0.5.0
[196] GetoptLong_1.0.5 GenomeInfoDbData_1.2.4 reshape2_1.4.4
[199] gtable_0.3.0 rbibutils_2.2.7 spatstat.core_2.4-0

ifyouseqamy avatar Apr 05 '22 19:04 ifyouseqamy

Hi, is any of your scale.data slots empty in one of your objects (either in the SCT or the RNA assay)?

torkencz avatar Apr 15 '22 17:04 torkencz

No, they both have contents.

ifyouseqamy avatar Apr 16 '22 13:04 ifyouseqamy

Its hard to debug these without having the objects, but we have made recent improvements to merge which should fix this issue. Please feel free to re-open if it continues to occur

rsatija avatar Jul 07 '23 22:07 rsatija