seurat
seurat copied to clipboard
SketchData throws ERROR
Hi!
I am trying to run an analysis on a subset of cells from a large Xenium object:
spat An object of class Seurat 541 features across 1580150 samples within 4 assays Active assay: Xenium (479 features, 479 variable features) 3 layers present: data, counts, scale.data 3 other assays present: BlankCodeword, ControlCodeword, ControlProbe 3 dimensional reductions calculated: pca, harmony, umap 7 spatial fields of view present: fov fov.2 fov.3 fov.4 fov.5 fov.6 fov.7
spat = SketchData(object=spat, ncells=100000, method="LeverageScore", sketched.assay="sketch", verbose=T) Calcuating Leverage Score Error in switch(EXPR = tolower(x = method), mean.var.plot = "mvp", dispersion = "disp", : EXPR must be a length 1 vector
Is there any solution to this problem?
Thanks, Chris:
sessionInfo() R version 4.3.3 (2024-02-29) Platform: x86_64-conda-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core)
Matrix products: default BLAS/LAPACK: /fast/AG_Schmidt-Ott/tcga_data/miniconda/envs/seu5/lib/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: Europe/Berlin tzcode source: system (glibc)
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] Seurat_5.0.3 SeuratObject_5.0.1 sp_2.1-3 spacexr_2.2.1
loaded via a namespace (and not attached): [1] deldir_2.0-4 pbapply_1.7-2 gridExtra_2.3 [4] rlang_1.1.3 magrittr_2.0.3 RcppAnnoy_0.0.22 [7] spatstat.geom_3.2-9 matrixStats_1.2.0 ggridges_0.5.6 [10] compiler_4.3.3 png_0.1-8 vctrs_0.6.5 [13] reshape2_1.4.4 quadprog_1.5-8 stringr_1.5.1 [16] crayon_1.5.2 pkgconfig_2.0.3 fastmap_1.1.1 [19] ellipsis_0.3.2 utf8_1.2.4 promises_1.2.1 [22] purrr_1.0.2 jsonlite_1.8.8 goftest_1.2-3 [25] later_1.3.2 spatstat.utils_3.0-4 irlba_2.3.5.1 [28] parallel_4.3.3 cluster_2.1.6 R6_2.5.1 [31] ica_1.0-3 stringi_1.8.3 RColorBrewer_1.1-3 [34] spatstat.data_3.0-4 reticulate_1.35.0 parallelly_1.37.1 [37] lmtest_0.9-40 scattermore_1.2 Rcpp_1.0.12 [40] iterators_1.0.14 tensor_1.5 future.apply_1.11.1 [43] zoo_1.8-12 sctransform_0.4.1 httpuv_1.6.14 [46] Matrix_1.6-5 splines_4.3.3 igraph_2.0.3 [49] tidyselect_1.2.1 abind_1.4-5 spatstat.random_3.2-3 [52] doParallel_1.0.17 codetools_0.2-19 miniUI_0.1.1.1 [55] spatstat.explore_3.2-7 listenv_0.9.1 lattice_0.22-6 [58] tibble_3.2.1 plyr_1.8.9 shiny_1.8.0 [61] ROCR_1.0-11 Rtsne_0.17 future_1.33.1 [64] fastDummies_1.7.3 survival_3.5-8 polyclip_1.10-6 [67] fitdistrplus_1.1-11 pillar_1.9.0 KernSmooth_2.23-22 [70] foreach_1.5.2 plotly_4.10.4 generics_0.1.3 [73] RcppHNSW_0.6.0 ggplot2_3.5.1 munsell_0.5.1 [76] scales_1.3.0 globals_0.16.3 xtable_1.8-4 [79] glue_1.7.0 lazyeval_0.2.2 tools_4.3.3 [82] data.table_1.15.4 RSpectra_0.16-1 RANN_2.6.1 [85] leiden_0.4.3.1 dotCall64_1.1-1 cowplot_1.1.3 [88] grid_4.3.3 tidyr_1.3.1 colorspace_2.1-0 [91] nlme_3.1-164 patchwork_1.2.0 cli_3.6.2 [94] spatstat.sparse_3.0-3 spam_2.10-0 fansi_1.0.6 [97] viridisLite_0.4.2 dplyr_1.1.4 uwot_0.1.16 [100] gtable_0.3.5 digest_0.6.35 progressr_0.14.0 [103] ggrepel_0.9.5 htmlwidgets_1.6.4 htmltools_0.5.8.1 [106] lifecycle_1.0.4 httr_1.4.7 mime_0.12 [109] MASS_7.3-60.0.1
Hi,
How did you set the variable features in your object? Can you try running FindVariableFeatures
and set nfeatures
to 479 just to extract all the features as variable features as you had previously?
spat <- FindVariableFeatures(spat, nfeatures = 479)
spat <- SketchData(object=spat, ncells=100000, method="LeverageScore", sketched.assay="sketch", verbose=T)
This is a bug we are aware of that occurs if you run SketchData on an object in which variable features were set manually. I will push a fix shortly, but in the meantime you can try this to be able to unblock yourself.