#######总的K0基因对应的通路
emapper1 <- read_delim("KEGG_KO_ENZYME_PATHWAY.txt","\t", escape_double = FALSE,col_names = FALSE) %>%
dplyr::select(K0_id = X1,
Pathway = X8,
level1 = X9,
level2 = X10,
level3 = X11
)
#
emapper1
###假设取前一百个是所需的目的K0基因
test<-emapper1[1:100,]
test
##########转化每个基因对应的pathway
gene2pathway <- dplyr::select(test, K0_id, Pathway) %>%
separate_rows(Pathway, sep = ';', convert = F) %>%
filter(str_detect(Pathway, 'ko'))
gene2pathway
#加载通路信息
load(file = paste("kegg_info.RData"))
pathway2name
gene2pathway <- gene2pathway %>%
left_join(pathway2name, by = "Pathway") %>%
dplyr::select(K0_id, Pathway, Pathway_Name, Pathway_Class, Pathway_Subclass) %>%
distinct() %>%
na.omit()
gene2pathway
################################简洁版
# if (!require("BiocManager", quietly = TRUE))
# install.packages("BiocManager")
#
# BiocManager::install("clusterProfiler")
library(clusterProfiler)
k <- c("K00799","K00844")
x <- bitr_kegg(k,"kegg","Path","ko")
x
#加载已知通路信息
load(file = paste("kegg_info.RData"))
pathway2name
gene2pathway <- x %>%
left_join(pathway2name, by = c("Path"="Pathway")) %>%
#dplyr::select(K0_id, Pathway, Pathway_Name, Pathway_Class, Pathway_Subclass) %>%
distinct() %>%
na.omit()
gene2pathway
暂无评论