spatialAnnotationToGrouping.Rd
Converts one or more spatial annotations to a binary segmentation variable in the feature data.frame.
spatialAnnotationToGrouping(
object,
ids,
grouping_name,
inside = "inside",
outside = "outside",
overwrite = FALSE
)
An object of class SPATA2
or, in case of S4 generics,
objects of classes for which a method has been defined.
Character vector. Specifies the spatial annotation(s) of interest.
data points that fall into the area of these annotations are labeled
with the input for argument inside
.
Character value. The name of the new segmentation variable.
Character value. The group name for the data points that are located inside the area of the spatial annotation(s).
Character value. The group name for the data points that are located outside the area of the spatial annotation(s).
Logical. Set to TRUE to overwrite existing variables with the same name.
The updated input object, containing the added, removed or computed results.
library(SPATA2)
library(patchwork)
data("example_data")
object <- example_data$object_UKF313T_diet
ids <- getSpatAnnIds(object, tags = c("necrotic", "compr"), test = "all")
plotSpatialAnnotations(object, ids = ids)
object <-
spatialAnnotationToGrouping(
object = object,
ids = ids,
grouping_name = "histology",
inside = "necrotic",
outside = "vivid"
)
plotSurface(object, color_by = "histology", clrp_adjust = c("necrotic" = "black", "vivid" = "forest_green"))