dynamo.pl.jacobian

dynamo.pl.jacobian(adata, regulators=None, effectors=None, basis='umap', jkey='jacobian', j_basis='pca', x=0, y=1, layer='M_s', highlights=None, cmap='bwr', background=None, pointsize=None, figsize=(6, 4), show_legend=True, frontier=True, sym_c=True, sort='abs', show_arrowed_spines=False, stacked_fraction=False, save_show_or_return='show', save_kwargs={}, **kwargs)[source]

Scatter plot of Jacobian values across cells.

Parameters
  • adata (AnnData) – an Annodata object with Jacobian matrix estimated.

  • regulators (list or None (default: None)) – The list of genes that will be used as regulators for plotting the Jacobian heatmap, only limited to genes that have already performed Jacobian analysis.

  • effectors (List or None (default: None)) – The list of genes that will be used as targets for plotting the Jacobian heatmap, only limited to genes that have already performed Jacobian analysis.

  • basis (str (default: umap)) – The reduced dimension basis.

  • jkey (str (default: jacobian)) – The key to the jacobian dictionary in .uns.

  • j_basis (str (default: pca)) – The reduced dimension space that will be used to calculate the jacobian matrix.

  • x (int (default: 0)) – The column index of the low dimensional embedding for the x-axis.

  • y (int (default: 1)) – The column index of the low dimensional embedding for the y-axis.

  • highlights (list (default: None)) – Which color group will be highlighted. if highligts is a list of lists - each list is relate to each color element.

  • cmap (string (optional, default 'Blues')) – The name of a matplotlib colormap to use for coloring or shading points. If no labels or values are passed this will be used for shading points according to density (largely only of relevance for very large datasets). If values are passed this will be used for shading according the value. Note that if theme is passed then this value will be overridden by the corresponding option of the theme.

  • background (string or None (optional, default 'None`)) – The color of the background. Usually this will be either ‘white’ or ‘black’, but any color name will work. Ideally one wants to match this appropriately to the colors being used for points etc. This is one of the things that themes handle for you. Note that if theme is passed then this value will be overridden by the corresponding option of the theme.

  • figsize (None or [float, float] (default: (6, 4))) – The width and height of each panel in the figure.

  • show_legend (bool (optional, default True)) – Whether to display a legend of the labels

  • frontier (bool (default: False)) – Whether to add the frontier. Scatter plots can be enhanced by using transparency (alpha) in order to show area of high density and multiple scatter plots can be used to delineate a frontier. See matplotlib tips & tricks cheatsheet (https://github.com/matplotlib/cheatsheets). Originally inspired by figures from scEU-seq paper: https://science.sciencemag.org/content/367/6482/1151.

  • sym_c (bool (default: True)) – Whether do you want to make the limits of continuous color to be symmetric, normally this should be used for plotting velocity, jacobian, curl, divergence or other types of data with both positive or negative values.

  • sort (str (optional, default abs)) – The method to reorder data so that high values points will be on top of background points. Can be one of {‘raw’, ‘abs’, ‘neg’}, i.e. sorted by raw data, sort by absolute values or sort by negative values.

  • show_arrowed_spines (bool (optional, default False)) – Whether to show a pair of arrowed spines representing the basis of the scatter is currently using.

  • stacked_fraction (bool (default: False)) – If True the jacobian will be represented as a stacked fraction in the title, otherwise a linear fraction style is used.

  • save_show_or_return (str {‘save’, ‘show’, ‘return’} (default: show)) – Whether to save, show or return the figure.

  • save_kwargs (dict (default: {})) – A dictionary that will passed to the save_fig function. By default it is an empty dictionary and the save_fig function will use the {“path”: None, “prefix”: ‘scatter’, “dpi”: None, “ext”: ‘pdf’, “transparent”: True, “close”: True, “verbose”: True} as its parameters. Otherwise you can provide a dictionary that properly modify those keys according to your needs.

  • kwargs – Additional arguments passed to plt._matplotlib_points.

Returns

  • Nothing but plots the n_source x n_targets scatter plots of low dimensional embedding of the adata object, each

  • corresponds to one element in the Jacobian matrix for all sampled cells.

Examples

>>> import dynamo as dyn
>>> adata = dyn.sample_data.hgForebrainGlutamatergic()
>>> adata = dyn.pp.recipe_monocle(adata)
>>> dyn.tl.dynamics(adata)
>>> dyn.vf.VectorField(adata, basis='pca')
>>> valid_gene_list = adata[:, adata.var.use_for_transition].var.index[:2]
>>> dyn.vf.jacobian(adata, regulators=valid_gene_list[0], effectors=valid_gene_list[1])
>>> dyn.pl.jacobian(adata)