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