Aggregates KO-level effects into pathway-level directionality statistics. This is useful when many genes in a pathway consistently shift in the same direction even if individual KO tests are not significant.

calc_pathway_directional_bias(
  disc_obj,
  ko_dictionary,
  pathways = NULL,
  p_null = 0.5,
  p_alternative = c("greater", "less", "two.sided"),
  ci_two_sided = TRUE,
  conf_level = 0.95,
  drop_na_effect = TRUE
)

Arguments

disc_obj

The discriminant object (attr(, "rbims_disc")) containing at least consensus with columns feature and effect.

ko_dictionary

A KO dictionary as produced by make_ko_dictionary(), with columns KO and rbims_pathway.

pathways

Character vector of pathways to test (values from rbims_pathway).

p_null

Null proportion for directionality. Default 0.5.

p_alternative

Alternative hypothesis for directionality p-value. Default "greater" tests whether prop(effect>0) > 0.5.

ci_two_sided

Logical. If TRUE, compute a two-sided 95% exact CI for the proportion (Clopper–Pearson), while keeping a directional p-value defined by p_alternative. This is often preferable for figures.

conf_level

Confidence level for CI. Default 0.95.

drop_na_effect

If TRUE, drop rows with NA effect before calculations.

Value

A tibble with rbims_pathway, x_pos, n, prop_pos, ci_low, ci_high, p_value, p_adj_fdr.

Details

Effect direction convention:

  • effect > 0 means enrichment toward the "positive" group in your contrast (depends on how the contrast is built in the discriminant pipeline).