ear: Enrichment analysis on a rich, functionally biased...

View source: R/ear.R

earR Documentation

Enrichment analysis on a rich, functionally biased gene/protein universe

Description

EAR compares the enrichment score for each observed altered gene set (AGS) with scores from n_perm equally sized random sets sampled without replacement from the same eligible gene universe. The finite-sample corrected empirical probability is (1 + n_exceed) / (n_perm + 1), where n_exceed is the number of random scores greater than or equal to the observed score.

Usage

ear(
  universe,
  n_perm = 100L,
  ags,
  fgs,
  net = NULL,
  method = c("nea", "ora"),
  renderer_args = list(),
  seed = NULL,
  case_sensitive = FALSE,
  na_replace = 0,
  n_cores = 1L,
  verbose = TRUE,
  network_nodes_only = FALSE
)

Arguments

universe

Character vector of genes on which the observed sets are based and that are eligible for random controls.

n_perm

Positive integer number of controls per AGS.

ags

Named list of altered gene sets.

fgs

Named list of functional gene sets.

net

Network used for NEA. It is required when method = "nea".

method

Renderer used for calibration: "nea" or "ora".

renderer_args

Named list of additional arguments forwarded to the selected renderer. EAR-managed inputs and options cannot be overridden.

seed

Optional integer seed for reproducible control sampling.

case_sensitive

Use case-sensitive identifier matching.

na_replace

Value used for zero observed NEA link counts.

n_cores

Positive integer passed to the selected renderer. ORA distributes functional-set rows. NEA accepts the value for consistency, although EAR does not request member matrices and its sparse calculations remain single-process matrix operations.

verbose

Report progress with message().

network_nodes_only

For NEA, whether to restrict the random-control universe to genes present as network nodes. The default, FALSE, retains every gene in the submitted universe; genes absent from the network can occur in AGSs and controls but contribute no network edges. When TRUE, the universe is intersected with the network nodes and every AGS member must occur in that restricted universe.

Details

Calibration uses the upper tail: an empirical p-value counts random scores greater than or equal to the observed score. Q-values are adjusted separately within each AGS column. AGSs of different sizes use separate random reference banks. For NEA, the submitted gene universe is used by default even when some genes are absent from the network. Set network_nodes_only = TRUE to reproduce network-restricted sampling.

Value

A nearender_result whose master score is the upper-tail empirical probability matrix p.ear, available identically in scores$p.ear and statistics$p.ear. statistics also contains the ordinary renderer probabilities as p.trivial, their adjusted values as q.trivial, the empirical adjusted values as q.ear, and every other ordinary renderer statistic with a .trivial suffix. EAR settings are recorded in parameters; reference-bank information is recorded in diagnostics.

See Also

nea.render(), ora.render(), samples2ags()

Examples

data("NEArender.test")
ags <- NEArender.test$AGS$CCLE[1]
fgs <- NEArender.test$FGS$Hallmarks[1:2]
universe <- unique(c(unlist(ags), unlist(fgs), paste0("control", 1:150)))
calibrated <- ear(universe, n_perm = 9, ags = ags, fgs = fgs,
  method = "ora", seed = 1, verbose = FALSE)
calibrated$scores$p.ear
calibrated$statistics$p.trivial

NEArender documentation built on Nov. 28, 2026, 5:10 p.m.