spcoral.analysis.cluster

Contents

spcoral.analysis.cluster#

spcoral.analysis.cluster(adata_omics1, adata_omics2, emb_label='emb_spcoral', cluster_method='louvain', cluster_number=10, cluster_key='domain', random_seed=2020, resolution_louvain=0.5, n_neighbors_louvain=30, **kwargs)#

Perform joint clustering on the integrated embeddings of two omics datasets.

Concatenates the latent embeddings from both modalities, runs clustering on the combined space, and assigns the resulting cluster labels back to each individual AnnData object.

Parameters:
  • adata_omics1 (anndata.AnnData) – Integrated AnnData objects containing joint embeddings in obsm[emb_label].

  • adata_omics2 (anndata.AnnData) – Integrated AnnData objects containing joint embeddings in obsm[emb_label].

  • emb_label (str, optional (default: 'emb_spcoral')) – Key in .obsm where the shared latent embedding is stored.

  • cluster_method ({'mclust', 'louvain', 'kmeans'}, optional (default: 'mclust')) – Clustering algorithm to use on the joint embedding space.

  • cluster_number (int, optional) – Number of clusters (required for ‘mclust’ and ‘kmeans’; ignored for ‘louvain’).

  • cluster_key (str, optional (default: 'domain')) – Key under which cluster labels will be stored in .obs.

  • random_seed (int, optional (default: 2020)) – Random seed for reproducibility.

  • resolution_louvain (float, optional (default: 0.5)) – Resolution parameter for Louvain clustering.

  • n_neighbors_louvain (int, optional (default: 30)) – Number of neighbors for KNN graph in Louvain.

  • **kwargs – Additional arguments passed to the selected clustering function.

Returns:

The input AnnData objects with cluster labels added to obs[cluster_key].

Return type:

tuple of (anndata.AnnData, anndata.AnnData)

Raises:

ValueError – If cluster_method is invalid or cluster_number is missing for methods requiring it.