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 optionallymonkeybread.stat.cell_contact()
.Produces a heatmap where rows correspond to
group1
and columns correspond togroup2
. An entry in the heatmap depicts either the raw contact frequencies or the p-values for those contact frequencies, depending on whetherexpected_contacts
is provided. Annotations of cells are included by default.- Parameters
adata (
AnnData
) – Annotated data matrix.groupby (
str
) – A column inadata.obs
to group cells by.contacts (
Optional
[Dict
[str
,Set
[str
]]] (default:None
)) – The actual cell contacts, as calculated bymonkeybread.calc.cell_contact()
.expected_contacts (
Optional
[DataFrame
] (default:None
)) – The expected cell contacts, as calculated bymonkeybread.stat.cell_contact()
. This must have been calculated usingsplit_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
- Returns
If
show = True
, returns nothing. Otherwise, returns the Axes object the plot is contained within.