Is it possible to coerce dataframe to enrichResult class in clusterProfiler?
2
0
Entering edit mode
snamjoshi87 ▴ 40
@snamjoshi87-11184
Last seen 4.8 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
2
Entering edit mode
Guangchuang Yu ★ 1.2k
@guangchuang-yu-5419
Last seen 10 months ago
China/Guangzhou/Southern Medical Univer…

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

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: https://david-d.ncifcrf.gov/content.jsp?file=release.html, they mainly upgrade GO and ID conversion data only.

0
Entering edit mode
@0f24a3f5
Last seen 9 days ago

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 (https://rdrr.io/github/jmw86069/jamenrich/) 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"