Skip to content

Instantly share code, notes, and snippets.

@ATpoint
Created November 26, 2024 10:33
Show Gist options
  • Select an option

  • Save ATpoint/e4bcf1a74ea731e23feb02da6e282c02 to your computer and use it in GitHub Desktop.

Select an option

Save ATpoint/e4bcf1a74ea731e23feb02da6e282c02 to your computer and use it in GitHub Desktop.
Get GO terms using annotation packages
# Retrieve GO terms in R using AnnotationDbi and org.Mm.eg.db
library(org.Mm.eg.db)
library(AnnotationDbi)
all_go <- AnnotationDbi::select(
org.Mm.eg.db,
keys = keys(org.Mm.eg.db, keytype = "ENTREZID"),
columns = c("GO", "ONTOLOGY", "ENSEMBL"),
keytype = "ENTREZID"
)
all_go$TERM <- Term(all_go$GO)
go <- data.frame(term = all_go$TERM, id = all_go$GO, ontology = all_go$ONTOLOGY, gene_id = all_go$ENSEMBL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment