cellcharter.gr.connected_components

cellcharter.gr.connected_components#

cellcharter.gr.connected_components(adata, cluster_key=None, min_cells=250, connectivity_key=None, out_key='component', copy=False)#

Compute the connected components of the spatial graph.

Parameters:
  • adata (AnnData) – Annotated data object.

  • cluster_key (Optional[str] (default: None)) – Key in anndata.AnnData.obs where the cluster labels are stored. If None, the connected components are computed on the whole dataset.

  • min_cells (int (default: 250)) – Minimum number of cells for a connected component to be considered.

  • connectivity_key (Optional[str] (default: None)) – Key in anndata.AnnData.obsp where spatial connectivities are stored. Default is: anndata.AnnData.obsp ['spatial_connectivities'].

  • out_key (str (default: 'component')) – Key in anndata.AnnData.obs where the output matrix is stored if copy = False.

  • copy (bool (default: False)) – If True, return the result, otherwise save it to the adata object.

Return type:

None | ndarray

Returns:

If copy = True, returns a numpy.ndarray with the connected components labels.

Otherwise, modifies the adata with the following key: