Creates data.table with pairwise correlation scores between each cluster.

getClusterSimilarity(
  gobject,
  spat_unit = NULL,
  feat_type = NULL,
  expression_values = c("normalized", "scaled", "custom"),
  cluster_column,
  cor = c("pearson", "spearman")
)

Arguments

gobject

giotto object

spat_unit

spatial unit

feat_type

feature type

expression_values

expression values to use

cluster_column

name of column to use for clusters

cor

correlation score to calculate distance

Value

data.table

Details

Creates data.table with pairwise correlation scores between each cluster and the group size (# of cells) for each cluster. This information can be used together with mergeClusters to combine very similar or small clusters into bigger clusters.

Examples

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"

getClusterSimilarity(g, cluster_column = "leiden_clus")
#> Key: <group2>
#>     group2 group1     value unified_group group1_size group2_size
#>     <char> <char>     <num>        <char>       <int>       <int>
#>  1:      1      1 1.0000000          1--1         162         162
#>  2:      1      2 0.8422383          1--2         122         162
#>  3:      1      3 0.8669756          1--3         108         162
#>  4:      1      4 0.5442705          1--4          93         162
#>  5:      1      5 0.6824345          1--5          84         162
#>  6:      1      6 0.7264226          1--6          45         162
#>  7:      1      7 0.5972392          1--7          10         162
#>  8:      2      2 1.0000000          2--2         122         122
#>  9:      2      3 0.7978084          2--3         108         122
#> 10:      2      4 0.5336978          2--4          93         122
#> 11:      2      5 0.6414036          2--5          84         122
#> 12:      2      6 0.6556486          2--6          45         122
#> 13:      2      7 0.4073051          2--7          10         122
#> 14:      3      3 1.0000000          3--3         108         108
#> 15:      3      4 0.4044085          3--4          93         108
#> 16:      3      5 0.4514877          3--5          84         108
#> 17:      3      6 0.4897613          3--6          45         108
#> 18:      3      7 0.3378678          3--7          10         108
#> 19:      4      4 1.0000000          4--4          93          93
#> 20:      4      5 0.5806246          4--5          84          93
#> 21:      4      6 0.7913727          4--6          45          93
#> 22:      4      7 0.4013357          4--7          10          93
#> 23:      5      5 1.0000000          5--5          84          84
#> 24:      5      6 0.8740586          5--6          45          84
#> 25:      5      7 0.5595658          5--7          10          84
#> 26:      6      6 1.0000000          6--6          45          45
#> 27:      6      7 0.6808065          6--7          10          45
#> 28:      7      7 1.0000000          7--7          10          10
#>     group2 group1     value unified_group group1_size group2_size