Plot arrows showing transitions in the style of RNA velocity plots
plot_arrows.Rdplot_arrows plots arrows on top of UMAP projection to show transitions in the style of conventional RNA velocity analysis. You can indicate whether to use RNA velocity (based_on = 'velocity'), CSR (based_on = 'CSR') or SHM (based_on = 'SHM') information to project the arrows.
Usage
plot_arrows(
anndata_file,
img_path = NULL,
based_on = "velocity",
style = "grid",
title = NULL,
colour.by = "seurat_clusters",
cols = NULL,
components = "1,2",
conda_env = "scicsr"
)Arguments
- anndata_file
input anndata_file. If
based_onis 'velocity', this file needs to be output fromrun_scVelo. Ifbased_onis 'CSR' or 'SHM', the columns 'csr_pot' or 'shm' should be in the .obs slot of the AnnData object.- img_path
Optional, path to write out the arrow plot. If supplied, you can specify file format (PNG/SVG/PDF) by including the file extension. If PNG, an image of 600 dots per inch will be rendered. Default is
NULL, i.e. it will write to a temporary file as a PNG.- based_on
one of 'velocity', 'csr', 'shm'. The type of information to be used to project arrows. Each has requirements on the input
anndata_file(see argumentanndata_fileof this function).- style
one of 'grid' (lay out arrows on a grid of fixed width/height on the UMAP plot) or 'stream' (draw arrows as streams), in the style of the scvelo 'pl.velocity_embedding_grid' or 'pl.velocity_embedding_stream' respectively.
- title
plot title (Default:
NULL, the title of the plot will be identical to 'based_on')- colour.by
column in gene expression metadata to group and colour the cells by (Default: 'seurat_clusters')
- cols
Optional, a vector of characters containing the HEX code of colours to be used. Has to be the same length as the number of levels found in the
colour.byvariable in the gene expression metadata.- components
component of dimensionality reduction to show in the plot. e.g. put \'1,3\' if desired UMAP plot displays the UMAP_1 and UMAP_3 axes.(Default: '1,2')
- conda_env
character, if not
NULLthis named conda environment is used to generate the plot in scVelo. (Default: 'scicsr'). IfNULL, no conda environment will be used, the program assumes the python packagesscanpyandscveloare installed in the local python)
Value
plot of UMAP dimensionality reduction with arrows projected on top depicting inferred transitions. The same plot is saved in the path given by img_path. If PNG, it is rendered at 600 dots-per-inch (dpi).
Details
plot_arrows uses the plotting functionalities in scVelo in python to generate a plot of arrows indicating transitions, given the type of biological information (velocity/CSR/SHM). You can choose between projecting transitions as arrows laid out on a grid (style = 'grid') or as streams of arrows (style = 'stream'). The plot is saved as a SVG/PDF/PNG (depending on file extension given in img_path, see below), and re-rendered in the 'plot' panel in R.