R/entropy_gradient_aggregated.R
entropy_gradient_aggregated.Rd
This function first calculates the entropy within circles of each reference cell at each radius. Then at each radius, the entropy of all circles surrounding each cell are aggregated into one number. The function sweeps over the specified radii and calculates the aggregated entropy under each radius.
entropy_gradient_aggregated(
spe_object,
cell_types_of_interest,
feature_colname,
radii
)
SpatialExperiment object in the form of the output of
format_image_to_spe
.
String Vector. The cell types that the entropy is computed on.
String. The column name of the interested cell types.
Numeric Vector. A vector of radii within a circle of a reference cell where the entropy is computed on.
A list of the gradient of entropy and the peak
gradient_pos <- seq(50, 500, 50)
gradient_results <- entropy_gradient_aggregated(SPIAT::defined_image,
cell_types_of_interest = c("Tumour","Immune3"),
feature_colname = "Cell.Type", radii = gradient_pos)
plot(1:10,gradient_results$gradient_df[1, 3:12])