Skip to contents

This function searches for Gene Ontology (GO) terms that contain a specified search term and retrieves all associated genes for the specified species and ID type.

Usage

get_genes_by_go_term(search.term, orgdb, id.type = "SYMBOL")

Arguments

search.term

A character string specifying the term to search for within GO terms (case-insensitive).

orgdb

The organism-specific database package to use for gene mapping. This should be one of the organism packages like "org.Hs.eg.db", "org.Mm.eg.db", etc.

id.type

A character string specifying the type of gene identifier to return. Options include "SYMBOL", "ENTREZID", and "ENSEMBL". Default is "SYMBOL".

Value

A named list containing:

  • genes - A character vector of gene identifiers of the specified type associated with GO terms that contain the search term. The names of the vector are the corresponding Entrez Gene IDs (if id.type is not "ENTREZID").

  • go_terms - A character vector of GO terms that matched the search term.

Details

The function performs the following steps:

  • Retrieves all GO terms and their descriptions.

  • Searches for GO terms that include the specified search term.

  • Retrieves all Entrez Gene IDs associated with the matching GO terms.

  • Maps Entrez Gene IDs to the specified type of gene identifier.

Author

Jared Andrews

Examples

# Retrieve human gene symbols associated with GO terms containing "WNT"
genes_wnt_human <- get_genes_by_go_term("WNT", "org.Hs.eg.db", id_type = "SYMBOL")
#> Error in get_genes_by_go_term("WNT", "org.Hs.eg.db", id_type = "SYMBOL"): unused argument (id_type = "SYMBOL")
head(genes_wnt_human$genes)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': object 'genes_wnt_human' not found
head(genes_wnt_human$go_terms)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'head': object 'genes_wnt_human' not found