_Assay.cluster

Contents

_Assay.cluster#

missionbio.mosaic.assay._Assay.cluster

_Assay.cluster(attribute: Union[str, ndarray, DataFrame], method: str = 'dbscan', **kwargs: Any)#

Identify clusters of cells.

Modifies the label row attribute of the assay.

Parameters:
attributestr / np.ndarray

The attribute to use as coordinates for clustering. Uses get_attribute() to retrieve the values constrained by row.

methodstr

dbscan, hdbscan, kmeans, or graph-community (Louvain on a shared nearest neighbor graph).

kwargsdictionary

Passed to the appropriate clustering method. kmeans and graph-community accept a random_state parameter to produce reproducible results.

Available parameters for the methods are:
  1. dbscaneps (float)

    A measure of how close the points are.

  2. hdbscanmin_cluster_size (int)

    The number of cells in a cluster.

  3. kmeansn_clusters (int)

    The number of clusters to be generated.

  4. graph-communityk (int)

    The number of nearest neighbors to consider in the shared nearest neighbor graph generation.

Raises:
ValueError

When the row attribute is not available in the assay.

Exception

When an unsupported clustering method is provided.


< Class _Assay