Skip to contents

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.

Usage

entropyMeasure(spe, cells, regXclust, threads)

Arguments

spe

SpatialExperiment object with logcounts, PCA, and 'putative cell type' groups included.

cells

a character vector of cell IDs of each cell. Length of vector must be equal to the number of cells in spatialExperiment object (i.e. the number of rows in colData(spe)).

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.

Value

SpatialExperiment object including entropy values for each cell neighbourhood.

Examples

data(example)

# requires list containing cluster proportions of each region (regXclust),
# generated using the neighbourDetect() function
spe <- clustSIGNAL::entropyMeasure(spe, cells = "uniqueID", regXclust, threads = 1)
#> [1] "Region domainness calculated. Time 01:21:06"
head(spe$entropy)
#> [1] 0.46900 0.21084 0.69984 0.35336 0.81185 0.35336