Entering edit mode
6.9 years ago
Tania
▴
180
Hi all
If we detected the pathways using gage, how can I find the list of genes involved in each pathway? I mean how to output the genes enriched significanlty in each pathway that was in my list of genes?
res$symbol <- mapIds(org.Hs.eg.db,
keys=row.names(res),
column="SYMBOL",
keytype="SYMBOL",
multiVals="first")
res$entrez <- mapIds(org.Hs.eg.db,
keys=row.names(res),
column="ENTREZID",
keytype="SYMBOL",
multiVals="first")
foldchanges = res$logfc
names(foldchanges) = res$entrez
#---------------Use Kegg and gage to get upregulated and downregulated pathways
datakegg.gs)
keggres = gage(foldchanges, gsets =kegg.gs, same.dir =,True, compare="unpaired" )
lapply(keggres, head)
keggrespathwaysup = data.frame(id=rownames(keggres$greater), keggres$greater) %>%
tbl_df() %>%
filter(row_number()<=5) %>%
.$id %>%
as.character()
keggrespathwaysdn = data.frame(id=rownames(keggres$less), keggres$less) %>%
tbl_df() %>%
filter(row_number()<=5) %>%
.$id %>%
as.character()
write.csv(keggrespathwaysup, "keggspathsup.csv")
write.csv(keggrespathwaysdn, "keggspathsdn.csv")
#-------------------------------------------------------
keggresidsup = substr(keggrespathwaysup, start=1, stop=8)
keggresidsup
keggresidsdn = substr(keggrespathwaysdn, start=1, stop=8)
gobpres = gage(foldchanges, gsets=kegg.gs, same.dir =TRUE, compare ="unpaired")
lapply(gobpres, head)
plot_pathway = function(pid) pathview(gene.data=foldchanges,gene.idtype="ENTREZID", pathway.id=pid,
species="hsa", new.signature=FALSE)
#------------------------------plot multiple pathways ups and downs
tmpup = sapply(keggresidsup, function(pid) pathview(gene.data=foldchanges,gene.idtype="ENTREZID", pathway.id=pid, species="hsa"))
tmpdn = sapply(keggresidsdn, function(pid) pathview(gene.data=foldchanges,gene.idtype="ENTREZID", pathway.id=pid, species="hsa"))