preprocess_transform | R Documentation |
Applies a previously calculated preprocess transform model to a new count matrix. For more information read the help information for save_transform_models.
preprocess_transform(
cds,
reduction_method = c("PCA", "LSI"),
block_size = NULL,
cores = 1
)
cds |
a cell_data_set to be transformed. |
reduction_method |
a previously loaded transform model that is used to reduce the dimensions of the count matrix in the cell_data_set. The "PCA" and "LSI" transforms are supported. The default is "PCA". |
block_size |
a numeric value for the DelayedArray block size used only in this function. Default is NULL, which does not affect the current block size. |
cores |
the number of cores to use for the matrix multiplication. The default is 1. |
a cell_data_set with a preprocess reduced count matrix.
apply the same filters to the query and reference data set. For example, use the same UMI cutoff value for both data sets. You can check the cutoff value by finding the range of UMI values before applying normalization using range(counts(cds)).
use the same method and round_exprs parameters to calculate the Size_Factor values for both data sets. See the estimate_size_factors() help for additional information.
if the projection fails, try comparing histograms of various values of the reference and query data sets. For example, in order to examine the size factor values use hist(colData(cds)[['Size_Factor']], breaks=100).
## Not run:
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)
ncell <- nrow(colData(cds))
cell_sample <- sample(seq(ncell), 2 * ncell / 3)
cell_set <- seq(ncell) %in% cell_sample
cds1 <- cds[,cell_set]
cds1 <- preprocess_cds(cds1)
save_transform_models(cds1, 'tm')
cds2 <- cds[,!cell_set]
cds2 <- load_transform_models(cds2, 'tm')
cds2 <- preprocess_transform(cds2, 'PCA')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.