pegasus.leiden
- pegasus.leiden(data, rep='pca', resolution=1.3, n_clust=None, n_iter=-1, random_state=0, class_label='leiden_labels')[source]
Cluster the data using Leiden algorithm. [Traag19]
- Parameters
data (
pegasusio.MultimodalData) – Annotated data matrix with rows for cells and columns for genes.rep (
str, optional, default:"pca") – The embedding representation used for clustering. Keyword'X_' + repmust exist indata.obsmand nearest neighbors must be calculated so that affinity matrix'W_' + repexists indata.uns. By default, use PCA coordinates.resolution (
int, optional, default:1.3) – Resolution factor. Higher resolution tends to find more clusters.n_clust (
int, optional, default:None) – This option only takes effect if ‘resolution = None’. Try to find an appropriate resolution by binary search such that the total number of clusters matches ‘n_clust’. The range of resolution to search is (0.01, 2.0].n_iter (
int, optional, default:-1) – Number of iterations that Leiden algorithm runs. If-1, run the algorithm until reaching its optimal clustering.random_state (
int, optional, default:0) – Random seed for reproducing results.class_label (
str, optional, default:"leiden_labels") – Key name for storing cluster labels indata.obs.
- Return type
None- Returns
NoneUpdate
data.obs–data.obs[class_label]: Cluster labels of cells as categorical data.
Examples
>>> pg.leiden(data)