R/number_of_cells_within_radius.R
number_of_cells_within_radius.Rd
Calculates the number of cells of a target cell type within a pre-defined radius around cells of a reference cell type.
number_of_cells_within_radius(
spe_object,
reference_celltype,
target_celltype,
radius = 20,
feature_colname
)
SpatialExperiment object in the form of the output of
format_image_to_spe
.
String. Cell type to be used for reference cells.
String. Cell type to be used for target cells.
Numeric. Radius around the reference cells.
String specifying the column with the desired cell type annotations.
A list of dataframes with the number of target cells of each of the reference cells
n_in_radius <- number_of_cells_within_radius(SPIAT::defined_image,
reference_celltype = "Tumour", target_celltype="Immune1", radius = 50,
feature_colname = "Cell.Type")