library(KEGGREST)
library(org.Hs.eg.db)
library(tidyverse)
hsa_path_eg <- keggLink("pathway", "hsa") %>%
tibble(pathway = ., eg = sub("hsa:", "", names(.)))
hsa_kegg_anno <- hsa_path_eg %>%
mutate(
symbol = mapIds(org.Hs.eg.db, eg, "SYMBOL", "ENTREZID"),
ensembl = mapIds(org.Hs.eg.db, eg, "ENSEMBL", "ENTREZID")
)
首先导入相应的R包和数据。(上面程序里用到的几个R包需要用biomanager来安装。)hsa_kegg_anno即包含了KEGG数据库中,所有与人有关的pathway的全部gene list。
下面我们选择出我们想要的pathway的gene list。以hsa04066为例
result = hsa_kegg_anno[hsa_kegg_anno$pathway == 'path:hsa04066', ]
demo.png
最后将我们需要的数据保存下来
geneName_geneID = result[,3:4]
write.table(geneName_geneID,file = 'filename.txt',
sep = '\t',row.names = FALSE,col.names = TRUE)
网友评论