Visualize UMAP (Uniform Manifold Approximation and Projection) coordinates
stored in a muscadet
object. The function allows coloring by clusters and
optionally adding cluster labels.
Usage
plotUMAP(
x,
partition = NULL,
clusters = NULL,
colors = NULL,
title = "",
lab.x = "UMAP 1",
lab.y = "UMAP 2",
add_clusters_labels = FALSE,
point.size = 0.5,
legend.point.size = 3,
...
)
Arguments
- x
A
muscadet
object containing clustering data (usingclusterMuscadet()
).- partition
(Optional) Value specifying the clustering partition to plot (
numeric
orcharacter
). It should be either the resolution or the number of cluster (k) used for clustering depending on the clustering method (res_range
ork_range
withclusterMuscadet()
). If bothpartition
andclusters
arguments areNULL
(default), the assigned clusters for CNA calling (x@cnacalling$cluster
) are used if available inx
(seeassignClusters()
).- clusters
(Optional) A custom named vector of cluster assignments (
integer
named vector). Names must corresponds to cell names within the muscadet objectx
. If it contains less cells than the muscadet objectx
, the missing cells are filtered out and not displayed in the heatmap. Ifshow_missing = FALSE
only the provided cells with data in all omics will be displayed. If bothpartition
andclusters
arguments areNULL
(default), the assigned clusters for CNA calling (x@cnacalling$cluster
) are used if available inx
(seeassignClusters()
).- colors
Vector of colors for the cluster annotation (
character
vector). IfNULL
(default), it uses predefined colors.- title
Character string for the title of the plot (
character
string). Default is an empty character string.- lab.x
Label for the x-axis (
character
string). Default is "UMAP 1".- lab.y
Label for the y-axis (
character
string). Default is "UMAP 2".- add_clusters_labels
Logical. If
TRUE
, adds the cluster names as text or boxed labels usingadd_labels()
. Default isFALSE
.- point.size
Numeric. Size of the points in the UMAP plot passed to
ggplot2::geom_point()
. Default is0.5
.- legend.point.size
Numeric. Size of the points in the legend of the UMAP plot. Default is
3
.- ...
Additional arguments passed to
add_labels()
providing an underlying geom for label names (geom_text()
,geom_label()
,geom_text_repel()
, orgeom_label_repel()
).
Examples
if (FALSE) { # \dontrun{
p <- plotUMAP(muscadet_obj,
partition = 0.6,
title = "UMAP copy-number clusters")
print(p)
} # }