## Warning: package 'GenomicRanges' was built under R version 4.2.2
## Warning: package 'BiocGenerics' was built under R version 4.2.1
## Warning: package 'S4Vectors' was built under R version 4.2.2
## Warning: package 'IRanges' was built under R version 4.2.1
## Warning: package 'GenomeInfoDb' was built under R version 4.2.2

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: 670 
##   Marts: fungi_mart, genes_mart, metazoa_mart, plants_mart, protists_mart 
##   Built date: 2023-02-11, with biomaRt (2.54.0), GO.db (3.16.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 (150 organisms)

Metazoa (253 organisms)

Fungi (70 organisms)

Protists (33 organisms)