Skip to contents

Computes pathway or transcription factor activities from a SpatialExperiment using methods provided by the decoupleR package.

Usage

compute_activities(
  spe,
  reference,
  method = "wmean",
  assay = "cpm",
  statistic = NULL,
  ...
)

Arguments

spe

SpatialExperiment containing expression data.

reference

A data frame with source (gene set or regulator), target (gene identifier), and weight or mor (weight or regulatory direction). Custom tables can be supplied directly; built-in references are retrieved with get_decoupleR_reference(). If both weight columns are present, mor is used. The activity scoring methods AUCell, FGSEA, GSVA, and ORA do not use weights. Gene identifiers must match the expression assay row names and organism. At least five matching genes per set are required. Each source-target pair should occur only once. Custom tables with weight and no database-specific metadata use the decoupleR_ column prefix.

method

Activity method (e.g., "wmean", "viper", "gsva"); see decoupleR docs for options.

assay

Assay to use for calculations.

statistic

If multiple statistics are produced, select one to store.

...

Further arguments passed to the selected method.

Value

SpatialExperiment with activity scores added to colData.

Examples

# Illustrative genes only; use a biologically justified reference for analysis.
ref <- data.frame(
  source = rep("my_signature", 5),
  target = c("STAT1", "IRF1", "CXCL9", "CXCL10", "IDO1"),
  weight = rep(1, 5)
)
# Use known regulatory weights instead of 1 when available.
if (FALSE) { # \dontrun{
# spe must contain a normalized expression assay named "cpm".
spe <- compute_activities(spe, reference = ref, method = "ulm", assay = "cpm")
} # }