Skip to contents

Run UMAP on the quantile normalized cell factors (result from quantileNorm), or unnormalized cell factors (result from runIntegration)) to generate a 2D embedding for visualization (or general dimensionality reduction). Has option to run on subset of factors. It is generally recommended to use this method for dimensionality reduction with extremely large datasets. The underlying UMAP calculation imports uwot umap.

Usage

runUMAP(
  object,
  useRaw = NULL,
  useDims = NULL,
  nDims = 2,
  distance = c("cosine", "euclidean", "manhattan", "hamming"),
  nNeighbors = 20,
  minDist = 0.1,
  dimredName = "UMAP",
  seed = 42,
  verbose = getOption("ligerVerbose", TRUE),
  k = nDims,
  use.raw = useRaw,
  dims.use = useDims,
  n_neighbors = nNeighbors,
  min_dist = minDist,
  rand.seed = seed
)

Arguments

object

liger object with factorization results.

useRaw

Whether to use un-aligned cell factor loadings (\(H\) matrices). Default NULL search for quantile-normalized loadings first and un-aligned loadings then.

useDims

Index of factors to use for computing UMAP embedding. Default NULL uses all factors.

nDims

Number of dimensions to reduce to. Default 2.

distance

Character. Metric used to measure distance in the input space. Default "cosine", alternative options include: "euclidean", "manhattan" and "hamming".

nNeighbors

Number of neighboring points used in local approximations of manifold structure. Default 10.

minDist

Numeric. Controls how tightly the embedding is allowed compress points together. Default 0.1.

dimredName

Name of the variable in cellMeta slot to store the result matrix. Default "UMAP".

seed

Random seed for reproducibility. Default 42.

verbose

Logical. Whether to show information of the progress. Default getOption("ligerVerbose") or TRUE if users have not set.

k, use.raw, dims.use, n_neighbors, min_dist, rand.seed

Deprecated. See Usage section for replacement.

Value

The object where a "UMAP" variable is updated in the cellMeta slot with the whole 2D embedding matrix.

Details

For nNeighbors, larger values will result in more global structure being preserved at the loss of detailed local structure. In general this parameter should often be in the range 5 to 50, with a choice of 10 to 15 being a sensible default.

For minDist, larger values ensure embedded points are more evenly distributed, while smaller values allow the algorithm to optimize more accurately with regard to local structure. Sensible values are in the range 0.001 to 0.5, with 0.1 being a reasonable default.

See also

Examples

pbmc <- runUMAP(pbmcPlot)
#>  Generating UMAP on quantile normalized cell factor loadings
#> Found more than one class "dist" in cache; using the first, from namespace 'BiocGenerics'
#> Also defined by ‘spam’
#> Found more than one class "dist" in cache; using the first, from namespace 'BiocGenerics'
#> Also defined by ‘spam’
#>  Generating UMAP on quantile normalized cell factor loadings ... done
#> 
#>  DimRed "UMAP" is now set as default.