squidpy.gr.co_occurrence

squidpy.gr.co_occurrence(adata, cluster_key, spatial_key='spatial', interval=50, copy=False, *, table_key=None)[source]

Compute co-occurrence probability of clusters.

Parameters:
Return type:

tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[Any]]] | None

Returns:

If copy = True, returns the co-occurrence probability and the distance thresholds intervals.

Otherwise, modifies the adata with the following keys:

  • anndata.AnnData.uns ['{cluster_key}_co_occurrence']['occ'] - the co-occurrence probabilities across interval thresholds.

  • anndata.AnnData.uns ['{cluster_key}_co_occurrence']['interval'] - the distance thresholds computed at interval.