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 (Optional[List[str]]) – 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. Defaults to None.

  • effectors (Optional[List[str]]) – 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. Defaults to None.

  • basis (str) – the reduced dimension basis. Defaults to “umap”.

  • jkey (str) – the key to the jacobian dictionary in .uns. Defaults to “jacobian”.

  • j_basis (str) – the reduced dimension space that will be used to calculate the jacobian matrix. Defaults to “pca”.

  • x (int) – the column index of the low dimensional embedding for the x-axis. Defaults to 0.

  • y (int) – the column index of the low dimensional embedding for the y-axis. Defaults to 1.

  • layer (str) – the layer key with jacobian data. Defaults to “M_s”.

  • highlights (Optional[list]) – which color group will be highlighted. if highligts is a list of lists - each list is relate to each color element. Defaults to None.

  • cmap (str) – 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. Defaults to “bwr”.

  • background (Optional[str]) – 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. Defaults to None.

  • pointsize (Optional[float]) – the size of plotted points. Defaults to None.

  • figsize (Tuple[float, float]) – the size of the figure. Defaults to (6, 4).

  • show_legend (bool) – whether to display a legend of the labels. Defaults to True.

  • frontier (bool) – 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. Defaults to True.

  • sym_c (bool) – 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. Defaults to True.

  • sort (Literal['raw', 'abs', 'neg']) – 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. Defaults to “abs”.

  • show_arrowed_spines (bool) – whether to show a pair of arrowed spines representing the basis of the scatter is currently using. Defaults to False.

  • stacked_fraction (bool) – whether the jacobian will be represented as a stacked fraction in the title or a linear fraction style will be used. Defaults to False.

  • save_show_or_return (Literal['save', 'show', 'return']) – whether to save, show, or return the figure. Defaults to “show”.

  • save_kwargs (Dict[str, Any]) – a dictionary that will be passed to the save_show_ret function. By default, it is an empty dictionary and the save_show_ret 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.. Defaults to {}.

  • **kwargs – any other kwargs that would be passed to plt._matplotlib_points.

Return type:

Optional[GridSpec]

Returns:

None would be returned by default. If save_show_or_return is set to be ‘return’, the matplotlib GridSpec of the figure would be returned.

Examples

>>> import dynamo as dyn
>>> adata = dyn.sample_data.hgForebrainGlutamatergic()
>>> dyn.pp.recipe_monocle(adata)
>>> dyn.tl.dynamics(adata)
>>> dyn.tl.cell_velocities(adata, basis='pca')
>>> 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)