sccloud.spectral_leiden

sccloud.spectral_leiden(data, rep='pca', resolution=1.3, rep_kmeans='diffmap', n_clusters=30, n_init=20, n_jobs=-1, random_state=0, temp_folder=None, class_label='spectral_leiden_labels')[source]

Cluster the data using Spectral Leiden algorithm.

Parameters
  • data (anndata.AnnData) – 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. By default, use PCA coordinates.

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

  • rep_kmeans (str, optional, default: "diffmap") – The embedding representation on which the KMeans runs. Keyword must exist in data.obsm. By default, use Diffusion Map coordinates. If diffmap is not calculated, use PCA coordinates instead.

  • n_clusters (int, optional, default: 30) – The number of clusters set for the KMeans.

  • n_init (int, optional, default: 20) – Size of random seeds at initialization.

  • n_jobs (int, optional, default: -1) – Number of threads to use. If -1, use all available threads.

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

  • temp_folder (str, optional, default: None) – Temporary folder name for joblib to use during the computation.

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

Return type

None

Returns

  • None

  • Update data.obs

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

Examples

>>> scc.spectral_leiden(adata)