rapids_singlecell.gr.co_occurrence#
- rapids_singlecell.gr.co_occurrence(adata, cluster_key, *, table_key=None, spatial_key='spatial', interval=50, multi_gpu=None, copy=False)[source]#
Compute co-occurrence probability of clusters.
- Parameters:
- adata
AnnData|SpatialData Annotated data matrix or a SpatialData object containing the selected table.
- table_key
str|None(default:None) Key in
SpatialData.tables; required for SpatialData input. All reads and writes use this table; ignored for AnnData input.- cluster_key
str Key for the cluster labels.
- spatial_key
str(default:'spatial') Key for the spatial coordinates.
- interval
int|ndarray|ndarray(default:50) Distances interval at which co-occurrence is computed. If
int, uniformly spaced interval of the given size will be used.- multi_gpu
bool|list[int] |str|None(default:None) GPU selection: - None: Use all GPUs if available (default) - True: Use all available GPUs - False: Use only the current GPU - list[int]: Use specific GPU IDs (e.g., [0, 2]) - str: Comma-separated GPU IDs (e.g., “0,2”)
- copy
bool(default:False) If
True, return the co-occurrence probability and the distance thresholds intervals.
- adata
- Return type:
- 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.