rapids_singlecell.gr.co_occurrence

Contents

rapids_singlecell.gr.co_occurrence#

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

Compute co-occurrence probability of clusters.

Parameters:
adata AnnData

Annotated data object.

cluster_key str

Key for the cluster labels.

spatial_key str (default: 'spatial')

Key for the spatial coordinates.

interval int | np.ndarray | cp.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 GPU 0 - 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.

Return type:

tuple[np.ndarray, np.ndarray] | 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.