% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plotVelocity.R
\name{plotVelocity}
\alias{plotVelocity}
\title{Phase and velocity graphs for a set of genes}
\usage{
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",
max.abs.velo = 0.001
)
}
\arguments{
\item{x}{A \linkS4class{SingleCellExperiment} object with RNA velocity results
as returned by \code{\link{scvelo}}, and low-dimensional coordinates, e.g.,

\item{genes}{A character vector with one or several genes for which to plot
phase and velocity graphs. \code{genes} have to be in \code{rownames(x)}.}

\item{use.dimred}{String or integer scalar specifying the reduced dimensions
to retrieve from \code{x}.}

\item{assay.splicedM}{An integer scalar or string specifying the assay of
\code{x} containing the moments of spliced abundances.}

\item{assay.unsplicedM}{An integer scalar or string specifying the assay of
\code{x} containing the moments unspliced abundances.}

\item{which.plots}{A character vector specifying which plots to create for
each gene. Possible values are \code{"phase", "velocity", "expression"} and
correspond to the phase graph or reduced dimension graphs with cells
colored by velocity or (spliced) expression.}

\item{genes.per.row}{An integer scalar with the numbers of genes to visualize
per row of plots. For example, if \code{which.plots =  c("phase","expression")}
and \code{genes.per.row = 2}, the resulting figure will have four plot
panels per row.}

\item{color_by}{A character scalar specifying a column in \code{colData(x)}
to color cells in the phase graph. Alternatively, \code{color_by} can be
set to vector of valid R colors, either of length one (recycled for all
cells) or of length \code{ncol(x)}, which will then be used to color cells
in the phase graph.}

\item{color.alpha}{An integer scalar giving the transparency of colored
cells. Possible values are between 0 (fully transparent) and 1.0 (opaque).}

\item{colors.velocity, colors.expression}{Character vectors specifying the
color ranges used for mapping velocities and expression values. The
defaults are \code{RColorBrewer::brewer.pal(11, "RdYlGn")} for the
velocities and \code{viridisLite::viridis(11)} for the expression values.}

\item{max.abs.velo}{A numeric scalar greater than zero giving the maximum
absolute velocity to limit the color scale for the \code{"velocity"} graph.}
}
\value{
A patchwork object with the plots selected by \code{which.plot} for
the genes in \code{genes}, arranged in a grid according to \code{genes.per.row}.
}
\description{
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.
}
\details{
Please note that \code{plotVelocity} will modify parameters of
in order to create the layout for the generated graph panels.
}
\examples{
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"))

}
\seealso{
{"ft_lang_label":"__label__en","ft_lang_prob":0.6509328,"math_prob":0.96646434,"size":4103,"snap":"2023-14-2023-23","text_gpt3_token_len":1142,"char_repetition_ratio":0.14125396,"word_repetition_ratio":0.05108055,"special_character_ratio":0.2922252,"punctuation_ratio":0.17073171,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98698205,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-03-28T23:55:00Z\",\"WARC-Record-ID\":\"<urn:uuid:b939b995-980d-45a1-bfdf-016610809d19>\",\"Content-Length\":\"13535\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:3cdd0722-7e13-4359-92e5-5e2071b7fe57>\",\"WARC-Concurrent-To\":\"<urn:uuid:cbd1d600-5063-470d-ad4e-b63a97ceaf7a>\",\"WARC-IP-Address\":\"194.94.45.80\",\"WARC-Target-URI\":\"https://code.bioconductor.org/browse/velociraptor/blob/master/man/plotVelocity.Rd\",\"WARC-Payload-Digest\":\"sha1:5UGDK5CWY2V4UDVP65AQDFZ5VHMKITXN\",\"WARC-Block-Digest\":\"sha1:FPGPTFDEHI7UISUDV2SOMKIMOTQWA5WJ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-14/CC-MAIN-2023-14_segments_1679296948900.50_warc_CC-MAIN-20230328232645-20230329022645-00109.warc.gz\"}"}