dynamo.pl.jacobian_heatmap

dynamo.pl.jacobian_heatmap(adata, cell_idx, jkey='jacobian', basis='umap', regulators=None, effectors=None, figsize=(7, 5), ncols=1, cmap='bwr', save_show_or_return='show', save_kwargs={}, **kwargs)[source]

Plot the Jacobian matrix for each cell as a heatmap.

Note that Jacobian matrix can be understood as a regulatory activity matrix between genes directly computed from the reconstructed vector fields.

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

  • cell_idx (int or list) – The numeric indices of the cells that you want to draw the jacobian matrix to reveal the regulatory activity.

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

  • basis (str) – The reduced dimension basis.

  • 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.

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

  • ncols (int (default: 1)) – The number of columns for drawing the heatmaps.

  • cmap (str (default: bwr)) – The mapping from data values to color space. If not provided, the default will depend on whether center is set.

  • 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 sns.heatmap.

Returns

Return type

Nothing but plots the n_cell_idx heatmaps of the corresponding Jacobian matrix for each selected cell.

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_heatmap(adata)