First load the BioMartGOGeneSets package.

library(BioMartGOGeneSets)

Get genes for a specific organism. The proper value of dataset can be found in the tables at the end of this document.

getBioMartGenes(dataset)

Get GO gene sets for a specific organism.

getBioMartGOGeneSets(dataset, ontology = "BP")

Version information:

BioMartGOGeneSets
## BioMart Gene Ontology gene sets
##   Source: https://www.ensembl.org/info/data/biomart/index.html 
##   Number of organisms: 616 
##   Marts: fungi_mart, genes_mart, metazoa_mart, plants_mart, protists_mart 
##   Built date: 2022-09-20, with biomaRt (2.52.0), GO.db (3.15.0)

Source code for retrieving GO gene sets can be obtained here:

system.file("scripts", "biomart_genesets.R", package = "BioMartGOGeneSets")
## [1] "/Users/guz/Library/R/x86_64/4.2/library/BioMartGOGeneSets/scripts/biomart_genesets.R"

Ensembl organisms (vertebrates) (212 organisms)

Plants (133 organisms)

Metazoa (222 organisms)

Fungi (70 organisms)

Protists (33 organisms)