drcme.ephys_morph_clustering.consensus_clusters¶
- drcme.ephys_morph_clustering.consensus_clusters(results, min_clust_size=3)[source]¶
Determine consensus clusters from multiple variations
The method iteratively divides the co-clustering matrix by Ward hierarchical clustering, using the co-clustering fractions as the distance measure. The iterative division stops when a resultant cluster would be smaller than min_clust_size. Next, co-clustering rates between clusters are evaluated, and clusters are merged if the higher of the two within-cluster rates fails to exceed the between-cluster rate by 25%. Sample assignments are then refined by reassignment to the best-matched cluster (repeated until convergence). This procedure is based on the one described by Tasic et al. (2018).
- Parameters
results (array) – Results of multiple clustering variants. Each column contains labels from a different variant.
min_clust_size (int, optional) – Minimum size of consensus cluster
- Returns
clust_labels (array) – Consensus cluster labels
shared_norm (array) – Sample by sample matrix of the fraction of times samples were placed in the same cluster
cc_rates (array) – Cluster by cluster matrix of the average co-clustering rates between cells in a pair of consensus clusters