View source: R/reduce_dimensions.R
reduce_dimension | R Documentation |
Monocle3 aims to learn how cells transition through a
biological program of gene expression changes in an experiment. Each cell
can be viewed as a point in a high-dimensional space, where each dimension
describes the expression of a different gene. Identifying the program of
gene expression changes is equivalent to learning a trajectory that
the cells follow through this space. However, the more dimensions there are
in the analysis, the harder the trajectory is to learn. Fortunately, many
genes typically co-vary with one another, and so the dimensionality of the
data can be reduced with a wide variety of different algorithms. Monocle3
provides two different algorithms for dimensionality reduction via
reduce_dimension
(UMAP and tSNE). The function
reduce_dimension
is the second step in the trajectory building
process after preprocess_cds
.
UMAP is implemented from the package uwot.
reduce_dimension(
cds,
max_components = 2,
reduction_method = c("UMAP", "tSNE", "PCA", "LSI", "Aligned"),
preprocess_method = NULL,
umap.metric = "cosine",
umap.min_dist = 0.1,
umap.n_neighbors = 15L,
umap.fast_sgd = FALSE,
umap.nn_method = "annoy",
verbose = FALSE,
cores = 1,
build_nn_index = FALSE,
nn_control = list(),
...
)
cds |
the cell_data_set upon which to perform this operation. |
max_components |
the dimensionality of the reduced space. Default is 2. |
reduction_method |
A character string specifying the algorithm to use for dimensionality reduction. Currently "UMAP", "tSNE", "PCA", "LSI", and "Aligned" are supported. |
preprocess_method |
A string indicating the preprocessing method used on the data. Options are "PCA" and "LSI". Default is "LSI". |
umap.metric |
A string indicating the distance metric to be used when
calculating UMAP. Default is "cosine". See uwot package's
|
umap.min_dist |
Numeric indicating the minimum distance to be passed to
UMAP function. Default is 0.1.See uwot package's |
umap.n_neighbors |
Integer indicating the number of neighbors to use
during kNN graph construction. Default is 15L. See uwot package's
|
umap.fast_sgd |
Logical indicating whether to use fast SGD. Default is
TRUE. See uwot package's |
umap.nn_method |
String indicating the nearest neighbor method to be
used by UMAP. Default is "annoy". See uwot package's
|
verbose |
Logical, whether to emit verbose output. |
cores |
Number of cores to use for computing the UMAP. |
build_nn_index |
logical When this argument is set to TRUE, preprocess_cds builds the nearest neighbor index from the reduced dimension matrix for later use. Default is FALSE. |
nn_control |
An optional list of parameters used to make the nearest neighbor index. See the set_nn_control help for detailed information. The default metric is cosine for reduction_methods PCA, LSI, and Aligned, and is euclidean for reduction_methods tSNE and UMAP. Note: distances in tSNE space reflect spatial differences poorly so using nearest neighbors with it may be meaningless. |
... |
additional arguments to pass to the dimensionality reduction function. |
an updated cell_data_set object
UMAP: McInnes, L, Healy, J, UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction, ArXiv e-prints 1802.03426, 2018
tSNE: Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-SNE. J. Mach. Learn. Res., 9(Nov):2579– 2605, 2008.
cell_metadata <- readRDS(system.file('extdata',
'worm_embryo/worm_embryo_coldata.rds',
package='monocle3'))
gene_metadata <- readRDS(system.file('extdata',
'worm_embryo/worm_embryo_rowdata.rds',
package='monocle3'))
expression_matrix <- readRDS(system.file('extdata',
'worm_embryo/worm_embryo_expression_matrix.rds',
package='monocle3'))
cds <- new_cell_data_set(expression_data=expression_matrix,
cell_metadata=cell_metadata,
gene_metadata=gene_metadata)
cds <- preprocess_cds(cds)
cds <- reduce_dimension(cds)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.