nichepca.clustering.leiden_with_nclusters

nichepca.clustering.leiden_with_nclusters#

nichepca.clustering.leiden_with_nclusters(adata, n_clusters, max_res=2.0, max_iter=20, seed=42, min_res=0.0, min_cells=None, verbose=False, key_added='leiden', **kwargs)#

Perform Leiden clustering with a fixed number of clusters.

Parameters:
  • adata (AnnData) – Anndata object with the graph information.

  • n_clusters (int) – Number of clusters to be identified.

  • max_res (float (default: 2.0)) – Maximum resolution parameter for the Leiden algorithm, by default 2.0.

  • max_iter (int (default: 20)) – Maximum number of iterations, by default 20.

  • seed (int (default: 42)) – Random seed for reproducibility, by default 42.

  • min_res (float (default: 0.0)) – Minimum resolution parameter for the Leiden algorithm, by default 0.0.

  • min_cells (int | None (default: None)) – Minimum number of cells per cluster, by default None.

  • verbose (bool (default: False)) – Whether to print information about the clustering process, by default False.

  • key_added (str, optional) – Key to store the cluster assignments in the adata object, by default “leiden”.

  • **kwargs (dict) – Additional keyword arguments to be passed to sc.tl.leiden.

Returns:

None