immunogenomics / symphony

Efficient and precise single-cell reference atlas mapping with Symphony
GNU General Public License v3.0
95 stars 22 forks source link

Error: Mat::init(): requested size is too large; suggest to enable ARMA_64BIT_WORD #49

Open vivekruhela opened 6 months ago

vivekruhela commented 6 months ago

I am trying to perform cell annotation using Mapquery using seurat object. I am following the reference from here. I am facing the following error in Mapquery:

Error: Mat::init(): requested size is too large; suggest to enable ARMA_64BIT_WORD

In query dataset, I have 21 samples with 99403 cells in total. I am using the following code:

ref_obj <- ref_obj %>% 
NormalizeData(normalization.method = "LogNormalize", scale.factor = 10000) %>% 
FindVariableFeatures(selection.method = "vst", nfeatures = 2000) %>% 
ScaleData(verbose = T) %>% 
RunPCA(verbose = T) %>% RunHarmony.Seurat('orig.ident', verbose = T)  %>%
FindNeighbors(dims = 1:20, reduction = 'harmony', verbose = T) %>%
FindClusters(resolution = 0.5, verbose = T)

ref_obj[['umap']] <- RunUMAP2(Embeddings(ref_obj, 'harmony')[, 1:20], 
                      assay='RNA', verbose=FALSE, umap.method='uwot',
                      return.model=TRUE)

# Plot reference
pdf("human_fl_21/Tcell_Apre-UMAP.pdf")
options(repr.plot.height = 4, repr.plot.width = 6)
DimPlot(ref_obj, reduction = 'umap', group.by = 'seurat_clusters', shuffle = TRUE)
DimPlot(ref_obj, reduction = 'umap', group.by = 'cell.id', shuffle = TRUE)
dev.off()

ref <- buildReferenceFromSeurat(ref_obj, verbose = TRUE, save_umap = TRUE,
                            save_uwot_path = 'cache_symphony.uwot')

query <- mapQuery(seurat.combined@assays$RNA@features@.Data, 
              seurat.combined@meta.data,
              ref, vars = 'orig.ident', 
              return_type = 'Seurat'
)

In seurat.combined, there is no counts slot in RNA assay. That's why I am using data slot. In my seurat.combined object, I have count layer in SCT assay only. When I use the following approach for mapquery:

query <- mapQuery(immunecell.combined@assays$SCT@counts, 
              immunecell.combined@meta.data,
              ref, vars = 'orig.ident', 
              return_type = 'Seurat'
)

I am getting the following error:

