View source: R/identify_bordering_cells.R
identify_bordering_cells | R Documentation |
Identify the cells bordering a group of cells of a particular phenotype, and calculate the number of clustered groups of this cell type.
identify_bordering_cells(
spe_object,
reference_cell,
feature_colname = "Cell.Type",
ahull_alpha = NULL,
n_to_exclude = 10,
plot_final_border = TRUE
)
spe_object |
SpatialExperiment object in the form of the output of
|
reference_cell |
String. Cells of this cell type will be used for border detection. |
feature_colname |
String that specifies the column of 'reference_cell'. |
ahull_alpha |
Number specifying the parameter for the alpha hull algorithm. The larger the number, the more cells will be included in one cell cluster. |
n_to_exclude |
Integer. Clusters with cell count under this number will be deleted. |
plot_final_border |
Boolean if plot the identified bordering cells. |
The bordering cell detection algorithm is based on computing an alpha hull (Hemmer et al., 2020), a generalization of convex hull (Green and Silverman, 1979). The cells detected to be on the alpha hull are identified as the bordering cells.
A new SPE object is returned. The SPE object has a 'Region' column with "Border", "Inside" and "Outside" categories. The returned object also has an attribute saving the number of clusters.
spe_border <- identify_bordering_cells(SPIAT::defined_image,
reference_cell = "Tumour", feature_colname = "Cell.Type", n_to_exclude = 10)
n_clusters <- attr(spe_border, "n_of_clusters") # get the number of clusters
n_clusters
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.