This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Enrichment plot in R with custom pathways

Dear all,

I have a file of differentially expressed genes like this which I created myself, with log2foldchange, padj value ad pathway lists.

gene    log2FoldChange  padj    symbol  geneID  PathwayName
ENSG00000005961 2.73694625177063    1.75838486189159e-09    ITGA2B  3674    DAP12 signaling
ENSG00000005961 2.73694625177063    1.75838486189159e-09    ITGA2B  3674    Developmental Biology
ENSG00000005961 2.73694625177063    1.75838486189159e-09    ITGA2B  3674    Dilated cardiomyopathy
ENSG00000005961 2.73694625177063    1.75838486189159e-09    ITGA2B  3674    Disease
ENSG00000007372 8.71303535934225    1.15609406376212e-42    PAX6    5080    Activation of anterior HOX genes in hindbrain development during early embryogenesis
ENSG00000007372 8.71303535934225    1.15609406376212e-42    PAX6    5080    Activation of HOX genes during differentiation
ENSG00000007372 8.71303535934225    1.15609406376212e-42    PAX6    5080    Developmental Biology
ENSG00000007372 8.71303535934225    1.15609406376212e-42    PAX6    5080    Incretin synthesis, secretion, and inactivation
ENSG00000008394 2.63354759009892    6.24693304719323e-06    MGST1   4257    Aflatoxin activation and detoxification
ENSG00000008394 2.63354759009892    6.24693304719323e-06    MGST1   4257    Aflatoxin activation and detoxification
ENSG00000008394 2.63354759009892    6.24693304719323e-06    MGST1   4257    Biological oxidations
ENSG00000008394 2.63354759009892    6.24693304719323e-06    MGST1   4257    Biological oxidations
ENSG00000008394 2.63354759009892    6.24693304719323e-06    MGST1   4257    Chemical carcinogenesis
ENSG00000008394 2.63354759009892    6.24693304719323e-06    MGST1   4257    Chemical carcinogenesis

I would like to plot an enrichment plot for the pathways in my list in R using values of log2foldchange and p-adj values, similar to this one. How to do this? EDIT: I would like to use my custom table in order to calculate the pathway enrichment, not just plot the table. enter image description here.

rnaseq deseq2 enrichplot r

if you clean up your data, you can it easily. with limited data of yours, I could do this with following script:

ggplot(df, aes(log2FoldChange, PathwayName, size=log2FoldChange, color=gene))+
    geom_point()

enter image description here

2 answers

ggplot2 gives you all the arrows you need.

library(ggplot2)
ggplot(yourDF, aes(PathwayName,log2FoldChange, fill=padj)) +
    geom_point(stat = "identity") + 
    scale_fill_gradient( low="blue", high="red" ) +
    labs(y = "log2Fold", x='')  +
    coord_flip()

Check the dotplot() function in the enrichplot Bioconductor package. See example in the Biomedical Knowledge Mining book.

Thanks a lot. This does not work with a data.frame although, right?

Indeed but as pointed out in the other answers, this can also be easily accomplished with ggplot. Alternatively, enrichPlot(..., type = "dot") takes a data frame similar to the one produced by the getEnrich() function.

Log in to answer this question.