quickPseudotime: Quick MST-based pseudotime

quickPseudotimeR Documentation

Quick MST-based pseudotime

Description

A convenience wrapper to quickly compute a minimum spanning tree (MST) on the cluster centroids to obtain a pseudotime ordering of the cells.

Usage

quickPseudotime(x, ...)

## S4 method for signature 'ANY'
quickPseudotime(x, clusters, others = NULL, ..., start = NULL, columns = NULL)

## S4 method for signature 'SummarizedExperiment'
quickPseudotime(x, ..., assay.type = "logcounts")

## S4 method for signature 'SingleCellExperiment'
quickPseudotime(
  x,
  clusters = colLabels(x, onAbsence = "error"),
  ...,
  others = NULL,
  use.dimred = NULL,
  other.dimreds = TRUE
)

Arguments

x

A numeric matrix of coordinates where each row represents a cell/sample and each column represents a dimension (usually a PC or another low-dimensional embedding, but features or genes can also be used).

Alternatively, a SummarizedExperiment or SingleCellExperiment object containing such a matrix in its assays, as specified by assay.type. This will be transposed prior to use.

Alternatively, for SingleCellExperiments, this matrix may be extracted from its reducedDims, based on the use.dimred specification. In this case, no transposition is performed.

...

For the generic, further arguments to pass to the specific methods.

For the ANY method, further arguments to pass to createClusterMST.

For the SummarizedExperiment method, further arguments to pass to the ANY method.

For the SingleCellExperiment method, further arguments to pass to the SummarizedExperiment method (if use.dimred is specified) or the ANY method (otherwise).

clusters

A vector or factor of length equal to the number of cells in x, specifying the cluster assignment for each cell.

others

List of numeric matrices with the same number of rows as x, to be passed to reportEdges. This typically contains dimensionality reduction results, for use in visualizing the edges of the MST. If NULL, defaults to a list containing x.

start

Passed to orderCells.

columns

A character, logical or integer vector specifying the columns of x to use. If NULL, all provided columns are used by default.

assay.type

An integer or string specifying the assay to use from a SummarizedExperiment x.

use.dimred

An integer or string specifying the reduced dimensions to use from a SingleCellExperiment x.

other.dimreds

Logical scalar indicating whether all dimensionality reduction results in x should be appended onto the others list.

Details

This function simply calls, in order:

  • rowmean, to compute the average low-dimensional coordinates for each cluster.

  • createClusterMST on the average coordinates created from x.

  • reportEdges on the average coordinates for all entries of other.

  • mapCellsToEdges on the per-cell coordinates in x with the constructed MST.

  • orderCells on the mappings generated from x onto the MST.

Value

A List containing:

  • centered, a list of numeric matrices containing the averaged coordinates for each cluster. Each matrix corresponds to a dimensionality reduction result in x.

  • mst, a graph object containing the cluster-level MST computed on the coordinates from use.

  • ordering, a PseudotimeOrdering object containing the ordering for various paths through the MST computed from use.

  • connected, a list of data.frames containing the edge coordinates between centers. Each data.frame corresponds to a dimensionality reduction result in x.

Author(s)

Aaron Lun

See Also

createClusterMST and friends, for the functions that do the actual work.

Examples

# Mocking up an SCE object:
ncells <- 100
u <- matrix(rpois(20000, 5), ncol=ncells)
pca <- matrix(runif(ncells*5), ncells)
tsne <- matrix(rnorm(ncells*2), ncells)

library(SingleCellExperiment)
sce <- SingleCellExperiment(assays=list(counts=u),
    reducedDims=SimpleList(PCA=pca, tSNE=tsne))

# Clustering on our pretend PCA values:
clusters <- kmeans(pca, 3)$cluster

# Quickly computing the pseudotime:
out <- quickPseudotime(sce, clusters, use.dimred="PCA")
out$mst
head(out$ordering)


LTLA/TSCAN documentation built on Feb. 10, 2024, 10:50 p.m.