convert regular data matrix or data frame to enrichResult object for bioconductor package enrichplot
1
0
Entering edit mode
@capricygcapricyg-17892
Last seen 7 days ago
United States

My enrichment analysis outputs are regular data matrix or data frame. I have an example below:

ID  Description pvalue  p.adjust
GO:0030155  regulation of cell adhesion 2.49E-22    0.000138407
GO:0022407  regulation of cell-cell adhesion    2.41E-21    0.048920046
GO:0007159  leukocyte cell-cell adhesion    4.11E-21    5.11E-05
GO:0002376  immune system process   4.65E-21    0.422705551
GO:0045785  positive regulation of cell adhesion    4.89E-21    0.001564328

How may I convert it to enrichmentResult object to barplot?

Thanks a lot.

C.

enrichplot • 106 views
ADD COMMENT
0
Entering edit mode
lida • 0
@lida-24371
Last seen 17 hours ago
China

Hi,

Not a member of the enrichplot package team. If you just want to display your enrichment results with barplot from a data.frame, you can simply use ggplot2 to create a barplot with "Description" as x-axis and "-log10 (p.adjust)" as y-axis. Imagines you have a data frame enrich.df with column Description and p.adjust, you can plot the barplot as follows:

ggplot2(enrich.df, aes(x = Description, y = -log10(p.adjust))) +
    geom_bar(stat = 'identity') +
    coord_flip()

To be noted, the barplot from package enrichplot uses number of genes in each enriched terms as y-axis and fills wih -log10 (p.adjust). To fully reproduce the barplot from enrichplot you should also have a column of Counts in your enrichment results data frame :

ggplot2(enrich.df, aes(x = Description, y = Counts, fill = -log10(p.adjust))) +
    geom_bar(stat = 'identity') +
    coord_flip()

Cheers

lida

ADD COMMENT

Login before adding your answer.

Traffic: 243 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6