squidpy.gr.interaction_matrix
- squidpy.gr.interaction_matrix(adata, cluster_key, connectivity_key=None, normalized=False, copy=False, weights=False, *, table_key=None)[source]
Compute interaction matrix for clusters.
- Parameters:
adata (
AnnData|SpatialData) – Annotated data object.table_key (
str|None) – Key inspatialdata.SpatialData.tableswhere the table is stored. Required whenadatais aspatialdata.SpatialDataobject and ignored otherwise.cluster_key (
str) – Key inanndata.AnnData.obswhere clustering is stored.connectivity_key (
str|None) – Key inanndata.AnnData.obspwhere spatial connectivities are stored. Default is:anndata.AnnData.obsp['spatial_connectivities'].normalized (
bool) – If True, each row is normalized to sum to 1.copy (
bool) – IfTrue, return the result, otherwise save it to theadataobject.weights (
bool) – Whether to use edge weights or binarize.
- Return type:
- Returns:
If
copy = True, returns the interaction matrix.Otherwise, modifies the
adatawith the following key:anndata.AnnData.uns['{cluster_key}_interactions']- the interaction matrix.