Skip to content

Instantly share code, notes, and snippets.

@brianjmpark
Last active February 15, 2020 22:43
Show Gist options
  • Save brianjmpark/730ecc0f8698c97b7b1e6a883744a766 to your computer and use it in GitHub Desktop.
Save brianjmpark/730ecc0f8698c97b7b1e6a883744a766 to your computer and use it in GitHub Desktop.
#requires tab delimited output file after running genescf
#re-generates default scatterplot output from genescf with improved readability
#requires two arguments from r console: imported raw genescf output table and name of sample group
graph_genescf <- function(table, name){
require(ggplot2)
require(plyr)
table <- table[,c(2,3,4,5,6)]
table <- arrange(table, P.value)
table <- table[1:20,]
table$rank_position <- 1:20
g <- ggplot(table, aes(x = rank_position, y = -log10(P.value))) + geom_point(aes(color = reorder(Process.name, rank_position)), show.legend = T) + theme(legend.text = element_text(size = 6)) + geom_hline(yintercept = -log10(0.05)) + labs(color = "Top 20 Ranked Processes") + labs(title = "Top Enriched GO:BP terms", subtitle = name) + xlab("Ranked Position")
return(g)
}
g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment