Is it possible to coerce dataframe to enrichResult class in clusterProfiler?
Entering edit mode
snamjoshi87 ▴ 40
Last seen 4.7 years ago

I have some DAVID GO results that I have performed my own filtering on. I would like to now use the simplify() function from clusterProfiler to reduce redundancy as well as take advantage of some of the visualization tools in this package. However, the simplify() function only accepts enrichResult objects. If I were to set up a dataframe with columns similar to an enrichResult object, would there be a way for me to coerce it so I can use the other functions in this package?

clusterprofiler • 1.3k views
Entering edit mode
Guangchuang Yu ★ 1.2k
Last seen 10 months ago
China/Guangzhou/Southern Medical Univer…

it is possible but I do not provide helper function to do this.


You may want to try:


DAVID is not recommended since their data are pretty old. Even with new beta version, most of the data are still not updated.

See the release note:, they mainly upgrade GO and ID conversion data only.


Entering edit mode
Last seen 9 days ago
CBMSO, Madrid, Spain

I know the post was answered long ago but I just encounter the same situation, here is my solution. Hope it helps :)

I have succesffuly used the package multienrichjam ( to transform an object of class data.frame into an enrichResult class object.

For example, using a Gprofiler modified table:

> head(df, 2)
term_name  term_id  adjusted_p_value  term_size  query_size  intersection_size  effective_domain_size  intersections  Enrichment  GeneRatio  BgRatio
RHO GTPases activate PAKs REAC:R-HSA-5627123  6.71e-14  21  51  2  10622  MYH9,FLNA  89.26  2/51  21/10622
EPH-Ephrin signaling REAC:R-HSA-2682334  2.88e-12  90  51  3  10622  ACTR2,ARPC4,MYL6  27.77  3/51  90/10622

> enr <- enrichDF2enrichResult(enrichDF = df, keyColname = "term_id", geneColname = "intersections", pvalueColname = "adjusted_p_value", descriptionColname = "term_name", pvalueCutoff = 0.05)

The threshold won't filter the table, it is information added to the object. Finally, modify the column names (my case enr@results) to match the ones required by enrichplot. In my case:

  "ID"  "Description"  "pvalue"  "geneID"  "GeneRatio"  "BgRatio"  "p.adjust"  "Count" 

Login before adding your answer.

Traffic: 229 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6