Skip to content

MapQuery gives warning about no assay specified #5104

Closed
@ndaniel

Description

Hello,

it looks like MapQuery generates lots and lots of warnings and one of them which looks very confusing is Warning: No assay specified, setting assay as RNA by default. One would expect that by the time MapQuery is run the default assay to be already specified and not have MapQuery working with data (original data that is inassay RNA?). At first glance it looks like the warning is generated by the RunUMAP that is run by the MapQuery.

Is this warning a bug or is it expected behavior from MapQuery?
What is the correct default assay for MapQuery?

One may generate the warning from above by running the Seurat example no. 1 for Multimodal reference mapping, which is as following:

library(Seurat)
library(SeuratDisk)
library(ggplot2)
library(patchwork)
library(SeuratData)

InstallData('pbmc3k')

reference <- LoadH5Seurat("../data/pbmc_multimodal.h5seurat")

anchors <- FindTransferAnchors(
  reference = reference,
  query = pbmc3k,
  normalization.method = "SCT",
  reference.reduction = "spca",
  dims = 1:50
)

pbmc3k <- MapQuery(
  anchorset = anchors,
  query = pbmc3k,
  reference = reference,
  refdata = list(
    celltype.l1 = "celltype.l1",
    celltype.l2 = "celltype.l2",
    predicted_ADT = "ADT"
  ),
  reference.reduction = "spca", 
  reduction.model = "wnn.umap"
)

where one gets this output from MapQuery:

...
Finding integration vectors
Finding integration vector weights
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Predicting cell labels
Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from predictionscorecelltype.l1_ to predictionscorecelltypel1_
Predicting cell labels
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')
Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from predictionscorecelltype.l2_ to predictionscorecelltypel2_
Transfering 228 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
Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from ref.spca_ to refspca_

  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=01s  
Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from ref.spca_ to refspca_
Warning: All keys should be one or more alphanumeric characters followed by an underscore '_', setting key to refspca_
Computing nearest neighbors
Warning: The default method for RunUMAP has changed from calling Python UMAP via reticulate to the R-native UWOT using the cosine metric
To use Python UMAP via reticulate, set umap.method to 'umap-learn' and metric to 'correlation'
This message will be shown once per session
Running UMAP projection
11:47:50 Read 2700 rows and found  numeric columns
11:47:50 Processing block 1 of 1
11:47:50 Commencing smooth kNN distance calibration using 1 thread
11:47:50 Initializing by weighted average of neighbor coordinates using 1 thread
11:47:50 Commencing optimization for 67 epochs, with 54000 positive edges
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
11:47:51 Finished
Warning: No assay specified, setting assay as RNA by default.

where:

> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

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

other attached packages:
[1] pbmc3k.SeuratData_3.1.4 SeuratData_0.2.1        patchwork_1.1.1        
[4] ggplot2_3.3.5           SeuratDisk_0.0.0.9019   SeuratObject_4.0.2     
[7] Seurat_4.0.4           

loaded via a namespace (and not attached):
  [1] nlme_3.1-153          matrixStats_0.60.1    spatstat.sparse_2.0-0
  [4] bit64_4.0.5           RcppAnnoy_0.0.19      RColorBrewer_1.1-2   
  [7] httr_1.4.2            sctransform_0.3.2     tools_4.1.1          
 [10] utf8_1.2.2            R6_2.5.1              irlba_2.3.3          
 [13] rpart_4.1-15          KernSmooth_2.23-20    uwot_0.1.10          
 [16] mgcv_1.8-36           DBI_1.1.1             lazyeval_0.2.2       
 [19] colorspace_2.0-2      withr_2.4.2           tidyselect_1.1.1     
 [22] gridExtra_2.3         bit_4.0.4             compiler_4.1.1       
 [25] cli_3.0.1             hdf5r_1.3.4           plotly_4.9.4.1       
 [28] labeling_0.4.2        scales_1.1.1          lmtest_0.9-38        
 [31] spatstat.data_2.1-0   ggridges_0.5.3        pbapply_1.5-0        
 [34] rappdirs_0.3.3        goftest_1.2-2         stringr_1.4.0        
 [37] digest_0.6.27         spatstat.utils_2.2-0  pkgconfig_2.0.3      
 [40] htmltools_0.5.2       parallelly_1.28.1     fastmap_1.1.0        
 [43] htmlwidgets_1.5.4     rlang_0.4.11          shiny_1.6.0          
 [46] farver_2.1.0          generics_0.1.0        zoo_1.8-9            
 [49] jsonlite_1.7.2        ica_1.0-2             dplyr_1.0.7          
 [52] magrittr_2.0.1        Matrix_1.3-4          Rcpp_1.0.7           
 [55] munsell_0.5.0         fansi_0.5.0           abind_1.4-5          
 [58] reticulate_1.22       lifecycle_1.0.0       stringi_1.7.4        
 [61] MASS_7.3-54           Rtsne_0.15            plyr_1.8.6           
 [64] grid_4.1.1            parallel_4.1.1        listenv_0.8.0        
 [67] promises_1.2.0.1      ggrepel_0.9.1         crayon_1.4.1         
 [70] miniUI_0.1.1.1        deldir_0.2-10         lattice_0.20-44      
 [73] cowplot_1.1.1         splines_4.1.1         tensor_1.5           
 [76] pillar_1.6.2          igraph_1.2.6          spatstat.geom_2.2-2  
 [79] future.apply_1.8.1    reshape2_1.4.4        codetools_0.2-18     
 [82] leiden_0.3.9          glue_1.4.2            data.table_1.14.0    
 [85] png_0.1-7             vctrs_0.3.8           httpuv_1.6.3         
 [88] gtable_0.3.0          RANN_2.6.1            purrr_0.3.4          
 [91] spatstat.core_2.3-0   polyclip_1.10-0       tidyr_1.1.3          
 [94] scattermore_0.7       future_1.22.1         assertthat_0.2.1     
 [97] mime_0.11             xtable_1.8-4          later_1.3.0          
[100] survival_3.2-13       viridisLite_0.4.0     tibble_3.1.4         
[103] cluster_2.1.2         globals_0.14.0        fitdistrplus_1.1-5   
[106] ellipsis_0.3.2        ROCR_1.0-11          

Activity

ndaniel

ndaniel commented on Sep 24, 2021

@ndaniel
Author

@yuhanH

I am not sure what you mean by

Could you show the scripts of generating the reference UMAP?

The script for reproducing the warning is in my original post, where

...
reference <- LoadH5Seurat("../data/pbmc_multimodal.h5seurat")
...

and it is taken fully by copy-and-paste from Seurat example number 1 from Seurat tutorial: https://satijalab.org/seurat/articles/multimodal_reference_mapping.html where everything is explained. There reference is available as https://atlas.fredhutch.org/data/nygc/multimodal/pbmc_multimodal.h5seurat .

What are the other scripts you are referring to?

Do you mean that umap-learn should be installed like this pip install umap-learn ?

yuhanH

yuhanH commented on Sep 24, 2021

@yuhanH
Collaborator

HI, @ndaniel
Sorry for the confusion.... You don't need to install umap-learn and worry about those warnings.
Those warnings should be removed. We will update it soon.

self-assigned this
on Sep 24, 2021
ndaniel

ndaniel commented on Sep 25, 2021

@ndaniel
Author

@yuhanH Thanks!

Good to hear that is nothing to worry about Warning: No assay specified, setting assay as RNA by default.

yuhanH

yuhanH commented on Dec 16, 2021

@yuhanH
Collaborator

This warning is fixed in seurat v4.0.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    MapQuery gives warning about no assay specified · Issue #5104 · satijalab/seurat