pegasus.spectral_leiden¶
- pegasus.spectral_leiden(data, rep='pca', resolution=1.3, rep_kmeans='diffmap', n_clusters=30, n_clusters2=50, n_init=10, n_jobs=- 1, random_state=0, class_label='spectral_leiden_labels')[source]¶
Cluster the data using Spectral Leiden algorithm. [Li20]
- 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 indata.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 indata.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 first level clusters.n_clusters2 (
int
, optional, default:50
) – The number of second level clusters.n_init (
int
, optional, default:10
) – Number of kmeans tries for the first level clustering. Default is set to be the same as scikit-learn Kmeans function.n_jobs (int, optional (default: -1)) – Number of threads to use for the KMeans step. -1 refers to using all physical CPU cores.
random_state (
int
, optional, default:0
) – Random seed for reproducing results.class_label (
str
, optional, default:"spectral_leiden_labels"
) – Key name for storing cluster labels indata.obs
.
- Return type
None
- Returns
None
Update
data.obs
–data.obs[class_label]
: Cluster labels for cells as categorical data.
Examples
>>> pg.spectral_leiden(data)