pegasus.louvain

pegasus.louvain(data, rep='pca', resolution=1.3, n_clust=None, random_state=0, class_label='louvain_labels')[source]

Cluster the cells using Louvain algorithm. [Blondel08]

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_' + rep must exist in data.obsm and nearest neighbors must be calculated so that affinity matrix 'W_' + rep exists in data.uns. By default, use PCA coordinates.

  • resolution (int, optional, default: 1.3) – Resolution factor. Higher resolution tends to find more clusters with smaller sizes.

  • 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].

  • random_state (int, optional, default: 0) – Random seed for reproducing results.

  • class_label (str, optional, default: "louvain_labels") – Key name for storing cluster labels in data.obs.

Return type

None

Returns

  • None

  • Update data.obs

    • data.obs[class_label]: Cluster labels of cells as categorical data.

Examples

>>> pg.louvain(data)