Skip to contents

Run UMAP on the aligned cell factors (result from alignFactors), or unaligned cell factors (raw 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",
  asDefault = NULL,
  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 aligned factor loadings first and un-aligned loadings then.

useDims

Index of factors to use for computing the 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 20.

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".

asDefault

Logical, whether to set the resulting dimRed as default for visualization. Default NULL will set it when no default is set.

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 aligned cell factor loadings
#>  Generating UMAP on aligned cell factor loadings ... done
#>