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:
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.spatial_key (
str) – Key inanndata.AnnData.obsmwhere spatial coordinates are stored.interval (
int|ndarray[tuple[Any,...],dtype[Any]]) – Distances interval at which co-occurrence is computed. Ifint, uniformly spaced interval of the given size will be used.copy (
bool) – IfTrue, return the result, otherwise save it to theadataobject.
- 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
adatawith 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 atinterval.