scFates.tl.cluster

scFates.tl.cluster(adata, layer='fitted', n_neighbors=20, n_pcs=50, metric='cosine', resolution=1, device='cpu', copy=False)

Cluster features. Uses scanpy backend when using cpu, and cuml when using gpu. Dataset is transposed, PCA is calulcated and a nearest neighbor graph is generated from PC space. Leiden algorithm is used for community detection.

Parameters
adata : AnnData

Annotated data matrix.

layer

Layer of feature to calculate clusters, by default fitted features

n_neighbors : int (default: 20)

Number of neighbors.

n_pcs : int (default: 50)

Number of PC to keep for PCA.

metric : str (default: 'cosine')

distance metric to use for clustering.

resolution : float (default: 1)

Resolution parameter for leiden algorithm.

device : str (default: 'cpu')

run the analysis on ‘cpu’ with phenograph, or on ‘gpu’ with grapheno.

copy : bool (default: False)

Return a copy instead of writing to adata.

Returns

adata – if copy=True it returns subsetted or else subset (keeping only significant features) and add fields to adata: .var[‘cluters’]

module assignments for features.

Return type

anndata.AnnData