annotPred: Binary predicates for geometry of each cell/spot and...

View source: R/geometry_operation.R

annotPredR Documentation

Binary predicates for geometry of each cell/spot and annotation

Description

This function finds binary predicates for the geometry of each cell/spot (i.e. colGeometry) and an annotation geometry for each sample. For example, whether each Visium spot intersects with the tissue boundary in each sample.

Usage

annotPred(
  sfe,
  colGeometryName = 1L,
  annotGeometryName = 1L,
  sample_id = NULL,
  pred = st_intersects
)

annotNPred(
  sfe,
  colGeometryName = 1L,
  annotGeometryName = 1L,
  sample_id = NULL,
  pred = st_intersects
)

Arguments

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.

pred

Predicate function to use, defaults to st_intersects.

Value

For annotPred, a logical vector of the same length as the number of columns in the sample(s) of interest, with barcodes (or corresponding column names of sfe) as names. For annotNPred, a numeric vector of the same length as the number of columns in the sample(s) of interest with barcodes as names, indicating the number of geometries in the annotGeometry of interest returns TRUE for the predicate for each each geometry in the colGeometry of interest.

See Also

annotOp

Examples

library(SFEData)
sfe <- McKellarMuscleData("small")
# Whether each spot is in tissue
in_tissue <- annotPred(sfe, "spotPoly", annotGeometryName = "tissueBoundary")
# How many nuclei are there in each Visium spot
n_nuclei <- annotNPred(sfe, "spotPoly", annotGeometryName = "nuclei")

pachterlab/SpatialFeatureExperiment documentation built on March 11, 2024, 11:11 p.m.