Calculate the SC3 stability index for a single cluster in a set of clusterings. The index varies from 0 to 1, where 1 suggests that a cluster is more stable across resolutions.
calc_sc3_stability_cluster(clusterings, res, cluster)numeric matrix containing clustering information, each column contains clustering at a separate resolution
resolution of the cluster to calculate stability for
index of the cluster to calculate stability for
SC3 stability index
This index was originally introduced in the SC3 package for clustering
single-cell RNA-seq data. Clusters are awarded increased stability if they
share the same samples as a cluster at another resolution and penalised at
higher resolutions. We use a slightly different notation to describe the
score but the results are the same:
$$ s(c_{k, i}) = \frac{1}{size(L) + 1} \sum_{l \in L} \sum_{j \in N_l} \frac{size(c_{k, i} \cap c_{l, j})}{size(c_{l, j}) * size(N_l) ^ 2} $$
Where:
c_{x, y} is cluster y at resolution x
k is the resolution of the cluster we want to score
i is the index of the cluster we want to score
L is the set of all resolutions except k
l is a resolution in L
N_l is the set of clusters at resolution l that share samples with
c_{k, i}
j is a cluster in N_l
The documentation for the calculate_stability function in the
SC3 package