spatialAnnotationScreening.Rd
Screens the sample for numeric variables that stand
in meaningful, spatial relation to annotated structures/areas, spatial annotations.
For a detailed explanation on how to define the parameters distance
,
resolution
, angle_span
and n_bins_angle
see details section.
spatialAnnotationScreening(
object,
ids,
variables,
core,
distance = "dte",
resolution = recSgsRes(object),
angle_span = c(0, 360),
unit = getDefaultUnit(object),
bcs_exclude = character(0),
sign_var = "fdr",
sign_threshold = 0.05,
force_comp = FALSE,
skip_comp = FALSE,
model_add = NULL,
model_subset = NULL,
model_remove = NULL,
estimate_R2 = TRUE,
control = NULL,
n_random = 10000,
rm_zero_infl = TRUE,
seed = 123,
add_image = TRUE,
verbose = NULL,
...
)
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 IDs of the spatial annotations of interest.
Character vector. The numeric variables to be included in the screening process. Makre sure that the correct matrix is active in the respective assays.
Distance measure
. Specifies
the distance from the border of the spatial annotation to the horizon in
the periphery up to which the screening is conducted. Defaults to a distance
that covers the whole tissue section the spatial annotation is located
on using distToEdge()
. (This distance must not be exceeded.)
Distance measure. The resolution
with which the expression gradient is inferred. Defaults are platform specific.
See more in detail section of recSgsRes()
.
Numeric vector of length 2. Confines the area screened by an angle span relative to the center of its closest spatial annotation.
Character value. Specifies the desired unit in
which distance measures
or area measures are provided.
Run validUnitsOfLength()
or validUnitsOfArea()
for valid
input options.
Character value containing the barcodes of observations to be excluded from the analysis.
Either p_value or fdr. Defaults to fdr.
The significance threshold. Defaults to 0.05.
Named list. Every slot in the list must be either a formula
containing a function that takes a numeric vector as input and returns a numeric
vector with the same length as its input vector. Or a numeric vector with the
same length as the input vector. Test models with showModels()
.
Character value. Used as a regex to subset models.
Use validModelNames()
to obtain all model names that are known to SPATA2
and showModels()
to visualize them.
Character value. Used as a regex to remove models are not supposed to be included.
A list of arguments as taken from stats::loess.control()
.
Default setting is stored in SPATA2::sgs_loess_control
.
Number of random permutations for the significance testing of step 2.
Numeric value. Sets the random seed.
Logical. If TRUE
, informative messages regarding
the computational progress will be printed.
(Warning messages will always be printed.)
Used to absorb deprecated arguments or functions.
An object of class SpatialAnnotationScreening
.
Extensive tutorials for how to use this function can be found on our website https://themilolab.github.io/SPATA2/ .
createGroupAnnotations()
, createImageAnnotations()
,
createNumericAnnotations()
for how to create spatial annotations.
getCoordsDfSA()
for how to obtain spatial relation of data points to
a spatial annotation.
getSasDf()
for how to obtain inferred expression gradients as used in
spatial annotation screening.
plotSasLineplot()
for visualization of inferred expression gradients.
library(SPATA2)
data("example_data")
object <- example_data$object_UKF313T_diet
object <- identifyTissueOutline(object)
ids <- getSpatAnnIds(object, tags = c("necrotic", "compr"), test = "all")
# opt 1 prefiltering by SPARKX is recommended, but not required
object <- runSPARKX(object)
genes <- getSparkxGenes(object, threshold_pval = 0.05)
# opt 2
genes <- getGenes(object)
sas_out <-
spatialAnnotationScreening(
object = object,
ids = ids,
variables = genes,
core = FALSE
)