plot_umap: UMAP Plot

Description Usage Arguments Value Examples

View source: R/plot_umap.R

Description

A convenience function for creating a UMAP scatter plot for samples in an ExpressionSet/MSnSet object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
plot_umap(
  eset,
  phenotype = NULL,
  standardize = FALSE,
  pca = TRUE,
  n_perm = 10,
  n_neighbors = round(sqrt(length(sampleNames(eset)))),
  n_epochs = 1000,
  min_dist = 0.01,
  legend_title = NULL,
  legend_title_width = 20,
  point_size = 4,
  show_ellipse = TRUE,
  ellipse_type = "norm",
  show_na = TRUE,
  ...
)

Arguments

eset

eset (or most likely eset subclass) object

phenotype

character; one of the colnames(pData(eset))

standardize

logical; should the rows of the expression data be standardized? (default: FALSE)

pca

logical; whether PCA should be performed prior to UMAP (default: TRUE).

n_perm

integer; if pca is TRUE, this is the number of times that the expression matrix should be permuted (default: 10). This is done to determine the optimal number of principal components to use.

n_neighbors

integer; number of nearest neighbors to use for UMAP (default: √(n samples)).

n_epochs

integer; number of iterations performed during layout optimization.

min_dist

numeric; determines how close points appear in the final layout (default: 0.01).

legend_title

character; the title for the legend. If NULL, is set to the wrapped up phenotype.

legend_title_width

integer; wrapping up too long legend titles. Passed to stringr::str_wrap() as width argument (default: 20).

point_size

numeric; size of the plotted points (default: 4).

show_ellipse

logical; whether to plot 50% confidence ellipses.

ellipse_type

character; the type of ellipse. The default "norm" assumes a multivariate normal distribution, and "t" assumes a multivariate t-distribution.

show_na

logical; should the data points for which phenotype is unknown be shown? (default: TRUE)

...

Other arguments that can be passed to the UMAP configuration. See umap.defaults for more details.

Value

A ggplot object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(srm_msnset)
plot_umap(msnset,
          phenotype = "subject.type",
          show_ellipse = F)
plot_umap(msnset,
          phenotype = "subject.type",
          min_dist = 0.5,
          show_ellipse = T)
plot_umap(msnset,
          phenotype = "subject.type",
          pca = F,
          show_ellipse = T)
plot_umap(msnset)

vladpetyuk/vp.misc documentation built on June 25, 2021, 6:35 a.m.