dynamo.pl.sensitivity_heatmap

dynamo.pl.sensitivity_heatmap(adata, cell_idx, skey='sensitivity', basis='pca', 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 (Union[List[int], int]) – the numeric indices of the cells that you want to draw the sensitivity matrix to reveal the regulatory activity.

  • skey (str) – the key to the sensitivity dictionary in .uns. Defaults to “sensitivity”.

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

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

  • figsize (Tuple[float, float]) – the size of the subplots. Defaults to (7, 5).

  • ncols (int) – the number of columns for drawing the heatmaps. Defaults to 1.

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

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

Raises:

ValueError – sensitivity data is not found in adata.

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.reduceDimension(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.sensitivity(adata, regulators=valid_gene_list[0], effectors=valid_gene_list[1])
>>> dyn.pl.sensitivity_heatmap(adata)