Skip to content

Instantly share code, notes, and snippets.

@arupgsh
Last active July 13, 2019 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arupgsh/771fb7a329be1f9caa7769b03004ff99 to your computer and use it in GitHub Desktop.
Save arupgsh/771fb7a329be1f9caa7769b03004ff99 to your computer and use it in GitHub Desktop.
#Pathways for scRNA
library(dplyr)
library(Matrix)
library(MASS)
library(topGO)
library(xtable)
source("topGO.script.R")
#Run the topGOterm dunctiom
GOterms.bc = topGOterms(fg.genes = "Gene List", organism = "Human")
pathway_list<-GOterms.bc$res.table
pathway_list$rank<- -log10(as.numeric(pathway_list$pval))
#Plot the pathway
positions <- pathway_list$Term
p1<-ggplot(pathway_list,aes(pathway_list$Term,y=il27_pos_path$rank))+geom_bar(stat = "identity",fill="brown",width = 0.6)+
theme_bw() + geom_blank()+theme(panel.grid.major.x = element_blank(),
panel.grid.major.y = element_blank(),
panel.grid.minor.x = element_blank(),
panel.grid.minor.y = element_blank())+
scale_x_discrete(limits = positions)+coord_flip()+
theme(axis.text.y = element_text(face="bold",colour = "black"))
p1
p1<-p1+scale_x_discrete(limit=rev(positions),labels = function(x) lapply(strwrap(x, width = 50, simplify = FALSE), paste, collapse="\n"))
p1+ labs(x= "Top Enriched Pathways") + labs(y = "-log(p-value)")+ labs(title = "Plot title goes here")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment