This function will take a query dataset and project it into the coordinates of a provided reference UMAP. This is essentially a wrapper around two steps:

  • FindNeighbors - Find the nearest reference cell neighbors and their distances for each query cell.

  • RunUMAP - Perform umap projection by providing the neighbor set calculated above and the umap model previously computed in the reference.

ProjectUMAP(query, ...)

# S3 method for default
ProjectUMAP(
  query,
  query.dims = NULL,
  reference,
  reference.dims = NULL,
  k.param = 30,
  nn.method = "annoy",
  n.trees = 50,
  annoy.metric = "cosine",
  l2.norm = FALSE,
  cache.index = TRUE,
  index = NULL,
  neighbor.name = "query_ref.nn",
  reduction.model,
  ...
)

# S3 method for DimReduc
ProjectUMAP(
  query,
  query.dims = NULL,
  reference,
  reference.dims = NULL,
  k.param = 30,
  nn.method = "annoy",
  n.trees = 50,
  annoy.metric = "cosine",
  l2.norm = FALSE,
  cache.index = TRUE,
  index = NULL,
  neighbor.name = "query_ref.nn",
  reduction.model,
  ...
)

# S3 method for Seurat
ProjectUMAP(
  query,
  query.reduction,
  query.dims = NULL,
  reference,
  reference.reduction,
  reference.dims = NULL,
  k.param = 30,
  nn.method = "annoy",
  n.trees = 50,
  annoy.metric = "cosine",
  l2.norm = FALSE,
  cache.index = TRUE,
  index = NULL,
  neighbor.name = "query_ref.nn",
  reduction.model,
  reduction.name = "ref.umap",
  reduction.key = "refUMAP_",
  ...
)

Arguments

query

Query dataset

...

Additional parameters to RunUMAP

query.dims

Dimensions (columns) to use from query

reference

Reference dataset

reference.dims

Dimensions (columns) to use from reference

k.param

Defines k for the k-nearest neighbor algorithm

nn.method

Method for nearest neighbor finding. Options include: rann, annoy

n.trees

More trees gives higher precision when using annoy approximate nearest neighbor search

annoy.metric

Distance metric for annoy. Options include: euclidean, cosine, manhattan, and hamming

l2.norm

Take L2Norm of the data

cache.index

Include cached index in returned Neighbor object (only relevant if return.neighbor = TRUE)

index

Precomputed index. Useful if querying new data against existing index to avoid recomputing.

neighbor.name

Name to store neighbor information in the query

reduction.model

DimReduc object that contains the umap model

query.reduction

Name of reduction to use from the query for neighbor finding

reference.reduction

Name of reduction to use from the reference for neighbor finding

reduction.name

Name of projected UMAP to store in the query

reduction.key

Value for the projected UMAP key