Normalizing
Scaling and synchronizing query gene expression
Found 1933 reference variable genes in query dataset
Project query cells using reference gene loadings
Clustering query cells to reference centroids
Correcting query batch effects
UMAP
All done!
Error in (function (cl, name, valueClass)  : 
‘data’ is not a slot in class “Assay5”

Please suggest. The session info is shown below:

sessionInfo() R version 4.3.2 (2023-10-31) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Red Hat Enterprise Linux 8.8 (Ootpa)

Matrix products: default BLAS: /usr/lib64/libblas.so.3.8.0 LAPACK: /usr/lib64/liblapack.so.3.8.0

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C LC_MONETARY=C LC_MESSAGES=C LC_PAPER=C
[8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C

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

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

other attached packages: [1] harmony_1.2.0 Rcpp_1.0.12 symphony_0.1.1 cluster_2.1.4 HGNChelper_0.8.1
[6] openxlsx_4.2.5.2 dplyr_1.1.4 DropletUtils_1.22.0 patchwork_1.2.0 cowplot_1.1.3
[11] gtools_3.9.5 celldex_1.12.0 robustbase_0.99-2 dynamicTreeCut_1.63-1 Seurat_5.0.1
[16] SeuratObject_5.0.1 sp_2.1-3 readxl_1.4.3 limma_3.58.1 scran_1.30.2
[21] scater_1.30.1 ggplot2_3.5.0 scuttle_1.12.0 SingleCellExperiment_1.24.0 SummarizedExperiment_1.32.0 [26] Biobase_2.62.0 GenomicRanges_1.54.1 GenomeInfoDb_1.38.6 IRanges_2.36.0 S4Vectors_0.40.2
[31] MatrixGenerics_1.14.0 matrixStats_1.2.0 AnnotationHub_3.10.0 BiocFileCache_2.10.1 dbplyr_2.4.0
[36] BiocGenerics_0.48.1

loaded via a namespace (and not attached): [1] spatstat.sparse_3.0-3 bitops_1.0-7 httr_1.4.7 RColorBrewer_1.1-3 tools_4.3.2
[6] sctransform_0.4.1 utf8_1.2.4 R6_2.5.1 HDF5Array_1.30.0 lazyeval_0.2.2
[11] uwot_0.1.16 rhdf5filters_1.14.1 withr_3.0.0 gridExtra_2.3 progressr_0.14.0
[16] cli_3.6.2 spatstat.explore_3.2-6 fastDummies_1.7.3 labeling_0.4.3 spatstat.data_3.0-4
[21] ggridges_0.5.6 pbapply_1.7-2 R.utils_2.12.3 parallelly_1.37.0 rstudioapi_0.15.0
[26] RSQLite_2.3.5 generics_0.1.3 ica_1.0-3 spatstat.random_3.2-2 zip_2.3.1
[31] Matrix_1.6-5 ggbeeswarm_0.7.2 fansi_1.0.6 abind_1.4-5 R.methodsS3_1.8.2
[36] lifecycle_1.0.4 yaml_2.3.8 edgeR_4.0.16 rhdf5_2.46.1 SparseArray_1.2.4
[41] Rtsne_0.17 grid_4.3.2 blob_1.2.4 promises_1.2.1 dqrng_0.3.2
[46] ExperimentHub_2.10.0 crayon_1.5.2 miniUI_0.1.1.1 lattice_0.21-9 beachmat_2.18.1
[51] KEGGREST_1.42.0 pillar_1.9.0 metapod_1.10.1 future.apply_1.11.1 codetools_0.2-19
[56] leiden_0.4.3.1 glue_1.7.0 data.table_1.15.0 vctrs_0.6.5 png_0.1-8
[61] spam_2.10-0 cellranger_1.1.0 gtable_0.3.4 cachem_1.0.8 S4Arrays_1.2.1
[66] mime_0.12 survival_3.5-8 statmod_1.5.0 bluster_1.12.0 interactiveDisplayBase_1.40.0 [71] ellipsis_0.3.2 fitdistrplus_1.1-11 ROCR_1.0-11 nlme_3.1-164 bit64_4.0.5
[76] filelock_1.0.3 RcppAnnoy_0.0.22 irlba_2.3.5.1 vipor_0.4.7 KernSmooth_2.23-22
[81] colorspace_2.1-0 DBI_1.2.1 tidyselect_1.2.0 bit_4.0.5 compiler_4.3.2
[86] curl_5.2.0 BiocNeighbors_1.20.2 DelayedArray_0.28.0 plotly_4.10.4 scales_1.3.0
[91] DEoptimR_1.1-3 lmtest_0.9-40 rappdirs_0.3.3 stringr_1.5.1 digest_0.6.35
[96] goftest_1.2-3 spatstat.utils_3.0-4 RhpcBLASctl_0.23-42 XVector_0.42.0 htmltools_0.5.7
[101] pkgconfig_2.0.3 sparseMatrixStats_1.14.0 fastmap_1.1.1 rlang_1.1.3 htmlwidgets_1.6.4
[106] shiny_1.8.0 DelayedMatrixStats_1.24.0 farver_2.1.1 zoo_1.8-12 jsonlite_1.8.8
[111] BiocParallel_1.36.0 R.oo_1.26.0 BiocSingular_1.18.0 RCurl_1.98-1.14 magrittr_2.0.3
[116] GenomeInfoDbData_1.2.11 dotCall64_1.1-1 Rhdf5lib_1.24.2 munsell_0.5.0 viridis_0.6.5
[121] reticulate_1.35.0 stringi_1.8.3 zlibbioc_1.48.0 MASS_7.3-60 plyr_1.8.9
[126] parallel_4.3.2 listenv_0.9.1 ggrepel_0.9.5 deldir_2.0-2 Biostrings_2.70.2
[131] splines_4.3.2 tensor_1.5 locfit_1.5-9.9 igraph_2.0.3 spatstat.geom_3.2-8
[136] RcppHNSW_0.6.0 reshape2_1.4.4 ScaledMatrix_1.10.0 BiocVersion_3.18.1 BiocManager_1.30.22
[141] httpuv_1.6.14 RANN_2.6.1 tidyr_1.3.1 purrr_1.0.2 polyclip_1.10-6
[146] future_1.33.1 scattermore_1.2 rsvd_1.0.5 xtable_1.8-4 RSpectra_0.16-1
[151] later_1.3.2 class_7.3-22 viridisLite_0.4.2 tibble_3.2.1 memoise_2.0.1
[156] beeswarm_0.4.0 AnnotationDbi_1.64.1 globals_0.16.2