plot_umap | R Documentation |
This function plots a low-dimensional projection of an omic data matrix using the uniform manifold approximation and projection algorithm.
plot_umap( dat, group = NULL, covar = NULL, dist = "euclidean", p = 2L, top = NULL, filter_method = "pairwise", center = FALSE, dims = c(1L, 2L), n_neighbors = 15L, label = FALSE, pal_group = "npg", pal_covar = "Blues", size = NULL, alpha = NULL, title = "UMAP", legend = "right", hover = FALSE, D3 = FALSE, ... )
dat |
Omic data matrix or matrix-like object with rows corresponding to
probes and columns to samples. It is strongly recommended that data be
filtered and normalized prior to plotting. Raw counts stored in |
group |
Optional character or factor vector of length equal to sample size, or up to two such vectors organized into a list or data frame. Supply legend title(s) by passing a named list or data frame. |
covar |
Optional continuous covariate. If non- |
dist |
Distance measure to be used. Supports all methods available in
|
p |
Power of the Minkowski distance. |
top |
Optional number (if > 1) or proportion (if < 1) of top probes to be used for UMAP. |
filter_method |
String specifying whether to apply a |
center |
Center each probe prior to computing distances? |
dims |
Vector specifying which dimensions to plot. Must be of length
two unless |
n_neighbors |
Number of nearest neighbors for the UMAP algorithm. See
|
label |
Label data points by sample name? Defaults to |
pal_group |
String specifying the color palette to use if |
pal_covar |
String specifying the color palette to use if |
size |
Point size. |
alpha |
Point transparency. |
title |
Optional plot title. |
legend |
Legend position. Must be one of |
hover |
Show sample name by hovering mouse over data point? If |
D3 |
Render plot in three dimensions? |
... |
Additional arguments to be passed to |
UMAP is a novel machine learning method for visualizing high-dimensional datasets. It is designed to preserve local structure and aids in revealing unsupervised clusters. UMAP is constructed from a theoretical framework based on Riemannian geometry and algebraic topology. See McInnes et al., 2018 for details.
The umap
function can operate directly on a distance matrix.
Available distance measures include: "euclidean"
, "maximum"
,
"manhattan"
, "canberra"
, "minkowski"
, "cosine"
,
"pearson"
, "kendall"
, "spearman"
, "bray"
,
"kulczynski"
, "jaccard"
, "gower"
, "altGower"
,
"morisita"
, "horn"
, "mountford"
, "raup"
,
"binomial"
, "chao"
, "cao"
, "mahalanobis"
, "MI"
,
or "KLD"
. Some distance measures are unsuitable for certain types of
data. See dist_mat
for more details on these methods and links
to documentation on each.
The top
argument optionally filters data using either probewise
variance (if filter_method = "common"
) or the leading fold change
method of Smyth et al. (if filter_method = "pairwise"
). See
plot_mds
for more details.
McInnes, L., Healy, J. & Melville, J. (2018). UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction. arXiv preprint: 1802.03426v2.
umap
, plot_pca
, plot_mds
mat <- matrix(rnorm(1000 * 20), nrow = 1000, ncol = 20) plot_umap(mat) library(DESeq2) dds <- makeExampleDESeqDataSet(m = 20) dds <- rlog(dds) plot_umap(dds, group = colData(dds)$condition)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.