This function allows you to calculate and plot the UMAP or tSNE embedding.

plot_embedding(embedding, type = "UMAP", cell_info = NULL, label = NULL)

Arguments

embedding

The PCA embedding obtained from create_embedding.

type

A string of "tSNE" or "UMAP". Default is "UMAP".

cell_info

Include the cell information in the plot. It should be a matrix or data.frame, and the first column is cell name in the corresponding to the embedding, and the second column is the information. Default is NULL.

label

A string indicating the name of the cell information you want to include. Default is NULL.

Examples

data("hic_df")
data("batch")
data("cell_type")
bandnorm_result = bandnorm(hic_df = hic_df, save = FALSE)
embedding = create_embedding(hic_df = bandnorm_result, do_harmony = TRUE, batch = batch)
#> Warning: no non-missing arguments to max; returning -Inf
#> Warning: no non-missing arguments to max; returning -Inf
#> Warning: NAs introduced by coercion to integer range
#> Error in validObject(r): invalid class "dgTMatrix" object: Negative value in Dim
plot_embedding(embedding, "UMAP", cell_info = cell_type, label = "Cell Type")
#> Error in nrow(embedding): object 'embedding' not found