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 inanndata.AnnData.obswhere the cluster labels are stored. IfNone, 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 inanndata.AnnData.obspwhere spatial connectivities are stored. Default is:anndata.AnnData.obsp['spatial_connectivities'].out_key (
str(default:'component')) – Key inanndata.AnnData.obswhere the output matrix is stored ifcopy = False.copy (
bool(default:False)) – IfTrue, return the result, otherwise save it to theadataobject.
- Return type:
- Returns:
If
copy = True, returns anumpy.ndarraywith the connected components labels.- Otherwise, modifies the
adatawith the following key: anndata.AnnData.obs['{{out_key}}']- - the above mentionednumpy.ndarray.
- Otherwise, modifies the