When using enrichKEGG function with the default parameters (ekegg <- enrichKEGG(gene = ENTREZID_genes, organism = 'mmu', pvalueCutoff = 0.05) there are no lists/slots KEGGPATHID2NAME$to generated in the output ekegg object, nor clusterProfiler::download_KEGG was invoked, so not sure what you are pointing to.
I've been using ClusterProfiler for a while now. I notice in the most recent version, when I plot KEGG pathways, every pathway name is followed by "โ Mus musculus (house mouse)". This is really irritating and looks very messy. Can this extra text of the organism name be removed in some easy way? Examples of old and new plots below: Thanks for any help!
2 answers
before invoking dotplot function replace the parts of the strings in your enrichKEGG result (let's call it ekegg):
ekegg@result$Description <- gsub(pattern = " - Mus musculus (house mouse)", replacement = "", ekegg@result$Description, fixed = T)
dotplot(ekegg)
stringr::str_remove can remove " - Mus musculus (house mouse)" from the pathway names which are stored under KEGGPATHID2NAME$to in your list object produced by clusterProfiler::download_KEGG or in the gene set names in your output from enrichKEGG.
Note - you'll have to escape the parentheses in your search string, i.e., use " - Mus musculus \\(house mouse\\)"
Just giving OP some options since they didn't show their code. In my case I am using clusterProfiler::download_KEGG to download KEGG gene sets and then pruning them according to my needs which also allows me to revise the gene set descriptions stored in KEGGPATHID2NAME$to.
As we both pointed out, " - Mus musculus \(house mouse\)" can be removed from the results generated by enrichKEGG
Log in to answer this question.
Is there a problem in using program version that produced your top plot?
Unless there is known bug in a program, or a super-useful feature in a newer version, I never update packages. At a risk of sounding like an old crankster, it is at best even odds that some good will come from updating as it is that a perfectly well-behaved feature will start acting out.
Unfortunately yes, there does seem to be a problem with using the older version - when I came to do more analysis yesterday, the enrichKEGG function didn't work (even though all the other "enrich" functions did). I tried a bunch of other stuff but it only started working when I updated the package.