Commit f991238f authored by Safia Saci's avatar Safia Saci
Browse files

Upload New File

parent 2d0253d3
library(dplyr)
library(ggplot2)
library(forcats)
# input file
WEGO <- read.table("data/pantherdb/go.tsv", header = FALSE, sep = ";")
colnames(WEGO) <- c("ID", "Domain","factor", "Number of genes", "Percentage of genes", "raw P_value", "FDR", "Description")
categories <- WEGO %>%
group_by(factor) %>%
top_n(5, `Percentage of genes`) %>%
.$ID
WEGO2 <- filter(WEGO, ID %in% categories) %>%
arrange(factor, `Percentage of genes`) %>%
mutate(Position = n():1)
normalizer <- max(WEGO2$`Number of genes`)/max(WEGO2$`Percentage of genes`)
#plot
p3 <- ggplot(data = WEGO2, aes(x = fct_reorder(Description, Position), y = -log10(FDR), fill = factor)) +
geom_col() +
scale_fill_manual(values=c("indianred1", "indianred4","deepskyblue1", "deepskyblue4")) +
theme(axis.text.x = element_text(hjust = 1), axis.title.y = element_text(size = 8),
legend.text = element_text(size = 7), legend.title = element_text(size = 8),
legend.key.size = unit(0.2, "in"), plot.title = element_text(size = 11, hjust = 0.5),
panel.background = element_blank(),
axis.line = element_line(colour = "grey")) +
coord_flip() +
labs(x = NULL, title = "Gene Ontology (GO) Annotation")
ggsave("plots/geneOnto.png", p3, height = 5, width = 8)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment