This function performs Gene Ontology (GO) enrichment analysis on a provided list of gene identifiers using the `clusterProfiler` package. It supports human and mouse organisms and various key types for input genes. Optionally, it can generate bar plots or bubble plots to visualize the top enriched GO terms across Biological Process (BP), Cellular Component (CC), and Molecular Function (MF) ontologies.
Usage
get_GO(
input_list,
organism = c("Homo sapiens", "Mus musculus"),
input_keytype = c("ACCNUM", "ALIAS", "ENSEMBL", "ENSEMBLPROT", "ENSEMBLTRANS",
"ENTREZID", "ENZYME", "EVIDENCE", "EVIDENCEALL", "GENENAME", "GENETYPE", "GO",
"GOALL", "IPI", "MGI", "ONTOLOGY", "ONTOLOGYALL", "PATH", "PFAM", "PMID", "PROSITE",
"REFSEQ", "SYMBOL", "UNIPROT"),
plot = c("no", "bar_plot", "bubble_plot")
)
Arguments
- input_list
A character vector of gene identifiers (e.g., ENTREZIDs, Symbols) for which to perform GO enrichment analysis.
- organism
A character string specifying the organism. Must be one of "Homo sapiens" (for human) or "Mus musculus" (for mouse).
- input_keytype
A character string specifying the type of gene identifiers provided in `input_list`. This must be a valid `keyType` supported by `clusterProfiler::enrichGO` and the corresponding `OrgDb` package. Common options include "ENTREZID", "SYMBOL", "ENSEMBL", "UNIPROT", etc. Refer to `keytypes(OrgDb_package_name)` for a full list (e.g., `keytypes(org.Hs.eg.db)` for human or `keytypes(org.Mm.eg.db)` for mouse).
- plot
A character string specifying the type of plot to generate.
"no": No plot is generated; only the GO enrichment table is returned.
"bar_plot": Generates separate bar plots for the top 20 enriched terms in each GO ontology (BP, CC, MF). The bars are colored by `-log10(pvalue)`.
"bubble_plot": Generates separate bubble plots for the top 20 enriched terms in each GO ontology (BP, CC, MF). Bubble size represents `Count` (number of genes in the term), and color represents `-log10(pvalue)`.
Value
If `plot = "no"`, returns a `data.frame` of GO enrichment results. If `plot = "bar_plot"` or `plot = "bubble_plot"`, returns a `list` containing:
`GO_data`: A `data.frame` of GO enrichment results.
`plot`: A `patchwork` object combining the plots for BP, CC, and MF ontologies.
Examples
if (FALSE) { # \dontrun{
# Example for Homo sapiens using ENTREZID
# A gene list (replace with your actual data)
human_genes <- c("100", "1000", "10000", "10001", "10002", "10003",
"10004", "10005", "10006", "10007", "10008", "10009",
"1001", "10010", "10011", "10012")
# Get GO data only
go_results_human_table <- get_GO(input_list = human_genes,
organism = "Homo sapiens",
input_keytype = "ENTREZID",
plot = "no")
print(head(go_results_human_table))
# Get GO data and bar plots
go_results_human_bar_plot <- get_GO(input_list = human_genes,
organism = "Homo sapiens",
input_keytype = "ENTREZID",
plot = "bar_plot")
print(head(go_results_human_bar_plot$GO_data))
go_results_human_bar_plot$plot # This will display the combined plot
# Get GO data and bubble plots
go_results_human_bubble_plot <- get_GO(input_list = human_genes,
organism = "Homo sapiens",
input_keytype = "ENTREZID",
plot = "bubble_plot")
print(head(go_results_human_bubble_plot$GO_data))
go_results_human_bubble_plot$plot # This will display the combined plot
# Example for Mus musculus using SYMBOL
# A gene list (replace with your actual data)
mouse_genes <- c("Trp53", "Cdkn1a", "Mdm2", "Myc", "Fos", "Jun", "Akt1", "Pik3ca")
# Get GO data and bubble plots for mouse
go_results_mouse_bubble_plot <- get_GO(input_list = mouse_genes,
organism = "Mus musculus",
input_keytype = "SYMBOL",
plot = "bubble_plot")
print(head(go_results_mouse_bubble_plot$GO_data))
go_results_mouse_bubble_plot$plot
} # }