Screens the sample for numeric variables that follow specific expression changes along the course of the spatial trajectory.

spatialTrajectoryScreening(
  object,
  id,
  variables,
  resolution = recSgsRes(object),
  width = getTrajectoryLength(object, id),
  unit = getDefaultUnit(object),
  bcs_exclude = character(0),
  sign_var = "fdr",
  sign_threshold = 0.05,
  force_comp = FALSE,
  model_add = NULL,
  model_subset = NULL,
  model_remove = NULL,
  estimate_R2 = TRUE,
  rm_zero_infl = TRUE,
  n_random = 10000,
  seed = 123,
  control = NULL,
  verbose = NULL,
  ...
)

Arguments

object

An object of class SPATA2 or, in case of S4 generics, objects of classes for which a method has been defined.

variables

Character vector. All numeric variables to be included in the screening process.

resolution

Distance measure. The resolution with which the expression gradient is inferred. Defaults are platform specific. See more in detail section of recSgsRes().

width

Distance measure. The width of the trajectory frame. Defaults to the trajectory length.

unit

Character value. Specifies the desired unit in which distance measures or area measures are provided. Run validUnitsOfLength() or validUnitsOfArea() for valid input options.

sign_var

Either p_value or fdr. Defaults to fdr.

sign_threshold

The significance threshold. Defaults to 0.05.

n_random

Number of random permutations for the significance testing of step 2.

seed

Numeric value. Sets the random seed.

control

A list of arguments as taken from stats::loess.control(). Default setting is stored in SPATA2::sgs_loess_control.

verbose

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.

Value

An object of class SpatialTrajectoryScreening. See documentation with ?ImageAnnotationScreening for more information.

Examples


library(SPATA2)

object <- example_data$object_UKF269T_diet

object <- identifyTissueOutline(object)

object <- runSPARKX(object)
genes <- getSparkxGenes(object, threshold_pval = 0.05)

id <- "horizontal_mid"

plotImage(object) +
  ggpLayerSpatialTrajectories(object, ids = id)

plotSpatialTrajectories(object, ids = id)

sts_out <-
  spatialTrajectoryScreening(
    object = object,
    id = id,
    variables = genes
    )