bento.tl.fluxmap

bento.tl.fluxmap(sdata, points_key='transcripts', instance_key='cell_boundaries', n_clusters=range(2, 9), num_iterations=1000, min_count=50, train_size=1, res=1, random_state=11, plot_error=False)

Cluster flux embeddings using self-organizing maps (SOMs) and vectorize clusters as Polygon shapes.

Parameters:
  • sdata (SpatialData) – Spatial formatted SpatialData object.

  • points_key (str) – key for points element that holds transcript coordinates

  • instance_key (str) – Key for cell_boundaries instances

  • n_clusters (int or list) – Number of clusters to use. If list, will pick best number of clusters using the elbow heuristic evaluated on the quantization error.

  • num_iterations (int) – Number of iterations to use for SOM training.

  • train_size (float) – Fraction of cells to use for SOM training. Default 0.2.

  • res (float) – Resolution used for rendering embedding. Default 0.05.

  • random_state (int) – Random state to use for SOM training. Default 11.

  • plot_error (bool) – Whether to plot quantization error. Default True.

Returns:

sdata

.points[“points”]DataFrame

Adds “fluxmap” column denoting cluster membership.

.shapes[“fluxmap#”]GeoSeries

Adds “fluxmap#” columns for each cluster rendered as (Multi)Polygon shapes.

Return type:

SpatialData