This is a test version of Biostars. For the public version, visit https://www.biostars.org.
showing specific GO pathways in the dotplot or cnetplot

This clusterprofiler tutorial is very helpful for visualizing the GO pathways and other pathways clusterprofiler. In the dotplot, emapplot or cnetplot there is only way to show top category pathways.

I'm interested to show some specific pathways which means I want to exclude some unimportant pathways among the top categories.

How to do that?

rna-seq r clusterprofiler dotplot goenrichment

2 answers

This has been discussed here. I have modified the code posted by Ming Tang you can plot selected pathway using ggplot2 from the enrichplot result

x <- enrichPathway(gene=de,pvalueCutoff=0.05, readable=T)
y <- as.data.frame(x)
head(y)
ggplot(y[c(1,4,5,7,8),], # you can replace the numbers to the row number of pathway of your interest
             aes(x = GeneRatio, y = Description)) + 
             geom_point(aes(size = GeneRatio, color = p.adjust)) +
             theme_bw(base_size = 14) +
             scale_colour_gradient(limits=c(0, 0.10), low="red") +
             ylab(NULL) +
             ggtitle("GO pathway enrichment")

Excellent.. Thanks a lot for sharing the link and the answer.

Thanks, nice solution! Is there some way to convert the GeneRatio from character (e.g. 23/356) to the result of the formula? I tried with as.numeric(GeneRatio) and as.formula(GeneRatio) but it didn't work.

sapply(strsplit(y$GeneRatio, split = "/"), function(x) as.numeric(x[1]) / as.numeric(x[2]))

Sorry for late reply. This is actually supported, see https://yulab-smu.top/biomedical-knowledge-mining-book/faq.html#showing-specific-pathways.

Log in to answer this question.