cellcharter.tl.elongation

Contents

cellcharter.tl.elongation#

cellcharter.tl.elongation(adata, cluster_key='component', out_key='elongation', copy=False)#

Compute the elongation of the topological boundaries of sets of cells.

It computes the minimum bounding rectangle of the polygon and divides the length of the minor axis by the length of the major axis.

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

  • cluster_key (str (default: 'component')) – Key in anndata.AnnData.obs where the cluster labels are stored.

  • out_key (str (default: 'elongation')) – Key in anndata.AnnData.obs where the metric values are stored if copy = False.

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

Return type:

None | dict[int, float]

Returns:

If copy = True, returns a dict with the cluster labels as keys and the elongation as values.

Otherwise, modifies the adata with the following key: