R/CALC-pathway_directional_bias.R
calc_pathway_directional_bias.RdAggregates 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
)The discriminant object (attr(, "rbims_disc")) containing
at least consensus with columns feature and effect.
A KO dictionary as produced by make_ko_dictionary(),
with columns KO and rbims_pathway.
Character vector of pathways to test (values from rbims_pathway).
Null proportion for directionality. Default 0.5.
Alternative hypothesis for directionality p-value. Default "greater" tests whether prop(effect>0) > 0.5.
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.
Confidence level for CI. Default 0.95.
If TRUE, drop rows with NA effect before calculations.
A tibble with rbims_pathway, x_pos, n, prop_pos,
ci_low, ci_high, p_value, p_adj_fdr.
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).