
Run Over-Representation Analysis and Plot Results
RunEnrichment.RdRuns over-representation analysis (ORA) using enrichR on a gene list
or on significant DEGs from a data frame, then automatically calls
PlotEnrichment to visualize the results. When
group_column is supplied, analysis is run separately per group.
Usage
RunEnrichment(
features = NULL,
deg_df = NULL,
gene_column = NULL,
fc_column = NULL,
padj_column = NULL,
group_column = NULL,
fc_cutoff = 0.25,
padj_cutoff = 0.05,
direction = "up",
databases = c("MSigDB_Hallmark_2020", "GO_Biological_Process_2023", "KEGG_2021_Human"),
top_n_plot = 20,
plot_type = "dot",
padj_cutoff_plot = 0.05,
output_dir = NULL,
object_name = "",
subset_name = ""
)Arguments
- features
Character vector of gene symbols to test. Provide either this or
deg_df, not both.- deg_df
Data frame of DE results (presto or FindMarkers). Genes are filtered by
fc_cutoff,padj_cutoff, anddirectionbefore testing.- gene_column
Gene name column in
deg_df. Auto-detected ifNULL.- fc_column
logFC column in
deg_df. Auto-detected ifNULL.- padj_column
Adjusted p-value column. Auto-detected if
NULL.- group_column
Column in
deg_dfto loop over (e.g."group").NULL= test all significant genes together.- fc_cutoff
Minimum absolute logFC to include a gene. Default
0.25.- padj_cutoff
Maximum adjusted p-value cutoff. Default
0.05.- direction
Which DEGs to test:
"up"(logFC > 0),"down"(logFC < 0), or"both". Default"up".- databases
Character vector of enrichR database names to query. See
enrichR::listEnrichrDbs()for all options. Default:c("MSigDB_Hallmark_2020", "GO_Biological_Process_2023", "KEGG_2021_Human").- top_n_plot
Maximum number of terms to show per database. Default
20.- plot_type
Type of plot passed to
PlotEnrichment. Default"dot".- padj_cutoff_plot
Significance cutoff for filtering enrichment results before plotting. Default
0.05.- output_dir
Directory to save PDFs and result CSVs.
NULL= no save, print only.- object_name
Label prefix for output file names.
- subset_name
Optional subset label.
Value
A nested list: [[group]][[database]] containing enrichR
result data frames. Invisibly when output_dir is set.