set.seed(1)
This vignette assumes that you have a SingleCellExperiment object at the ready. As an example, we create one from the ginhoux
dataset containing 248 dendritic cell progenitors.
library(SCORPIUS) library(SingleCellExperiment) data(ginhoux) sce <- SingleCellExperiment( assays = list(counts = t(ginhoux$expression)), colData = ginhoux$sample_info ) # short hand notation group_name <- colData(sce)$group_name sce
space <- reduce_dimensionality(t(assay(sce, "counts")), dist = "spearman", ndim = 3)
The new space is a matrix that can be visualised with or without colouring of the different cell types.
draw_trajectory_plot( space, progression_group = group_name, contour = TRUE )
traj <- infer_trajectory(space)
The result is a list containing the final trajectory path
and the inferred timeline for each sample time
.
draw_trajectory_plot( space, progression_group = group_name, path = traj$path, contour = TRUE )
gimp <- gene_importances( t(assay(sce, "counts")), traj$time, num_permutations = 0, num_threads = 8 ) gene_sel <- gimp[1:50,] expr_sel <- t(assay(sce, "counts"))[,gene_sel$gene]
To visualise the expression of the selected genes, use the draw_trajectory_heatmap
function.
draw_trajectory_heatmap(expr_sel, traj$time, group_name)
Finally, these genes can also be grouped into modules as follows:
modules <- extract_modules(scale_quantile(expr_sel), traj$time, verbose = FALSE) draw_trajectory_heatmap(expr_sel, traj$time, group_name, modules)
reducedDims(sce) <- SimpleList(MDS = space) colData(sce)$trajectory_path <- traj$path colData(sce)$trajectory_pseudotime <- traj$time rowData(sce)$trajectory_importance <- gimp[match(rownames(sce), gimp$gene),]$importance sce
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.