projectReducedDim | R Documentation |
Projects observations into arbitrary dimensionality reduction space (e.g., t-SNE, UMAP) using a tricube weighted average of the k nearest neighbours.
projectReducedDim(x, ...)
## S4 method for signature 'matrix'
projectReducedDim(x, old.embedding, ...)
## S4 method for signature 'SummarizedExperiment'
projectReducedDim(
x,
old.sce,
dimred.embed = "TSNE",
dimred.knn = "PCA",
dimred.name = dimred.embed,
k = 5
)
x |
A numeric matrix of a dimensionality reduction containing the cells that should be projected into the existing embedding defined in either |
... |
Passed to methods. |
old.embedding |
If |
old.sce |
The object containing the original dimensionality points. If |
dimred.embed |
The name of the target dimensionality reduction that points should be embedded into, if . |
dimred.knn |
The name of the dimensionality reduction to use to identify the K-nearest neighbours from |
dimred.name |
The name of the dimensionality reduction that the projected embedding will be saved as, for the SummarizedExperiment method. |
k |
The number of nearest neighours to use to project points into the embedding. |
When x
is a matrix, a matrix is returned. When x
is a
SummarizedExperiment
(or SingleCellExperiment
), the return value is of
the same class as the input, but the projected dimensionality reduction
is added as a reducedDim
field.
example_sce <- mockSCE()
example_sce <- logNormCounts(example_sce)
example_sce <- runUMAP(example_sce)
example_sce <- runPCA(example_sce)
example_sce_new <- mockSCE()
example_sce_new <- logNormCounts(example_sce_new)
example_sce_new <- runPCA(example_sce_new)
## sce method
projectReducedDim(
example_sce_new,
old.sce = example_sce,
dimred.embed="UMAP",
dimred.knn="PCA"
)
## matrix method
projectReducedDim(
reducedDim(example_sce, "PCA"),
new.points = reducedDim(example_sce_new, "PCA"),
old.embedding = reducedDim(example_sce, "UMAP")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.