Relabel cluster labels across parameter runs to maximise their similarity.

connectClusters(se, map_to = NULL, verbose = TRUE)

Arguments

se

A SpatialExperiment, SingleCellExperiment or SummarizedExperiment object with cluster labels in colData(se).

map_to

A string scalar specify a cluster to map to.

verbose

A logical scalar specifying verbosity.

Value

A SpatialExperiment / SingleCellExperiment / SummarizedExperiment object with 'connected' cluster labels in colData(se).

Examples

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 = c(0, 0.2), npcs = 20)
spe <- clusterBanksy(spe, M = 1, lambda = c(0, 0.2), resolution = 1)
spe <- connectClusters(spe)
#> clust_M1_lam0_k50_res1 --> cluster
#> clust_M1_lam0.2_k50_res1 --> clust_M1_lam0_k50_res1