average_nearest_neighbor_index: Average nearest neighbor index for point pattern (clustering...

View source: R/average_nearest_neighbor_index.R

average_nearest_neighbor_indexR Documentation

Average nearest neighbor index for point pattern (clustering or dispersion)

Description

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.

Usage

average_nearest_neighbor_index(
  spe_object,
  reference_celltypes,
  feature_colname,
  p_val = 5e-06
)

Arguments

spe_object

SpatialExperiment object in the form of the output of format_image_to_spe.

reference_celltypes

String Vector. Cells with these cell types will be used for ANNI calculation.

feature_colname

String. Specify the selected column for 'reference_celltypes'.

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.

Value

A list with the ANN index, the pattern type and the corresponding p value

Examples

average_nearest_neighbor_index(SPIAT::defined_image, reference_celltypes =
"Tumour", feature_colname = "Cell.Type")

TrigosTeam/SPIAT documentation built on Aug. 22, 2024, 7:50 p.m.