Skip to content

Instantly share code, notes, and snippets.

@kieranrcampbell
Created May 15, 2017 09:06
Show Gist options
  • Save kieranrcampbell/e7a9500394b7e81d80280bc21387943b to your computer and use it in GitHub Desktop.
Save kieranrcampbell/e7a9500394b7e81d80280bc21387943b to your computer and use it in GitHub Desktop.
Plot the p-values of a GO analysis
library(stringr)
library(ggplot)
library(dplyr)
## Assuming "go" has columns "term" and "q_value"
go_top <- head(go, n = 10)
go_top$term <- str_to_title(go_top$term)
terms_sorted <- arrange(go_top, desc(q_value)) %>% .$term
go_top$term <- factor(go_top$term, levels = terms_sorted)
ggplot(go_top, aes(x = term, y = -log10(q_value))) +
geom_point() +
coord_flip() +
theme(axis.title.y = element_blank(), legend.position = "none") +
ylab(expression(paste("-", log[10], " q-value"))) +
theme(#legend.position = c(-.2, -.14), legend.direction = "horizontal",
legend.position = c(0, 0), legend.direction = "horizontal",
axis.text = element_text(size = 8),
axis.title = element_text(size = 10),
legend.title = element_text(size = 11),
legend.text = element_text(size = 10))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment