Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawing multiple enrichment plots on same graph #5

Open
sg3451 opened this issue Sep 20, 2024 · 1 comment
Open

Drawing multiple enrichment plots on same graph #5

sg3451 opened this issue Sep 20, 2024 · 1 comment

Comments

@sg3451
Copy link

sg3451 commented Sep 20, 2024

Wondering if there is a way to plot >1 enrichment plot on the same graph? A use-case is when the same pathway is being compared under two different conditions. If the enrichment plots for the pathway significantly differs between the two conditions, it will be great to visualize it in the same plot. Just a thought. I know the DOSE package has some way of doing this, but it would be great if gggsea can do this also.

@NicolasH2
Copy link
Owner

Hi @sg3451 ,
thanks for reaching out. This is indeed possible with gggsea:

  1. Use the gseaCurve function separately on each of your conditions.
  2. Modify the outcome so that the condition name is part of the pathway name
  3. Combine the data of both conditions and plot the result
# standard procedure, with your conditions being constructed separately
library(gggsea)
library(ggplot2)
setlist <- gggsea::mySetlist
rl1 <- gggsea::myRankedlist #use your condition 1
df1 <- gseaCurve(rl1, setlist)
rl2 <- gggsea::myRankedlist #use your condition 2
df2 <- gseaCurve(rl2, setlist)
#-------------------------------------
# modify the data, so that your condition appears in the pathway name
df1$set <- paste("condition1",df1$set)
df2$set <- paste("condition2",df2$set)
#------------------------------------
# combine and plot
df <- rbind(df1,df2)
ggplot2::ggplot() + 
  geom_gsea(rbind(df))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants