View source: R/dimensionality_reduction.R
tof_reduce_umap | R Documentation |
This function calculates a UMAP embedding from single-cell data in a 'tof_tibble'.
tof_reduce_umap(
tof_tibble,
umap_cols = where(tof_is_numeric),
num_comp = 2,
neighbors = 5,
min_dist = 0.01,
learn_rate = 1,
epochs = NULL,
verbose = FALSE,
n_threads = 1,
return_recipe = FALSE,
...
)
tof_tibble |
A 'tof_tbl' or 'tibble'. |
umap_cols |
Unquoted column names indicating which columns in 'tof_tibble' to use in computing the UMAP embedding. Defaults to all numeric columns in 'tof_tibble'. Supports tidyselect helpers. |
num_comp |
An integer for the number of UMAP components. |
neighbors |
An integer for the number of nearest neighbors used to construct the target simplicial set. |
min_dist |
The effective minimum distance between embedded points. |
learn_rate |
Positive number of the learning rate for the optimization process. |
epochs |
Number of iterations for the neighbor optimization.
See |
verbose |
A boolean indicating if run details should be logged to the console. Defaults to FALSE. |
n_threads |
Number of threads to use during UMAP calculation. Defaults to 1. |
return_recipe |
A boolean value indicating if instead of the UMAP result, a
prepped |
... |
Optional. Other options to be passed as arguments to |
A tibble with the same number of rows as 'tof_tibble', each representing a single cell. Each of the ‘num_comp' columns represents each cell’s embedding in the calculated UMAP space.
Other dimensionality reduction functions:
tof_reduce_dimensions()
,
tof_reduce_pca()
,
tof_reduce_tsne()
# simulate single-cell data
sim_data <-
dplyr::tibble(
cd45 = rnorm(n = 200),
cd38 = rnorm(n = 200),
cd34 = rnorm(n = 200),
cd19 = rnorm(n = 200)
)
new_data <-
dplyr::tibble(
cd45 = rnorm(n = 50),
cd38 = rnorm(n = 50),
cd34 = rnorm(n = 50),
cd19 = rnorm(n = 50)
)
# calculate umap
tof_reduce_umap(tof_tibble = sim_data)
# calculate umap with only 2 columns
tof_reduce_tsne(tof_tibble = sim_data, umap_cols = c(cd34, cd38))
# return recipe
umap_recipe <- tof_reduce_umap(tof_tibble = sim_data, return_recipe = TRUE)
# apply recipe to new data
recipes::bake(umap_recipe, new_data = new_data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.