KEGG_FE_data$GeneRatio = KEGG_FE_data$GeneRatio %>%
factor(levels = KEGG_FE_data$GeneRatio[order(KEGG_FE_data$GeneRatio %>% str_extract(".*/") %>%
str_replace_all("/","")%>%
as.numeric())] %>% unique() )
KEGG_FE_plot = KEGG_FE_data %>%
filter(ID %in% c("map00140","map00981","map04977","map04745")) %>%
mutate(group = "Develop") %>%
bind_rows(KEGG_FE_data %>%
filter(ID %in% c("map05168","map05169")) %>%
mutate(group = "Resistance") ) %>%
bind_rows(KEGG_FE_data %>%
filter(ID %in% c("map00052","map00500","map00564","map00250",
"map00260","map00350","map00380","map00410")) %>%
mutate(group = "Flavour"))
KEGG_FE_plot$group = KEGG_FE_plot$group %>% factor(levels = c("Develop","Resistance","Flavour"))
KEGG_FE_plot$GeneRatio =KEGG_FE_plot$GeneRatio %>% as.character()
for (i in 1:nrow(KEGG_FE_plot)) {
KEGG_FE_plot$GeneRatio[i] =
KEGG_FE_plot$GeneRatio %>% .[i] %>% as.character() %>% str_split("/") %>% unlist() %>% .[1] %>% as.numeric()/
c(KEGG_FE_plot$GeneRatio %>% .[i] %>% as.character() %>% str_split("/") %>% unlist() %>% .[2]%>% as.numeric())
}
KEGG_FE_plot$GeneRatio = KEGG_FE_plot$GeneRatio %>% as.numeric()
pdf(file = "../Fic/fic.30.2.FE_kegg.pdf",width = 11.25,height = 7.5)
ggplot(data = KEGG_FE_plot,aes(x = GeneRatio, y = Description)) +
geom_point(aes(size = Count,color = pvalue)) +
scale_color_gsea()+
scale_y_discrete(labels=function(x) str_wrap(x, width=32)) +
theme_bw() +
theme(axis.title = element_text(size = 8),axis.text = element_text(size = 8, colour = "gray10")) +
labs(y = NULL)+
scale_y_discrete(labels=function(x) str_wrap(x, width=35)) +
theme(axis.title = element_text(face = "bold"),
axis.text = element_text(face = "bold"),
plot.title = element_text(face = "bold")) +
labs(colour = "pvalue")+
facet_grid(group ~ ., scales = "free", space = "free")
dev.off()
KEGG_ME_data$GeneRatio = KEGG_ME_data$GeneRatio %>%
factor(levels = KEGG_ME_data$GeneRatio[order(KEGG_ME_data$GeneRatio %>% str_extract(".*/") %>%
str_replace_all("/","")%>%
as.numeric())] %>% unique() )
KEGG_ME_plot = KEGG_ME_data %>%
filter(ID %in% c("map00140","map00260","map00830","map00981")) %>%
mutate(group = "Develop") %>%
bind_rows(KEGG_ME_data %>%
filter(ID %in% c("map00190","map00590","map00480","map00900",
"map00980","map00982","map04610")) %>%
mutate(group = "Resistance") ) %>%
bind_rows(KEGG_ME_data %>%
filter(ID %in% c("map01212","map00010","map00040","map00500","map00071",
"map00565","map00600","map00280","map00360","map00410")) %>%
mutate(group = "Flavour"))
KEGG_ME_plot$group = KEGG_ME_plot$group %>% factor(levels = c("Develop","Resistance","Flavour"))
KEGG_ME_plot$GeneRatio =KEGG_ME_plot$GeneRatio %>% as.character()
for (i in 1:nrow(KEGG_ME_plot)) {
KEGG_ME_plot$GeneRatio[i] =
KEGG_ME_plot$GeneRatio %>% .[i] %>% as.character() %>% str_split("/") %>% unlist() %>% .[1] %>% as.numeric()/
c(KEGG_ME_plot$GeneRatio %>% .[i] %>% as.character() %>% str_split("/") %>% unlist() %>% .[2]%>% as.numeric())
}
KEGG_ME_plot$GeneRatio =KEGG_ME_plot$GeneRatio %>%as.numeric()
pdf(file = "../Fic/fic.31.2.ME_kegg.pdf",width = 11.25,height = 7.5)
ggplot(data = KEGG_ME_plot,aes(x = GeneRatio, y = Description)) +
geom_point(aes(size = Count,color = pvalue)) +
scale_color_gsea()+
scale_y_discrete(labels=function(x) str_wrap(x, width=32)) +
theme_bw() +
theme(axis.title = element_text(size = 8),axis.text = element_text(size = 8, colour = "gray10")) +
labs(y = NULL)+
scale_y_discrete(labels=function(x) str_wrap(x, width=35)) +
theme(axis.title = element_text(face = "bold"),
axis.text = element_text(face = "bold"),
plot.title = element_text(face = "bold")) +
labs(colour = "pvalue")+
facet_grid(group ~ ., scales = "free", space = "free")
dev.off()
KEGG_dot_plot = KEGG_FE_plot %>% mutate( type = "FE") %>% bind_rows(
KEGG_ME_plot %>% mutate(type = "ME")
)
pdf(file = "../")
ggplot(data = KEGG_dot_plot,aes(x = GeneRatio, y = Description)) +
geom_point(aes(size = Count,color = pvalue,shape = type)) +
scale_color_gsea()+
scale_y_discrete(labels=function(x) str_wrap(x, width=32)) +
theme_bw() +
theme(axis.title = element_text(size = 8),axis.text = element_text(size = 8, colour = "gray10")) +
labs(y = NULL)+
scale_y_discrete(labels=function(x) str_wrap(x, width=35)) +
theme(axis.title = element_text(face = "bold"),
axis.text = element_text(face = "bold"),
plot.title = element_text(face = "bold")) +
labs(colour = "pvalue")+
xlim(0,0.07)+
facet_grid(group ~ type, scales = "free", space = "free")
基于cluster profile的分面双元素点图
本文介绍了使用R语言对KEGG代谢途径数据进行处理,通过过滤、分组和可视化,比较了不同类型的微生物(Develop、Resistance和Flavour)在特定代谢途径中的基因表达差异,以p-value图的形式展示结果。
摘要由CSDN通过智能技术生成