Skip to contents

Performs Gene Ontology enrichment analysis on differentially expressed genes using the EnrichR API. Separately analyzes upregulated and downregulated genes and returns results.

Usage

DO.enrichR(
  df_DGE,
  gene_column,
  pval_column,
  log2fc_column,
  pval_cutoff = 0.05,
  log2fc_cutoff = 0.25,
  path = NULL,
  filename = "",
  species = "Human",
  go_catgs = c("GO_Molecular_Function_2023", "GO_Cellular_Component_2023",
    "GO_Biological_Process_2023")
)

Arguments

df_DGE

data.frame containing differential gene expression results.

gene_column

column name in df with gene symbols.

pval_column

column name in df with p-values.

log2fc_column

column name in df with log2 fold changes.

pval_cutoff

adjusted p-value threshold for significance (default = 0.05).

log2fc_cutoff

log2 fold change threshold for up/down regulation (default = 0.25).

path

folder path where the output Excel file will be saved. A subfolder "GSA_Tables" will be created.

filename

suffix used in the Excel filename (e.g., "GSA_CellType_MyAnalysis.xlsx").

species

species name for enrichment analysis. Options include "Human", "Mouse", "Yeast", etc. (default = "Mouse").

go_catgs

GO databases to use. Defaults to c("GO_Molecular_Function_2023", "GO_Cellular_Component_2023", "GO_Biological_Process_2023").

Value

data.frame with GO enrichment results if path is NULL, otherwise writes an Excel file.

Examples

if (FALSE) { # \dontrun{
#GO analysis on differential expression results:
results <- go_analysis(df_DGE = deg_results,
                       gene_key = "gene",
                       pval_key = "adj_pval",
                       log2fc_key = "log2FC",
                       species = "Human")

#Or save the results to a file:
go_analysis(df_DGE = deg_results,
            gene_key = "gene",
            pval_key = "p_val_adj",
            log2fc_key = "log2FC",
            path = "results/",
            filename = "experiment.xlsx",
            species = "Mouse")
} # }