Uniform Manifold Approximation and Projection(UMAP) algorithm for dimension reduction.

getUMAP(
  inSCE,
  useAssay = "counts",
  useAltExp = NULL,
  sample = NULL,
  reducedDimName = "UMAP",
  logNorm = TRUE,
  nNeighbors = 30,
  nIterations = 200,
  alpha = 1,
  minDist = 0.01,
  spread = 1,
  pca = TRUE,
  initialDims = 50
)

Arguments

inSCE

Input SingleCellExperiment object.

useAssay

Assay to use for UMAP computation. If useAltExp is specified, useAssay has to exist in assays(altExp(inSCE, useAltExp)). Default "counts".

useAltExp

The subset to use for UMAP computation, usually for the selected.variable features. Default NULL.

sample

Character vector. Indicates which sample each cell belongs to. If given a single character, will take the annotation from colData. Default NULL.

reducedDimName

A name to store the results of the dimension reduction coordinates obtained from this method. Default "UMAP".

logNorm

Whether the counts will need to be log-normalized prior to generating the UMAP via logNormCounts. Default TRUE.

nNeighbors

The size of local neighborhood used for manifold approximation. Larger values result in more global views of the manifold, while smaller values result in more local data being preserved. Default 30. See `?uwot::umap` for more information.

nIterations

The number of iterations performed during layout optimization. Default is 200.

alpha

The initial value of "learning rate" of layout optimization. Default is 1.

minDist

The effective minimum distance between embedded points. Smaller values will result in a more clustered/clumped embedding where nearby points on the manifold are drawn closer together, while larger values will result on a more even dispersal of points. Default 0.01. See `?uwot::umap` for more information.

spread

The effective scale of embedded points. In combination with minDist, this determines how clustered/clumped the embedded points are. Default 1. See `?uwot::umap` for more information.

pca

Logical. Whether to perform dimension reduction with PCA before UMAP. Default TRUE

initialDims

Number of dimensions from PCA to use as input in UMAP. Default 50.

Value

A SingleCellExperiment object with UMAP computation updated in reducedDim(inSCE, reducedDimName).

Examples

data(scExample, package = "singleCellTK") sce <- subsetSCECols(sce, colData = "type != 'EmptyDroplet'") umap_res <- getUMAP(inSCE = sce, useAssay = "counts", reducedDimName = "UMAP", logNorm = TRUE, nNeighbors = 30, alpha = 1, nIterations = 200, spread = 1, pca = TRUE, initialDims = 50)
#> 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'
#> Found more than one class "dist" in cache; using the first, from namespace 'BiocGenerics'
#> Also defined by 'spam'
reducedDims(umap_res)
#> List of length 1 #> names(1): UMAP