cycombinepy.create_som

cycombinepy.create_som(adata, markers=None, xdim=8, ydim=8, n_clusters=None, seed=473, rlen=10, layer=None, label_key='cycombine_som', copy=False)[source]

Train a FlowSOM on the marker columns of adata and store cluster labels.

Cells are mapped to either the raw SOM node (default) or a metacluster if n_clusters is supplied. The resulting 1-indexed integer labels are written to adata.obs[label_key] as a category.

Parameters:
  • adata (AnnData) – AnnData to cluster.

  • markers (Optional[Iterable[str]]) – Var names used for clustering. Defaults to cycombinepy.get_markers().

  • xdim (int) – SOM grid dimensions. Default 8x8 matches cyCombine.

  • ydim (int) – SOM grid dimensions. Default 8x8 matches cyCombine.

  • n_clusters (int | None) – If set, consensus-metacluster the SOM nodes into this many clusters.

  • seed (int) – Random seed passed to FlowSOM.

  • rlen (int) – Number of training passes. (Kept for parity with R; forwarded if the installed FlowSOM version accepts it.)

  • layer (str | None) – Read features from this layer rather than adata.X.

  • label_key (str) – Name of the adata.obs column to write labels into.

  • copy (bool) – If True, return a modified copy rather than mutating in place.

Return type:

AnnData | None