commot.tl.cluster_position
- commot.tl.cluster_position(adata, clustering=None, method='geometric_mean', copy=False)
Assign spatial positions to clusters.
- Parameters
adata (
AnnData
) – The data matrix of shapen_obs
×n_var
. Rows correspond to cells or positions and columns to genes.clustering (
Optional
[str
]) – Name of clustering with the labels stored in.obs[clustering]
.method (
str
) – ‘geometric_mean’ geometric mean of the positions. ‘representative_point’ the position in the cluster with minimum total distance to other points.copy (
bool
) – Whether to return a copy of theanndata.AnnData
.
- Returns
adata – Add cluster positions to
.uns['cluster_pos-clustering_name']
for the clustering named ‘clustering_name’. If copy=True, return the AnnData object and return None otherwise.- Return type
anndata.AnnData