Canonicalize and order an enrichment result data frame
Source:R/enrichment_analysis.R
dot-format_enrichment_result.RdShared post-processing for the ORA / GSEA / CAMERA runners. Each
runner hands in a data frame that already has the harmonized columns
ChemicalID and pvalue; this helper computes
padj, joins chemical metadata, applies a canonical
leading-column order, sorts by padj ascending, and drops row
names. Centralizing this step keeps the runners small and the public
output schema consistent across methods.
Usage
.format_enrichment_result(
res,
chemicals_meta,
pAdjustMethod,
method,
rename = NULL,
drop = NULL
)Arguments
- res
Data frame as returned by an enrichment engine (
ora(),gsea(),limma::camera()), still carrying the engine's native column names.- chemicals_meta
Data frame with
ChemicalIDandChemicalNamecolumns.- pAdjustMethod
Method passed to
p.adjust.- method
Method label (one of
"ORA","GSEA","CAMERA") stamped into the newMethodcolumn so results can berbind'd across methods without losing provenance.- rename
Named character vector mapping
old_engine_colname = "NewCanonicalName". Applied before the metadata merge. Centralizes the engine->canonical-schema mapping so each engine can keep its native column names.- drop
Character vector of engine column names to remove before the merge / sort.