How can I sort the clusterProfiler package results (groupGOResult object) for instance according GeneRatio in groupGO?
If for visualization, just pass order=TRUE to barplot. It will sort result based on count which is similar to geneRatio (since geneRatio = count/geneNum, and geneNum is identical).
You can use summary(groupGO_object) to export the result as a data.frame and sort it yourself if you want to do other things.
Thanks Guangchuang Yu,
But this only sort displayed category (showCategory) not all category. I want plot 10 category with max count.
I use showCategory to subset the result first.
Will change to order result first, follow by subsetting. Then your question can be resolved by barplot(x, showCategory=10, order=T)
In current implementation, you can use the following script:
> df = summary(x)
> term=df$ID[order(df$Count, decreasing=T)]
> barplot(x, showCategory=term[1:10], order=T)
How do I subset groupGO objects?
Login before adding your answer.
Use of this site constitutes acceptance of our User Agreement and Privacy