Description Usage Arguments Details Value Author(s) References See Also Examples
Compute a pseudotime for each cell lying on each path through the MST from a given starting node.
1 | orderCells(mapping, mst, start = NULL)
|
mapping |
A DataFrame of MST-mapping information for each cell,
usually obtained by running |
mst |
A graph object containing a MST from |
start |
A character vector specifying the starting node from which to compute pseudotimes in each component of |
The pseudotimes are returned as a matrix where each row corresponds to cell in x
and each column corresponds to a path through the MST from start
to all nodes of degree 1.
(If start
is itself a node of degree 1, then paths are only considered to all other such nodes.)
This format is inspired by that from the slingshot package and provides a compact representation of branching events.
Each branching event in the MST results in a new path and thus a new column in the pseudotime matrix.
An NA
entry for a cell indicates that it is not assigned to that particular path.
All non-NA
entries for any given cell are guaranteed to be identical.
This reflects the fact that multiple paths will share a section of the MST for which the pseudotimes are the same.
The starting node in start
is completely arbitrarily chosen by orderClusterMST
,
as directionality is impossible to infer from the expression matrix alone.
However, it is often possible to use prior biological knowledge to pick an appropriate cluster as the starting node.
A numeric matrix containing the pseudotimes of all cells (rows) across all paths (columns) through mst
.
Aaron Lun
Ji Z and Ji H (2016). TSCAN: Pseudo-time reconstruction and evaluation in single-cell RNA-seq analysis. Nucleic Acids Res. 44, e117
mapCellsToEdges
, to compute mapping
.
quickPseudotime
, a wrapper to quickly perform these calculations.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Mocking up a Y-shaped trajectory.
centers <- rbind(c(0,0), c(0, -1), c(1, 1), c(-1, 1))
rownames(centers) <- seq_len(nrow(centers))
clusters <- sample(nrow(centers), 1000, replace=TRUE)
cells <- centers[clusters,]
cells <- cells + rnorm(length(cells), sd=0.5)
# Creating the MST and mapping the cells.
mst <- createClusterMST(cells, clusters=clusters)
mapping <- mapCellsToEdges(cells, mst, clusters=clusters)
# Obtaining pseudo-time orderings.
ordering <- orderCells(mapping, mst)
unified <- rowMeans(ordering, na.rm=TRUE)
plot(cells[,1], cells[,2], col=topo.colors(21)[cut(unified, 21)], pch=16)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.