Average nearest neighbor index for point pattern (clustering or dispersion)
Source:R/average_nearest_neighbor_index.R
average_nearest_neighbor_index.Rd
Calculate the the average nearest neighbor (ANN) index of a specified type of cells. The index indicates the clustering effect of a point pattern. The pattern can be clustering, random or dispersion.
Arguments
- sce_object
SingleCellExperiment object in the form of the output of
format_image_to_sce
.- reference_cell
String. Cells of this type are used as reference cells.
- feature_colname
String. Specify the selected column for `reference_cell`.
- p_val
Numeric. The p value threshold to determine the significance of a pattern.
Details
ANN index is a statistical test to test for the presence of clusters of cells, (Clark and Evans, 1954). The ANN index evaluates the spatial aggregation or dispersion effect of objects based on the average distances between pairs of the nearest objects and can be used to test for the clustering of specific cell types (e.g. immune or tumor cells). Next, the z score and p-value of the ANN index is calculated to validate the significance of the pattern.
Examples
average_nearest_neighbor_index(SPIAT::defined_image, "Tumour", "Cell.Type")
#> $pattern
#> [1] "Clustered"
#>
#> $`p-value`
#> [1] 7.11006e-32
#>