| plotVelocity {velociraptor} | R Documentation |
For a each gene in a set of genes, show the phase graph (spliced versus unspliced counts and fitted model) and reduced dimension graphs with cell colored by velocity and (spliced) expression.
plotVelocity(
x,
genes,
use.dimred = 1,
assay.splicedM = "Ms",
assay.unsplicedM = "Mu",
which.plots = c("phase", "velocity", "expression"),
genes.per.row = 1,
color_by = "#222222",
color.alpha = 0.4,
colors.velocity = c("#A50026", "#D73027", "#F46D43", "#FDAE61", "#FEE08B", "#FFFFBF",
"#D9EF8B", "#A6D96A", "#66BD63", "#1A9850", "#006837"),
colors.expression = c("#440154", "#482576", "#414487", "#35608D", "#2A788E",
"#21908C", "#22A884", "#43BF71", "#7AD151", "#BBDF27", "#FDE725"),
max.abs.velo = 0.001
)
x |
A SingleCellExperiment object with RNA velocity results
as returned by |
genes |
A character vector with one or several genes for which to plot
phase and velocity graphs. |
use.dimred |
String or integer scalar specifying the reduced dimensions
to retrieve from |
assay.splicedM |
An integer scalar or string specifying the assay of
|
assay.unsplicedM |
An integer scalar or string specifying the assay of
|
which.plots |
A character vector specifying which plots to create for
each gene. Possible values are |
genes.per.row |
An integer scalar with the numbers of genes to visualize
per row of plots. For example, if |
color_by |
A character scalar specifying a column in |
color.alpha |
An integer scalar giving the transparency of colored cells. Possible values are between 0 (fully transparent) and 1.0 (opaque). |
colors.velocity, colors.expression |
Character vectors specifying the
color ranges used for mapping velocities and expression values. The
defaults are |
max.abs.velo |
A numeric scalar greater than zero giving the maximum
absolute velocity to limit the color scale for the |
Please note that plotVelocity will modify parameters of
the current graphics device using layout and par,
in order to create the layout for the generated graph panels.
A patchwork object with the plots selected by which.plot for
the genes in genes, arranged in a grid according to genes.per.row.
Michael Stadler
scvelo, to generate x,
brewer.pal and viridis
for creation of color palettes, packages ggplot2 and patchwork
used to generate and arrange the plots.
library(scuttle)
set.seed(42)
sce1 <- mockSCE(ncells = 100, ngenes = 500)
sce2 <- mockSCE(ncells = 100, ngenes = 500)
datlist <- list(X=counts(sce1), spliced=counts(sce1), unspliced=counts(sce2))
out1 <- scvelo(datlist, mode = "steady_state")
out2 <- scvelo(datlist, mode = "dynamical")
plotVelocity(out1, c("Gene_0031","Gene_0268"))
plotVelocity(out2, c("Gene_0031","Gene_0268"))