A function to measure the heterogeneity of a cell's neighbourhood in terms of entropy, such that homogeneous neighbourhoods have low entropy and heterogeneous neighbourhoods have high entropy.
Arguments
- spe
SpatialExperiment object with logcounts, PCA, and 'putative cell type' groups included.
- regXclust
a list of vectors for each cell's neighbourhood composition indicated by the proportion of 'putative cell type' groups it contains.
- threads
a numeric value for the number of CPU cores to be used for the analysis.
Examples
data(example)
# requires list containing cluster proportions of each region (regXclust),
# generated using the neighbourDetect() function
spe <- clustSIGNAL::entropyMeasure(spe, regXclust)
#> [1] "Region domainness calculated. Time 05:14:54"
spe$entropy |> head()
#> [1] 0.46900 0.21084 0.69984 0.35336 0.81185 0.35336