average_percentage_of_cells_within_radius
Source:R/average_percentage_of_cells_within_radius.R
average_percentage_of_cells_within_radius.Rd
Calculates the average percentage of cells of a target cell type within a radius from the cells with a reference cell type. The calculation is done per reference cell, so runtime will depend on the number of reference cells present. Output is a single value (the mean for the image).
Usage
average_percentage_of_cells_within_radius(
sce_object,
reference_celltype,
target_celltype,
radius = 100,
feature_colname
)
Arguments
- sce_object
SingleCellExperiment object in the form of the output of
format_image_to_sce
.- reference_celltype
String specifying the cell type of reference cells.
- target_celltype
String specifying the cell type for target cells
- radius
Integer specifying the radius of search for cells around the reference cells. Radii of ~100 are recommended. If too small, too few cells might be present.
- feature_colname
String specifying the column with the desired cell type annotations.
Examples
average_percentage_of_cells_within_radius(SPIAT::defined_image, "Tumour",
"Immune3", radius = 100, "Cell.Type")
#> [1] 17.45713