Plotting functions

vega.plotting.volcano(adata, group1, group2, sig_lvl=3.0, metric_lvl=3.0, annotate_gmv=None, s=10, fontsize=10, textsize=8, figsize=None, title=False, save=False)[source]

Plot Differential GMV results. Please run the Bayesian differential acitvity method of VEGA before plotting (“model.differential_activity()”)

Parameters
  • adata (AnnData) – scanpy single-cell object

  • group1 (str) – name of reference group

  • group2 (str) – name of out-group

  • sig_lvl (float) – absolute Bayes Factor cutoff (>=0)

  • metric_lvl (float) – mean Absolute Difference cutoff (>=0)

  • annotate_gmv (Union[str, list, None]) – GMV to be displayed. If None, all GMVs passing significance thresholds are displayed

  • s (int) – dot size

  • fontsize (int) – text size for axis

  • textsize (int) – text size for GMV name display

  • title (str) – title for plot

  • save (Union[str, bool]) – path to save figure as pdf

vega.plotting.gmv_embedding(adata, x, y, color=None, palette=None, title=None, save=False, sct_kwds=None)[source]

2-D scatter plot in GMV space.

Parameters
  • adata (AnnData) – scanpy single-cell object. VEGA analysis needs to be run before

  • x (str) – GMV name for x-coordinates (eg. ‘REACTOME_INTERFERON_SIGNALING’)

  • y (str) – GMV name for y-coordinates (eg. ‘REACTOME_INTERFERON_SIGNALING’)

  • color (Optional[str]) – categorical field of Anndata.obs to color single-cells

  • title (Optional[str]) – plot title

  • save (Union[str, bool]) – path to save plot

  • sct_kwds (Optional[dict]) – kwargs for matplotlib.pyplot.scatter function

vega.plotting.gmv_plot(adata, x, y, color=None, title=None, palette=None)[source]

GMV embedding plot, but using the Scanpy plotting API.

Parameters
  • adata (AnnData) – scanpy single-cell dataset

  • x (str) – GMV name for x-coordinates (eg. ‘REACTOME_INTERFERON_SIGNALING’)

  • y (str) – GMV name for x-coordinates (eg. ‘REACTOME_INTERFERON_SIGNALING’)

  • color (Optional[str]) – .obs field to color by

  • title (Optional[str]) – title for the plot

  • palette (Optional[str]) – matplotlib colormap to be used

vega.plotting.loss(model, plot_validation=True)[source]

Plot training loss and validation if plot_validation is True.

Parameters
  • model (VEGA) – VEGA model (trained)

  • plot_validation (bool) – Whether to plot validation loss as well

vega.plotting.rank_gene_weights(model, gmv_list, n_genes=10, color_in_set=True, n_panels_per_row=3, fontsize=8, star_names=[], save=False)[source]

Plot gene members of input GMVs according to their magnitude (abs(w)). Inspired by scanpy.pl.rank_gene_groups() API.

Parameters
  • model (VEGA) – VEGA trained model

  • gmv_list (Union[str, list]) – list of GMV names

  • n_genes (int) – number of top gene to display

  • color_in_set (bool) – Whether to color genes annotated as part of GMVs differently.

  • n_panels_per_row (int) – number of panels max. per row

  • star_names (list) – Name of genes to be highlighted with stars

  • save (Union[bool, str]) – path to save figure

vega.plotting.weight_heatmap(model, cluster=True, cmap='viridis', display_gmvs='all', display_genes='all', title=None, figsize=None, save=False, hm_kwargs=None)[source]

Heatmap plots of weights.

Parameters
  • model (VEGA) – VEGA trained model

  • cluster (bool) – if True, use hierarchical clustering (seaborn.clustermap)

  • cmap (str) – colormap to use

  • display_gmvs (Union[str, list]) – if all, display all latent variables weights. Else (list) only the subset

  • display_genes (Union[str, list]) – if all, display all gene weights of GMV. Else (list) only the subset

  • title (Optional[str]) – figure title

  • figsize (Union[tuple, list, None]) – figure size

  • save (Union[bool, str]) – path to save figure

  • hm_kwargs (Optional[dict]) – kwargs for sns.clustermap or sns.heatmap (depending on if cluster=True)