View source: R/geometry_operation.R
annotOp | R Documentation |
Just like annotPred
, but performs the operation rather than
predicate. For example, this function would return the geometry of the
intersections between each Visium spot and the tissue boundary for each
sample, rather than whether each Visium spot intersects the tissue boundary.
In case one cell/spot gets broken up into multiple geometries, the union of
those geometries will be taken, so each cell/spot will only get one geometry.
annotOp(
sfe,
colGeometryName = 1L,
annotGeometryName = 1L,
sample_id = "all",
op = st_intersection
)
sfe |
An SFE object. |
colGeometryName |
Name of column geometry for the predicate. |
annotGeometryName |
Name of annotation geometry for the predicate. |
sample_id |
Which sample(s) to operate on. Can be "all" to indicate all samples. |
op |
A binary operation function for the geometries. Defaults to
|
A sf
data frame with geometry
column containing the
geometries and corresponding column names of sfe as row names. There is no
guarantee that the returned geometries are valid or preserve the geometry
class (e.g. when the intersection of polygons result into a line of a point).
annotPred
library(SFEData)
sfe <- McKellarMuscleData("small")
# Get the intersection of myofibers with each Visium spot
myofibers_on_spots <- annotOp(sfe, "spotPoly",
annotGeometryName = "myofiber_simplified"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.