mmcci.an.cell_network_clustering
- mmcci.an.cell_network_clustering(sample: CCIData, assay: str = 'raw', n_clusters: int = 0, method: str = 'KMeans')[source]
Groups ligand-receptor (LR) pairs into clusters based on their interaction network similarity.
This function: 1. Separates LR pairs into those with single vs multiple interactions 2. Calculates dissimilarity scores between all pairs of LR networks 3. Performs clustering using either KMeans or Hierarchical clustering 4. Determines optimal cluster number if not specified 5. Creates new assays in the sample for each cluster
- Parameters:
sample (CCIData) – Sample containing LR interaction networks to cluster
assay (str) – Name of assay containing interaction data to analyze
n_clusters (int) – Number of desired clusters. If 0, determined automatically
method (str) – Clustering method - either “KMeans” or “Hierarchical”
- Returns:
Sample with new assays added for each cluster found
- Return type:
- Raises:
ValueError – If specified assay not found in sample