episcanpy.api.tl.getNClusters

episcanpy.api.tl.getNClusters(adata, n_cluster, range_min=0, range_max=3, max_steps=20, method='louvain', key_added=None)

Function will test different settings of louvain to obtain the target number of clusters. adapted from the function from the Pinello lab. See: https://github.com/pinellolab/scATAC-benchmarking

It can get cluster for both louvain and leiden. You can specify the obs variable name as key_added.