1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| ego_down <- enrichGO(gene = gene_down, OrgDb = org.Dm.eg.db, ont = "ALL" , universe = gene_all, pAdjustMethod = "BH", pvalueCutoff = 0.99, qvalueCutoff = 0.99, readable = TRUE)
head(ego_down[,1:6]) ego_down_result <- ego_down@result[order(ego_down@result$pvalue),] ego_down_sig <- rbind(head(subset(ego_down_result, ONTOLOGY == "BP"), 10), head(subset(ego_down_result, ONTOLOGY == "CC"), 10), head(subset(ego_down_result, ONTOLOGY == "MF"), 10)) ego_down_sig$pvalue <- -log10(ego_down_sig$pvalue) ego_down_sig$Description <- factor(ego_down_sig$Description, levels = as.character(rev(ego_down_sig$Description)))
ggplot(ego_down_sig, aes(x = Description, y = pvalue, fill = ONTOLOGY)) + geom_col() + coord_flip() + theme_classic() + facet_grid(ONTOLOGY~., scales = "free") + xlab("Down regulated") + ylab("-log10 pvalue")
ggplot(ego_down_sig, aes(x = Description, y = pvalue, fill = p.adjust)) + scale_fill_gradient(low = "red",high = "blue")+ geom_col() + coord_flip() + theme_classic() + facet_grid(ONTOLOGY~., scales = "free") + xlab("Down regulated")+ ylab("-log10 pvalue")
ggplot(ego_down_sig, aes(x = GeneRatio, y = Description, color =p.adjust, size = Count)) + geom_point()+ scale_size(range = c(2,8))+ scale_color_gradient(low = "red",high = "blue")+ theme_classic() + facet_grid(ONTOLOGY~., scales = "free") + xlab("Gene ratio")
|