Skip to contents

Python function that visualizes the ligands most likely to be driving the observed RNA velocities.

Usage

plot_velocity_ligands_python(
  adata,
  color = None,
  top_n_ligands = 5,
  vector_type = "stream",
  velocity_cluster_key = "velocity_clusters",
  velocity_clusters = None,
  vkey = "velocity",
  basis = "umap",
  velocity_cluster_palette = "Spectral",
  dpi = 300,
  arrow_length = 1,
  linewidth_scale = None,
  density = 0.5,
  size = 15,
  alpha = 0.2,
  arrow_size = 1,
  figsize = None,
  label_fontsize = 10,
  cell_palette = None,
  ve_plot_cutoff = 0,
  plot_output_path = "entrain_plot.png",
  plot_negative_VE = False
)

Arguments

adata

Path to a .h5ad anndata object. Must have had entrain_velocity run on it.

color

scvelo.pl argument: Key for annotations of observations/cells or variables/genes. Use if you want dot color to denote a cell type or other annotation. Default is NULL - all cells are colored a single color denoted by argument cell_palette

top_n_ligands

Number of top ligands to include in each label.

vector_type

Whether to plot a scvelo.pl.velocity_embedding_stream() plot or a scvelo.pl.velocity_embedding_grid() plot. Default stream

velocity_cluster_key

Column name of adata.obs metadata denoting velocity clusters.

velocity_clusters

Values in adata.obs.velocity_cluster_key denoting which velocity clusters and their ligands to visualize. Defaults to NULL, in which it will plot the ligands for all positive variance explained velocity clusters

vkey

Default "velocity", scvelo.pl.velocity_embedding argument.

basis

Default "umap", scvelo.pl.velocity_embedding argument.

velocity_cluster_palette

A matplotlib color palette denoting colorscale of velocity clusters e.g., "Spectral". OR a single color in matplotlib.colors.CSS4_COLORS.keys() e.g. "black"; OR: A vector of hex codes with the same length as the number of velocity clusters being plotted e.g., c("#bfe5a0", "#9e0242", "#d8434e", "#f67b4a", "#5e4fa2").

dpi

Dpi for plotting.

arrow_length

Length of RNA velocity vectors.

linewidth_scale

Width of RNA velocity vector body.

density

Density of RNA velocity vectors.

size

scvelo.pl.velocity_embedding argument: Size of points.

alpha

Opacity of points.

arrow_size

Size of RNA velocity vector arrowhead.

figsize

Figure size. Default is c(10,10)

label_fontsize

Font size of ligand labels

cell_palette

A matplotlib color palette for annotations denoted in argument color.

ve_plot_cutoff

Whether to plot the results with VE above this limit. Default 0.0.

plot_output_path

Filename of plot to save.

plot_negative_VE

Default False. Whether to include velocity clusters with an inconclusive result.

Value

NULL. Saves a plot in working directory with name plot_output_path