stereo.core.StPipeline.leiden#

StPipeline.leiden(neighbors_res_key='neighbors', res_key='leiden', directed=True, resolution=1, use_weights=True, random_state=0, n_iterations=-1, method='normal')[source]#

Cluster cells into subgroups by Leiden algorithm [Traag18].

Parameters:
  • neighbors_res_key (str) – the key of neighbors to get corresponding result from self.result.

  • res_key (str) – the key for storing result of Leiden clustering.

  • directed (bool) – if True, treat the graph as directed. If False, undirected.

  • resolution (float) – a parameter value controlling the coarseness of the clustering. Higher values lead to more clusters. Set to None if overriding partition_type to one that doesn’t accept a resolution_parameter.

  • use_weights (bool) – if True, edge weights from the graph are used in computation, more emphasis should be placed on stronger edges. # noqa

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

  • n_iterations (int) – how many iterations of the Leiden clustering algorithm to perform. Positive values above 2 define the total number of iterations to perform, -1 has the algorithm run until it reaches its optimal clustering.

  • method – Use the original ‘normal’ implementation, or ‘rapids’ (experimental, GPU only)

Returns:

Clustering result of Leiden is stored in self.result where the key is 'leiden'.