snapatac2.tl.aggregate_cells#

snapatac2.tl.aggregate_cells(adata, use_rep='X_spectral', target_num_cells=None, min_cluster_size=50, random_state=0, key_added='pseudo_cell', inplace=True)[source]#

Aggregate cells into pseudo-cells.

Aggregate cells into pseudo-cells by iterative clustering.

Parameters:
  • adata (AnnData | AnnDataSet | ndarray) – AnnData or AnnDataSet object or matrix.

  • use_rep (str) – adata.obs key for retrieving the input matrix.

  • target_num_cells (int | None) – If None, target_num_cells = num_cells / min_cluster_size.

  • min_cluster_size (int) – The minimum size of clusters.

  • random_state (int) – Change the initialization of the optimization.

  • key_added (str) – adata.obs key under which to add the cluster labels.

  • inplace (bool) – Whether to store the result in the anndata object.

Returns:

If inplace=False, return the result as a numpy array. Otherwise, store the result in adata.obs[`key_added]`.

Return type:

np.ndarray | None