GuangchuangYu / doseplot

Before there was enrichplot
2 stars 2 forks source link

Could we have cnetplot but for selected pathways from MSigDB? Not pathways from GSEA result. #3

Closed Chrisdoan9 closed 2 months ago

Chrisdoan9 commented 2 months ago

Hi team,

Because the cnetplot looks so nice, so I try to make this plot but the pathways I would like to visualize is not from GSEA or ORA result. They are pathways I am interested from MSigDB. Is it possible to make plot like cnetplot for pathways not from GSEA or ORA result? I tried an alternative way with igraph package but the plot doesn't look very nice. Thank you so much!

GuangchuangYu commented 2 months ago

I would recommend using the enrichplot package.

Chrisdoan9 commented 2 months ago

Hi Guangchuang,

May I know which function in enrichplot you recommend? Because cnetplot is one of the function in enrichplot. From the vignette, the pathways visualized are top pathways that enrich but seem I can't choose a pathway from MSigDB to visualize. An example of pathway from MsigDb in this format: COULOUARN_TEMPORAL_TGFB1_SIGNATURE_UP and pathways from enrichplot don't have underscore with upercase. I tried other network visualization tools like cytoscape, IPA giagen, metascape but they don't have option so visualize a pathway from MSigDb. There are tools like fgsea or gsva use pathways from MsigDb but they don't have function to visualize genes from MSigDB pathways as a network. Igraph package allows customize any genes, pathways but the plot is not look so great. Thank you!

Update. I can make cnetplot plot with pathways from MSigDb but got this error:

gene <- bitr(gene, fromType = "SYMBOL", toType = "ENTREZID", OrgDb = org.Hs.eg.db)$ENTREZID
m_t2g <- msigdbr(species = "Homo sapiens", category = "C2") %>% 
  dplyr::select(gs_name, entrez_gene)
x <- enricher(gene, TERM2GENE = m_t2g)
cnetplot(x, showCategory = c("COULOUARN_TEMPORAL_TGFB1_SIGNATURE_UP", "BIOCARTA_IL12_PATHWAY")) +
+   theme_minimal() +
+   theme(axis.text.x = element_text(angle = 45, hjust = 1))
Error in graph.data.frame(x, directed = FALSE) : 
  the data frame should contain at least two columns

The pathways I would like to visualize show in description column of x@result. There is no error if I don't select pathways of interested.

cnetplot(x) +
+   theme_minimal() +
+   theme(axis.text.x = element_text(angle = 45, hjust = 1))

I figured it out. Thank you!