ClusterProfiler enrichKEGG – remove organism name in plots?
2
3
Entering edit mode
11 months ago
Sian ▴ 30

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!

Old Plot

New plot

KEGG ggplot2 enrichKEGG ClusterProfiler • 2.2k views
ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
1
Entering edit mode
11 months ago
jv ★ 1.6k

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\\)"

ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode
11 months ago
e.r.zakiev ▴ 170

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)

ADD COMMENT

Login before adding your answer.

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