PomaUMAP: Dimensionality Reduction with UMAP

View source: R/PomaUMAP.R

PomaUMAPR Documentation

Dimensionality Reduction with UMAP

Description

PomaUMAP performs a dimension reduction of the data using the Uniform Manifold Approximation and Projection (UMAP) method. See ?uwot::umap() for more.

Usage

PomaUMAP(
  data,
  n_neighbors = floor(sqrt(nrow(data))),
  n_components = 2,
  metric = "euclidean",
  pca = NULL,
  min_dist = 0.01,
  spread = 1,
  hdbscan_minpts = floor(nrow(data) * 0.05),
  show_clusters = TRUE,
  hide_noise = TRUE,
  labels = FALSE,
  outcome = NULL,
  theme_params = list(legend_title = TRUE, legend_position = "bottom")
)

Arguments

data

A SummarizedExperiment object.

n_neighbors

Numeric. Indicates the size of local neighborhood (sample points) used for manifold approximation.

n_components

Numeric. Indicates the dimension of the space to embed into.

metric

Character. Indicates the distance measure method to find nearest neighbors. Options are "euclidean", "cosine", "manhattan", "hamming" and "correlation". See ?uwot::umap().

pca

If not NULL (default), reduce data to this number of columns using PCA before UMAP.

min_dist

Numeric. Indicates the effective minimum distance between embedded points.

spread

Numeric. Indicates the effective scale of embedded points.

hdbscan_minpts

Numeric. Indicates the minimum size of clusters. See ?dbscan::hdbscan().

show_clusters

Logical. Indicates if clusters computed with HDBSCAN method should be plotted or not.

hide_noise

Logical. Specifies whether to hide Cluster 0 in the plot. In HDBSCAN, Cluster 0 is typically regarded as "noise."

labels

Logical. Indicates if sample names should be plotted or not.

outcome

Character. Has no effect on the analysis. Indicates the name of the colData column to be added to the output table. Default is NULL (no extra column added).

theme_params

List. Indicates theme_poma parameters.

Value

A list with results including plots and tables.

Author(s)

Pol Castellano-Escuder

References

McInnes, L., Healy, J., & Melville, J. (2018). Umap: Uniform manifold approximation and projection for dimension reduction. arXiv preprint arXiv:1802.03426.

Campello, R. J., Moulavi, D., & Sander, J. (2013, April). Density-based clustering based on hierarchical density estimates. In Pacific-Asia conference on knowledge discovery and data mining (pp. 160-172). Springer, Berlin, Heidelberg.

Examples

data <- POMA::st000284 # Example SummarizedExperiment object included in POMA

## Output is a list with objects `umap_embeddings` (tibble) and `umap_plot` (ggplot2 object)
data %>%
  PomaNorm() %>%
  PomaUMAP(metric = "euclidean",
           pca = NULL,
           min_dist = 0.01,
           spread = 1,
           hdbscan_minpts = floor(nrow(data) * 0.05),
           show_clusters = TRUE,
           hide_noise = TRUE,
           labels = FALSE,
           outcome = NULL)

pcastellanoescuder/POMA_package documentation built on Nov. 28, 2024, 1:23 p.m.