seurat icon indicating copy to clipboard operation
seurat copied to clipboard

MapQuery() with uwot version 0.1.14 doesn't work

Open liviuspenter opened this issue 2 years ago • 5 comments

Hi there,

I just updated my R environment and tried to run MapQuery() with Seurat 4.1.1, which resulted in the following error (see below).

After poking around a bit I figured this could be due to the newer uwot package version 0.1.14. Indeed, after downgrading to uwot version 0.1.11, MapQuery() runs without problems.

Could you check whether there is some incompatibility between Seurat 4.1.1 and the latest version 0.1.14 of uwot (which was released 3 days ago)?

Thank you,

livius

AML1007 <- MapQuery(anchorset = anchors, so, reference = bm, refdata = list(celltype = "celltype.l2", predicted_ADT = "ADT"), reference.reduction = "spca", reduction.model = "wnn.umap") Finding integration vectors Finding integration vector weights 0% 10 20 30 40 50 60 70 80 90 100% [----|----|----|----|----|----|----|----|----|----| **************************************************| Predicting cell labels Warning: Feature names cannot have underscores (''), replacing with dashes ('-') Transfering 25 features onto reference data Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from predicted_ADT to predictedADT_ | | 0 % ~calculating
Integrating dataset 2 with reference dataset Finding integration vectors Integrating data |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s
Computing nearest neighbors Running UMAP projection Error in if (num_precomputed_nns == 0) { : argument is of length zero

This is my session info after the downgrade of uwot:

sessionInfo() R version 4.2.1 (2022-06-23) Platform: x86_64-apple-darwin21.5.0 (64-bit) Running under: macOS Monterey 12.5.1

Matrix products: default LAPACK: /usr/local/Cellar/r/4.2.1_2/lib/R/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] stats graphics grDevices utils datasets methods base

other attached packages: [1] sp_1.5-0 SeuratObject_4.1.0 Seurat_4.1.1

loaded via a namespace (and not attached): [1] Rtsne_0.16 colorspace_2.0-3 deldir_1.0-6 ellipsis_0.3.2 ggridges_0.5.3 XVector_0.36.0 rstudioapi_0.14
[8] spatstat.data_2.2-0 leiden_0.4.2 listenv_0.8.0 ggrepel_0.9.1 fansi_1.0.3 codetools_0.2-18 splines_4.2.1
[15] polyclip_1.10-0 jsonlite_1.8.0 ica_1.0-3 cluster_2.1.4 png_0.1-7 rgeos_0.5-9 uwot_0.1.11
[22] shiny_1.7.2 sctransform_0.3.4 spatstat.sparse_2.1-1 compiler_4.2.1 httr_1.4.4 assertthat_0.2.1 Matrix_1.4-1
[29] fastmap_1.1.0 lazyeval_0.2.2 cli_3.3.0 later_1.3.0 htmltools_0.5.3 tools_4.2.1 igraph_1.3.4
[36] gtable_0.3.0 glue_1.6.2 RANN_2.6.1 reshape2_1.4.4 dplyr_1.0.9 Rcpp_1.0.9 scattermore_0.8
[43] Biobase_2.56.0 vctrs_0.4.1 nlme_3.1-159 progressr_0.10.1 lmtest_0.9-40 spatstat.random_2.2-0 stringr_1.4.1
[50] globals_0.16.0 mime_0.12 miniUI_0.1.1.1 lifecycle_1.0.1 irlba_2.3.5 goftest_1.2-3 future_1.27.0
[57] MASS_7.3-58.1 zlibbioc_1.42.0 zoo_1.8-10 scales_1.2.1 spatstat.core_2.4-4 promises_1.2.0.1 spatstat.utils_2.3-1 [64] parallel_4.2.1 RColorBrewer_1.1-3 reticulate_1.25 pbapply_1.5-0 gridExtra_2.3 ggplot2_3.3.6 rpart_4.1.16
[71] stringi_1.7.6 S4Vectors_0.34.0 BiocGenerics_0.42.0 rlang_1.0.4 pkgconfig_2.0.3 matrixStats_0.62.0 lattice_0.20-45
[78] ROCR_1.0-11 purrr_0.3.4 tensor_1.5 patchwork_1.1.2 htmlwidgets_1.5.4 cowplot_1.1.1 tidyselect_1.1.2
[85] parallelly_1.32.1 RcppAnnoy_0.0.19 plyr_1.8.7 magrittr_2.0.3 R6_2.5.1 IRanges_2.30.0 generics_0.1.3
[92] DBI_1.1.3 pillar_1.8.1 mgcv_1.8-40 fitdistrplus_1.1-8 survival_3.4-0 abind_1.4-5 tibble_3.1.8
[99] future.apply_1.9.0 crayon_1.5.1 KernSmooth_2.23-20 utf8_1.2.2 spatstat.geom_2.4-0 plotly_4.10.0 grid_4.2.1
[106] data.table_1.14.2 digest_0.6.29 xtable_1.8-4 tidyr_1.2.0 httpuv_1.6.5 stats4_4.2.1 munsell_0.5.0
[113] viridisLite_0.4.1

liviuspenter avatar Aug 26 '22 02:08 liviuspenter

Hi, thanks for pointing out this issue. MapQuery uses the UMAP models from uwot to project query cells into the reference UMAP space and the latest uwot versions add a few additional variables to these models. My guess here is that the bm object contains a UMAP model generated using a pre-0.1.13 uwot version. There will be a new Seurat version very soon which will fix this issue, but in the meantime you should be able to use this as a workaround before running MapQuery: Misc(bm[["wnn.umap"]], slot="model")$num_precomputed_nns <- 1

AustinHartman avatar Aug 26 '22 03:08 AustinHartman

Hi, thanks for pointing out this issue. MapQuery uses the UMAP models from uwot to project query cells into the reference UMAP space and the latest uwot versions add a few additional variables to these models. My guess here is that the bm object contains a UMAP model generated using a pre-0.1.13 uwot version. There will be a new Seurat version very soon which will fix this issue, but in the meantime you should be able to use this as a workaround before running MapQuery: Misc(bm[["wnn.umap"]], slot="model")$num_precomputed_nns <- 1

This did not work for me, I had to downgrade UWOT to v.0.1.11

ViHammer avatar Sep 02 '22 13:09 ViHammer

Hi @ViHammer (or @shaka87), this is useful to know. Any chance you could provide an example where downgrading to uwot v0.1.11 seems to be the only solution? I'm having trouble reproducing such a case

AustinHartman avatar Sep 02 '22 14:09 AustinHartman

I just sent you an email with the reference I use as dropbox link to download. @AustinHartman

liviuspenter avatar Sep 02 '22 14:09 liviuspenter

The code that failed with uwot 0.1.14: code.txt

I sadly do not have the sessionInfo anymore, as I modified the environment to downgrade uwot.

@AustinHartman

ViHammer avatar Sep 05 '22 09:09 ViHammer

the latest uwot doesn't have this issue. i will close this issue.

yuhanH avatar Jul 06 '23 18:07 yuhanH

It did work for me, the "bm" should change to your own reference name

Misc(bm[["wnn.umap"]], slot="model")$num_precomputed_nns <- 1

Jasemineonly avatar Nov 03 '23 02:11 Jasemineonly