I was wondering how to get the list of genes grouped in a particular GO-Term of Biological Pathway. I have an enrichGO output (using the clusterprofiler package). From this result, I've into a bar plot (see below). For example, my top enriched pathway is T cell activation, how do I obtain the genes which have been grouped into this pathway?
My code is taken from the clusterProfiler book:
ego2 <- enrichGO(gene = gene.df$ENTREZID,
OrgDb = org.Mm.eg.db,
keyType = 'ENTREZID',
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff = 0.01,
qvalueCutoff = 0.05)
barplot(ego2, showCategory=10)
Here are some screenshots of what my data looks like in R:
Thanks so much! This seemed to work, as I'm able to see the number of genes as well as their IDs. Is it possible to also have the name of the pathway they are involved in (right now they are numbered, where I assume pathway 1 = T cell activation) or do I just assume they are in the same order as my bar plot?
They will be ranked by p-value by default, so yes, they should match up correctly. Though you could create a named vector by assigning
description
as the names for your vector to make things a bit easier , i.e:Thank you very much!
I had the same problem. thank you :)
thanks, just a short note for anyone checking this nowadays, in case this doesn't work try Description and result, apparently slight changes to words have happened: