add embeddings

Add leiden or louvain embeddings to dataset if not already present or for a specific resolution.

Parameters

algorithm: str, default = "Leiden" Clustering algorithm to use.


resolution: float, default = 0.6 Resolution to use in clustering algorithm (a higher resultion finds more clusters).


Web view

add_embeddings_screenshot

Python equivalent

import scanpy as sc

resolution = 0.6
sc.pp.neighbors(adata, n_neighbors=10, n_pcs=40)
# add leiden embeddings
sc.tl.leiden(adata, resolution=resolution, key_added=f"leiden_{resolution}") 
# add louvain embeddings
sc.tl.louvain(adata, resolution=resolution, key_added=f"louvain_{resolution}")