number_of_cells_within_radius: Number of cells within a radius

View source: R/number_of_cells_within_radius.R

number_of_cells_within_radiusR Documentation

Number of cells within a radius

Description

Calculates the number of cells of a target cell type within a pre-defined radius around cells of a reference cell type.

Usage

number_of_cells_within_radius(
  spe_object,
  reference_celltype,
  target_celltype,
  radius = 20,
  feature_colname
)

Arguments

spe_object

SpatialExperiment object in the form of the output of format_image_to_spe.

reference_celltype

String. Cell type to be used for reference cells.

target_celltype

String. Cell type to be used for target cells.

radius

Numeric. Radius around the reference cells.

feature_colname

String specifying the column with the desired cell type annotations.

Value

A list of dataframes with the number of target cells of each of the reference cells

Examples

n_in_radius <- number_of_cells_within_radius(SPIAT::defined_image,
reference_celltype = "Tumour", target_celltype="Immune1", radius = 50,
feature_colname = "Cell.Type")

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