Adding Enrichresults for creating plot
1
0
Entering edit mode
@felixthaler-23378
Last seen 4.6 years ago

I am performing pathway analysis using the ReactomePA package and the clusterProfiler package. I did the pathway analysis and got 2 objects, one by using the enrichPathway() function from ReactomePA and one by using the enrichKEGG() function from clusterProfiler.

Both objects have the same class: enrichResult.

Now my question: I am able to do plots which each object itself, but can I also make a plot that shows the pathways of both objects? Or is there another way I can achieve this?

Thanks a lot for your help, I really like both packages!

ReactomePA clusterProfiler • 2.9k views
ADD COMMENT
0
Entering edit mode
Guangchuang Yu ★ 1.2k
@guangchuang-yu-5419
Last seen 7 days ago
China/Guangzhou/Southern Medical Univer…

you can use the mergeresult function that is documented in https://github.com/GuangchuangYu/enrichment4GTExclusterProfiler.

ADD COMMENT
0
Entering edit mode

Thanks, but the link gives me the 404 Error message.

how should i use the merge_result function? I read the clusterProfiler reference manual

simply putting in the list of enrichResults i want to merge doesn't work unfortunately....

ADD REPLY
0
Entering edit mode

Somehow the underscore in the URL malformatted it... the link above should be:

https://github.com/GuangchuangYu/enrichment4GTEx_clusterProfiler/

merge_results expects multiple lists!

The code below works (inspired by your use case):

library(clusterProfiler)
library(ReactomePA)

# selects some (100) genes for overrepresentation analysis
data(geneList, package='DOSE')
de <- names(geneList)[1:100]

# note high cutoff p-value!
# did this to make sure some pathways were included
y.reactome = enrichPathway(de, pvalueCutoff=0.5)
y.kegg <- enrichKEGG(gene, pvalueCutoff=0.5)

# merge the results
out <-  merge_result( list("Reactome"=y.reactome, "KEGG"=y.kegg))

# generate a dotplot from merged results.
# note that in the example below 5 (only) pathways will be shown.
# Since by definition there is no overlap in enriched pathways,
# because the sources are different (!) (Reactome vs KEGG),
# five pathways per pathway database will be shown.
#  
# The number below each column name are the number of genes
# that could be annotated in each database.
dotplot(out, showCategory=5)
ADD REPLY
0
Entering edit mode

It worked, but i got only 17 merged results and 16 plots even though i expected 39. The console put out the following:

--> No gene can be mapped....
--> Expected input gene ID: 51144,6476,54659,3420,130,47
--> return NULL...
--> No gene can be mapped....
--> Expected input gene ID: 9972,3671,4860,2548,7873,8635
--> return NULL...
--> No gene can be mapped....
--> Expected input gene ID: 3418,6476,226,8789,221823,51
--> return NULL...
Fehler in `[.data.frame`(result, , c("ID", "Description")) : 
  undefined columns selected

Thanks for your help!

ADD REPLY
0
Entering edit mode

Please post your full code, ideally fully reproducible (thus using the included data set).... Your output as such is not very informative....

ADD REPLY
0
Entering edit mode

Alright, that's my code

merged_pathways <- list()
all_plots <- list()

# entrez_gene_ids is a  list of 39 character vectors containing Entrez gene IDs

for (file in entrez_gene_ids) {

  pathway_reactome <- enrichPathway(gene = file, 
                                    # not using universe argument at the moment
                                    organism = "human",
                                    pvalueCutoff = 0.05,
                                    pAdjustMethod = "BH",
                                    qvalueCutoff = 0.2)

  pathway_kegg <- enrichKEGG(gene = file, 
                             # not using the universe argument at the moment
                             organism = "hsa",
                             pAdjustMethod = "BH",
                             pvalueCutoff = 0.05,
                             qvalueCutoff = 0.2)

  merged_result <- merge_result( list("Reactome"=pathway_reactome, "KEGG"=pathway_kegg))

  merged_pathways[[length(merged_pathways)+1]] <- merged_result 

  merged_plot <- dotplot(merged_result, showCategory = 15)

  all_plots[[length(all_plots)+1]] <- merged_plot

 }
ADD REPLY
0
Entering edit mode

I haven't fully checked your code, but based on the output you showed earlier: could it be that some of your input vectors consist of entrez ids that are not HUMAN entrez ids, or only of ids that are not (yet) annotated to a Reactome or KEGG pathway? That would explain that 'no gene cane be mapped'....

ADD REPLY
0
Entering edit mode

They're all human genes... when i did the enrichment analysis without merging both results it worked, so maybe the Error Message is related to the merge_result function...

ADD REPLY

Login before adding your answer.

Traffic: 604 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