calculateUMAP {scater} | R Documentation |
Perform uniform manifold approximation and projection (UMAP) for the cells, based on the data in a SingleCellExperiment object.
calculateUMAP(x, ...) ## S4 method for signature 'ANY' calculateUMAP(x, ncomponents = 2, ntop = 500, subset_row = NULL, feature_set = NULL, scale = FALSE, scale_features = NULL, transposed = FALSE, pca = if (transposed) NULL else 50, n_neighbors = 15, ..., external_neighbors = FALSE, BNPARAM = KmknnParam(), BPPARAM = SerialParam()) ## S4 method for signature 'SummarizedExperiment' calculateUMAP(x, ..., exprs_values = "logcounts") ## S4 method for signature 'SingleCellExperiment' calculateUMAP(x, ..., pca = if (!is.null(dimred)) NULL else 50, exprs_values = "logcounts", dimred = NULL, use_dimred = NULL, n_dimred = NULL) runUMAP(x, ..., altexp = NULL, name = "UMAP")
x |
For For |
... |
For the For |
ncomponents |
Numeric scalar indicating the number of UMAP dimensions to obtain. |
ntop |
Numeric scalar specifying the number of features with the highest variances to use for PCA, see |
subset_row |
Vector specifying the subset of features to use for PCA, see |
feature_set |
Deprecated, same as |
scale |
Logical scalar, should the expression values be standardised? See |
scale_features |
Deprecated, same as |
transposed |
Logical scalar, is |
pca |
Integer scalar specifying how many PCs should be used as input into the UMAP algorithm. By default, no PCA is performed if the input is a dimensionality reduction result. |
n_neighbors |
Integer scalar, number of nearest neighbors to identify when constructing the initial graph. |
external_neighbors |
Logical scalar indicating whether a nearest neighbors search should be computed externally with |
BNPARAM |
A BiocNeighborParam object specifying the neighbor search algorithm to use when |
BPPARAM |
A BiocParallelParam object specifying how the neighbor search should be parallelized when |
exprs_values |
Integer scalar or string indicating which assay of |
dimred |
String or integer scalar specifying the existing dimensionality reduction results to use, see |
use_dimred |
Deprecated, same as |
n_dimred |
Integer scalar or vector specifying the dimensions to use if |
altexp |
String or integer scalar specifying an alternative experiment to use to compute the PCA, see |
name |
String specifying the name to be used to store the result in the |
The function umap
is used internally to compute the UMAP.
Note that the algorithm is not deterministic, so different runs of the function will produce differing results.
Users are advised to test multiple random seeds, and then use set.seed
to set a random seed for replicable results.
If external_neighbors=TRUE
, the nearest neighbor search is conducted using a different algorithm to that in the umap
function.
This can be parallelized or approximate to achieve greater speed for large data sets.
The neighbor search results are then used directly to create the UMAP embedding.
For calculateUMAP
, a matrix is returned containing the UMAP coordinates for each cell (row) and dimension (column).
For runUMAP
, a modified x
is returned that contains the UMAP coordinates in reducedDim(x, name)
.
Aaron Lun
McInnes L, Healy J, Melville J (2018). UMAP: uniform manifold approximation and projection for dimension reduction. arXiv.
umap
, for the underlying calculations.
plotUMAP
, to quickly visualize the results.
?"scater-red-dim-args"
, for a full description of various options.
example_sce <- mockSCE() example_sce <- logNormCounts(example_sce) example_sce <- runUMAP(example_sce, scale_features=NULL) reducedDimNames(example_sce) head(reducedDim(example_sce))