Created
March 24, 2022 23:34
-
-
Save tomsing1/d00a655f5268e5563611b3361636b990 to your computer and use it in GitHub Desktop.
Listifying KEGG and GO gene sets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(limma) | |
library(AnnotationDbi) | |
library(GO.db) | |
library(org.Hs.eg.db) | |
# KEGG | |
kegg.names <- getKEGGPathwayNames("hsa", remove.qualifier = TRUE) | |
kegg.sets <- getGeneKEGGLinks("hsa", convert = TRUE) | |
kegg.gsc <- with(kegg.sets, split(GeneID, PathwayID)) | |
names(kegg.gsc) <- kegg.names[ | |
match(names(kegg.gsc), kegg.names$PathwayID), "Description"] | |
# GO | |
go.sets <- AnnotationDbi::toTable( | |
org.Hs.egGO2ALLEGS)[, c("gene_id", "go_id", "Ontology")] | |
go.names <- AnnotationDbi::mapIds(GO.db::GO.db, | |
keys = unique(go.sets$go_id), keytype = "GOID", column = "TERM") | |
go.gsc <- with(go.sets, split(gene_id, go_id)) | |
names(go.gsc) <- go.names[names(go.gsc)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment