R/cluster.R
compareClusters.Rd
Compare cluster outputs based on various clustering comparison measures.
compareClusters(
se,
func = c("ARI", "AMI", "MARI", "MARIraw", "RI", "NID", "NMI", "NVI"),
digits = 3
)
A SpatialExperiment
,
SingleCellExperiment
or SummarizedExperiment
object with cluster labels in colData(se)
.
A string scalar specifying what clustering comparison measure to
compute. See ?aricode
for more information.
An integer scalar specifying the number of digits to round to.
A matrix of cluster comparison measures.
data(rings)
spe <- computeBanksy(rings, assay_name = "counts", M = 1, k_geom = c(15, 30))
#> Computing neighbors...
#> Spatial mode is kNN_median
#> Parameters: k_geom=15
#> Done
#> Computing neighbors...
#> Spatial mode is kNN_median
#> Parameters: k_geom=30
#> Done
#> Computing harmonic m = 0
#> Using 15 neighbors
#> Done
#> Computing harmonic m = 1
#> Using 30 neighbors
#> Centering
#> Done
spe <- runBanksyPCA(spe, M = 1, lambda = 0.2, npcs = 20)
spe <- clusterBanksy(spe, M = 1, lambda = 0.2, resolution = c(0.1, 1))
spe <- connectClusters(spe)
#> clust_M1_lam0.2_k50_res0.1 --> cluster
#> clust_M1_lam0.2_k50_res1 --> clust_M1_lam0.2_k50_res0.1
compareClusters(spe)
#> cluster clust_M1_lam0.2_k50_res0.1
#> cluster 1 1
#> clust_M1_lam0.2_k50_res0.1 1 1
#> clust_M1_lam0.2_k50_res1 1 1
#> clust_M1_lam0.2_k50_res1
#> cluster 1
#> clust_M1_lam0.2_k50_res0.1 1
#> clust_M1_lam0.2_k50_res1 1