monkeybread.plot.cell_contact_heatmap

monkeybread.plot.cell_contact_heatmap(adata, groupby, contacts=None, expected_contacts=None, show=True, ax=None, **kwargs)

Produces a heatmap highlighting cell contact between groups in a pairwise manner.

Uses the results of monkeybread.calc.cell_contact() and optionally monkeybread.stat.cell_contact().

Produces a heatmap where rows correspond to group1 and columns correspond to group2. An entry in the heatmap depicts either the raw contact frequencies or the p-values for those contact frequencies, depending on whether expected_contacts is provided. Annotations of cells are included by default.

Parameters
  • adata (AnnData) – Annotated data matrix.

  • groupby (str) – A column in adata.obs to group cells by.

  • contacts (Optional[Dict[str, Set[str]]] (default: None)) – The actual cell contacts, as calculated by monkeybread.calc.cell_contact().

  • expected_contacts (Optional[DataFrame] (default: None)) – The expected cell contacts, as calculated by monkeybread.stat.cell_contact(). This must have been calculated using split_groups = True.

  • show (Optional[bool] (default: True)) – Whether to show the plot or return the Axes object.

  • ax (Optional[Axes] (default: None)) – An Axes object to add the plots to.

  • kwargs – Keyword arguments that will be passed to seaborn.heatmap.

Return type

Optional[Axes]

Returns

If show = True, returns nothing. Otherwise, returns the Axes object the plot is contained within.