projectReducedDim: Project cells into an arbitrary dimensionality reduction...

projectReducedDimR Documentation

Project cells into an arbitrary dimensionality reduction space.

Description

Projects observations into arbitrary dimensionality reduction space (e.g., t-SNE, UMAP) using a tricube weighted average of the k nearest neighbours.

Usage

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
)

Arguments

x

A numeric matrix of a dimensionality reduction containing the cells that should be projected into the existing embedding defined in either old.embedding or old.sce. Alternatively, a SummarizedExperiment or SingleCellExperiment containing such a matrix.

...

Passed to methods.

old.embedding

If x is a matrix and old is given, then old.embedding is the existing dimensionality reduction embedding that x should be projected into.

old.sce

The object containing the original dimensionality points. If x is a matrix, then old.points must be supplied as a matrix of

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 x in the dimensionality reduction slot of the same name defined in either old or old.sce.

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.

Value

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.

Examples

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")
)

LTLA/scater documentation built on July 21, 2024, 5:43 p.m.