Merge selected clusters based on pairwise correlation scores and size of cluster.
mergeClusters(
gobject,
spat_unit = NULL,
feat_type = NULL,
expression_values = c("normalized", "scaled", "custom"),
cluster_column,
cor = c("pearson", "spearman"),
new_cluster_name = "merged_cluster",
min_cor_score = 0.8,
max_group_size = 20,
force_min_group_size = 10,
max_sim_clusters = 10,
return_gobject = TRUE,
verbose = TRUE
)
giotto object
spatial unit
feature type
expression values to use
name of column to use for clusters
correlation score to calculate distance
new name for merged clusters
min correlation score to merge pairwise clusters
max cluster size that can be merged
size of clusters that will be merged with their most similar neighbor(s)
maximum number of clusters to potentially merge to reach force_min_group_size
return giotto object
be verbose
Giotto object
Merge selected clusters based on pairwise correlation scores and
size of cluster.
To avoid large clusters to merge the max_group_size can be lowered. Small
clusters can be forcibly merged with their most similar pairwise cluster by
adjusting the force_min_group_size parameter. Clusters smaller than this
value will be merged independent on the provided min_cor_score value. The
force_min_group_size might not always be reached if clusters have already
been merged before
A giotto object is returned by default, if FALSE then the merging vector
will be returned.
g <- GiottoData::loadGiottoMini("visium")
#> 1. read Giotto object
#> 2. read Giotto feature information
#> 3. read Giotto spatial information
#> 3.1 read Giotto spatial shape information
#> 3.2 read Giotto spatial centroid information
#> 3.3 read Giotto spatial overlap information
#> 4. read Giotto image information
#> python already initialized in this session
#> active environment : '/usr/bin/python3'
#> python version : 3.10
#> checking default envname 'giotto_env'
#> a system default python environment was found
#> Using python path:
#> "/usr/bin/python3"
mergeClusters(g, cluster_column = "leiden_clus")
#> An object of class giotto
#> >Active spat_unit: cell
#> >Active feat_type: rna
#> dimensions : 634, 624 (features, cells)
#> [SUBCELLULAR INFO]
#> polygons : cell
#> [AGGREGATE INFO]
#> expression -----------------------
#> [cell][rna] raw normalized scaled
#> spatial locations ----------------
#> [cell] raw
#> spatial networks -----------------
#> [cell] Delaunay_network spatial_network
#> spatial enrichments --------------
#> [cell][rna] cluster_metagene DWLS
#> dim reduction --------------------
#> [cell][rna] pca custom_pca umap custom_umap tsne
#> nearest neighbor networks --------
#> [cell][rna] sNN.pca custom_NN
#> attached images ------------------
#> images : alignment image
#>
#>
#> Use objHistory() to see steps and params used