Answers.Body: <p>One way to group similar significant pathways, is to quantify how many genes overlap between the pathways, and then use this in clustering (heatmap). I have made a tool in R which calculates the overlap index between GO terms and subsequently clusters them in a heatmap. Overlap index is the fraction of genes that overlap (number between 0-1). Also Pearson correlation can be used for clustering instead of the overlap index. My package (<a href="https://sourceforge.net/projects/gogadget/" rel="nofollow noreferrer">gogadget</a>) works only with  goseq analysis, but you can use <a href="https://bioconductor.org/packages/release/bioc/html/goseq.html" rel="nofollow noreferrer">goseq</a> also for reactome or kegg data.</p>
  
  <p>I have used this overlap clustering approach for different data sets now, and usually we can reduce 200-300 GO terms into 10-20 functional groups.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-12T13:37:31.763Z
Answers.Text: Which overlap index does it use? There are several overlap indices. I would advice against using this approach in GO, there are specific methods to measure how similar two GO terms are. See [GOSemSim](www.bioconductor.org/packages/GOSemSim/).
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-12T14:32:37.053Z
Answers.Text: The overlap index is defined by the number of overlapping genes divided by the number of genes in the smaller of the two gene sets. It is described in [Bioconductor Case studies](http://www-huber.embl.de/pub/pdf/HahneHuberGentlemanFalcon2008.pdf), chapter 13.3. This book is written by big names in bioinformatics (such as R. Gentleman and W. Huber).
Answers.UserDisplayName: benn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-12T14:39:08.600Z
Answers.Text: Thanks for the new overlap index, I didn't knew it. BTW the way these similarity between genes is calculated is using other overlap indexes so this won't help.
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-12T15:53:08.717Z
Answers.Text: Okay, but my point is not about which index to use but the clustering approach (same as [gringer](https://bioinformatics.stackexchange.com/users/73/gringer) is suggesting). If you look in the [userguide](https://sourceforge.net/projects/gogadget/files/gogadget.2.1/) of my package on page 26-28, you'll see a heatmap. Usually I get good results with Ward.D and Euclidean. The tree can be cut in R, but you first might want to see and evaluate which gene sets are clustered together in which branches before you can find the right cutoff.
Answers.UserDisplayName: benn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-14T07:51:18.353Z
Answers.Text: Sorry, my last comment was thinking in another question. Yes, this approach could work
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-12T12:38:49.023Z
Answers.LastActivityDate: 2017-12-12T12:48:53.227Z
Answers.LastEditDate: 2017-12-12T12:48:53.227Z
Answers.UserDisplayName: benn
Answers.Body: <p>This sounds like something that might be amenable to a clustered heatmap plot, or a correlation matrix plot, or something similar. Have you looked at a correlation matrix of the dice coefficient matrix (or maybe just a heatmap plot of that matrix without the correlation matrix)?</p>
  
  <p>The <code>corrplot</code> package looks like it might be useful, in particular <a href="https://cran.r-project.org/web/packages/corrplot/vignettes/corrplot-intro.html" rel="nofollow noreferrer" title="corrplot vignette">the <code>hclust</code> / drawing rectangles presentation</a>.</p>
  
  <p>I can't vouch for this package though; it's just something I found by a search for "R plot correlation matrix".</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-28T10:58:03.200Z
Answers.Text: With a heatmap or a correlation plot I could observe the similarities between the pathways, as I currently do with the dendrogram and the MDS plot. However the question is how to select those more representative pathways. Thanks for your corrections and comments btw.
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-28T10:23:33.793Z
Answers.LastActivityDate: 2017-12-12T12:56:22.340Z
Answers.LastEditDate: 2017-12-12T12:56:22.340Z
Answers.UserDisplayName: gringer
Answers.Body: <p>If you're happy with a more confident ranking of the most representative gene sets, rather than necessarily cutting down the list, you might try EGSEA. It uses an ensemble approach to give a ranking of the most relevant gene sets, and also produces an interactive HTML output with statistics, heatmaps, pathway maps, summary plots and GO graphs which allows you to examine the output at varying levels of granularity. </p>
  
  <p>You can read the paper on <a href="http://biorxiv.org/content/early/2016/07/08/042580" rel="nofollow noreferrer">bioRxiv</a> or download the package from <a href="https://bioconductor.org/packages/release/bioc/html/EGSEA.html" rel="nofollow noreferrer">Bioconductor</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-27T10:48:19.520Z
Answers.Text: The ranking is already done, through the p-value (one could argue that a more elaborated test like the proposed by EGSEA would be better) but this doesn't seem to answer how to select relevant pathways from the output of EGSEA or other software/tools/methods
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-28T10:13:52.747Z
Answers.Text: You shouldn't be ranking by p-value. The p-value is only an indication of whether the observed change is statistically significant, not an indication of the magnitude of the observed change.
Answers.UserDisplayName: gringer
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-27T10:43:34.673Z
Answers.LastActivityDate: 2017-05-27T23:58:34.373Z
Answers.LastEditDate: 2017-05-27T23:58:34.373Z
Answers.UserDisplayName: Scott Gigante
Body: <p>I have perform an enrichment analysis to a cluster of genes. The output is a list of pathways and their p-value (the pathways are selected because p-value &lt; 0.05). The list is still quite long, so I want to reduce it. For that purpose I have a calculated the Dice coefficient of the pathways in a matrix $p$x$p$ where $p$ is the number of pathways in the list. I want both the ones that are more different (they overlap less, their Dice coefficient is lower) and the pathways more representative of the most similar pathways (So if a there is a group of 5 pathways that overlap over 0.8 take just one).</p>
  
  <p>How can I select the most representatives pathways? </p>
  
  <p>There is a similar <a href="http://revigo.irb.hr/" rel="nofollow noreferrer">tool</a> for GO but it relays on discarding not significant GO, while here all the initial pathways are already significant. </p>
  
  <p>If I do a clustering of the pathways using the Dice coefficient matrix I don't know where (or how) to cut.</p>
  
  <p><a href="https://i.sstatic.net/mMdEH.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mMdEH.png" alt="circular dendrogara"></a></p>
  
  <p>I tried using the height to select the pathways. But I am unsure of the interpretation of height. </p>
  
  <p>Some other tools I have seen use a multidimensional scaling plot, but I am not sure if performing it and cutting at certain point of the first dimension would help.
  <a href="https://i.sstatic.net/CeetJ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/CeetJ.png" alt="MDS plot"></a></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-26T19:14:15.453Z
Comments.Text: Are you using p-value < 0.05 or p-value < 0.05 / (# of terms tested)? You'll want to use the former to avoid false positives due to multiple testing
Comments.UserDisplayName: CloudyGloudy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-26T19:16:22.460Z
Comments.Text: I'm guessing you'll have to settle with a "reasonably good" heuristic solution, since there are a few different variables in the problem you're trying to solve (number of pathways in group, desired overlap/distance between pathways, etc.) I can imagine many possible answers.
Comments.UserDisplayName: CloudyGloudy
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-27T09:22:05.180Z
Comments.Text: @CloudyGloudy correcting for multiple testing is already done, sorry I didn't mention it previously. Yes, I was playing with the idea of selecting an overlap/distance of 0.5 and keep those above that, but that would leave outside the pathways that are completely different from the others, but maybe I could select those above 0.75 and those below 0.25
Comments.UserDisplayName: llrs
Tags: <pathway>
Title: How to select the most representative pathways from a gene enrichment analysis?
ThreadText: # How to select the most representative pathways from a gene enrichment analysis?
  
  (Asked by: username_0 on 2017-05-26)
  
  I have perform an enrichment analysis to a cluster of genes. The output is a list of pathways and their p-value (the pathways are selected because p-value < 0.05). The list is still quite long, so I want to reduce it. For that purpose I have a calculated the Dice coefficient of the pathways in a matrix $p$x$p$ where $p$ is the number of pathways in the list. I want both the ones that are more different (they overlap less, their Dice coefficient is lower) and the pathways more representative of the most similar pathways (So if a there is a group of 5 pathways that overlap over 0.8 take just one).
  
  How can I select the most representatives pathways?
  
  There is a similar [tool](http://revigo.irb.hr/) for GO but it relays on discarding not significant GO, while here all the initial pathways are already significant.
  
  If I do a clustering of the pathways using the Dice coefficient matrix I don't know where (or how) to cut.
  
  [![circular dendrogara](https://i.sstatic.net/mMdEH.png)](https://i.sstatic.net/mMdEH.png)
  
  I tried using the height to select the pathways. But I am unsure of the interpretation of height.
  
  Some other tools I have seen use a multidimensional scaling plot, but I am not sure if performing it and cutting at certain point of the first dimension would help.
  [![MDS plot](https://i.sstatic.net/CeetJ.png)](https://i.sstatic.net/CeetJ.png)
  
  **Tags:** pathway
  
  > **Comments:**
  > **username_1**: Are you using p-value < 0.05 or p-value < 0.05 / (# of terms tested)? You'll want to use the former to avoid false positives due to multiple testing  
  > **username_1**: I'm guessing you'll have to settle with a "reasonably good" heuristic solution, since there are a few different variables in the problem you're trying to solve (number of pathways in group, desired overlap/distance between pathways, etc.) I can imagine many possible answers.  
  > **username_0**: @username_1 correcting for multiple testing is already done, sorry I didn't mention it previously. Yes, I was playing with the idea of selecting an overlap/distance of 0.5 and keep those above that, but that would leave outside the pathways that are completely different from the others, but maybe I could select those above 0.75 and those below 0.25  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2017-12-12. Score: 3 | Accepted answer
  
  One way to group similar significant pathways, is to quantify how many genes overlap between the pathways, and then use this in clustering (heatmap). I have made a tool in R which calculates the overlap index between GO terms and subsequently clusters them in a heatmap. Overlap index is the fraction of genes that overlap (number between 0-1). Also Pearson correlation can be used for clustering instead of the overlap index. My package ([gogadget](https://sourceforge.net/projects/gogadget/)) works only with goseq analysis, but you can use [goseq](https://bioconductor.org/packages/release/bioc/html/goseq.html) also for reactome or kegg data.
  
  I have used this overlap clustering approach for different data sets now, and usually we can reduce 200-300 GO terms into 10-20 functional groups.
  
  > **Comments:**
  > **username_0**: Which overlap index does it use? There are several overlap indices. I would advice against using this approach in GO, there are specific methods to measure how similar two GO terms are. See [GOSemSim](www.bioconductor.org/packages/GOSemSim/).  
  > **username_2**: The overlap index is defined by the number of overlapping genes divided by the number of genes in the smaller of the two gene sets. It is described in [Bioconductor Case studies](http://www-huber.embl.de/pub/pdf/HahneHuberGentlemanFalcon2008.pdf), chapter 13.3. This book is written by big names in bioinformatics (such as R. Gentleman and W. Huber).  
  > **username_0**: Thanks for the new overlap index, I didn't knew it. BTW the way these similarity between genes is calculated is using other overlap indexes so this won't help.  
  > **username_2**: Okay, but my point is not about which index to use but the clustering approach (same as [username_3](https://bioinformatics.stackexchange.com/users/73/username_3) is suggesting). If you look in the [userguide](https://sourceforge.net/projects/gogadget/files/gogadget.2.1/) of my package on page 26-28, you'll see a heatmap. Usually I get good results with Ward.D and Euclidean. The tree can be cut in R, but you first might want to see and evaluate which gene sets are clustered together in which branches before you can find the right cutoff.  
  > **username_0**: Sorry, my last comment was thinking in another question. Yes, this approach could work  
  
  ---
  
  ### Answer by username_3 on 2017-05-28. Score: 4
  
  This sounds like something that might be amenable to a clustered heatmap plot, or a correlation matrix plot, or something similar. Have you looked at a correlation matrix of the dice coefficient matrix (or maybe just a heatmap plot of that matrix without the correlation matrix)?
  
  The `corrplot` package looks like it might be useful, in particular [the `hclust` / drawing rectangles presentation](https://cran.r-project.org/web/packages/corrplot/vignettes/corrplot-intro.html "corrplot vignette").
  
  I can't vouch for this package though; it's just something I found by a search for "R plot correlation matrix".
  
  > **Comments:**
  > **username_0**: With a heatmap or a correlation plot I could observe the similarities between the pathways, as I currently do with the dendrogram and the MDS plot. However the question is how to select those more representative pathways. Thanks for your corrections and comments btw.  
  
  ---
  
  ### Answer by username_4 on 2017-05-27. Score: 2
  
  If you're happy with a more confident ranking of the most representative gene sets, rather than necessarily cutting down the list, you might try EGSEA. It uses an ensemble approach to give a ranking of the most relevant gene sets, and also produces an interactive HTML output with statistics, heatmaps, pathway maps, summary plots and GO graphs which allows you to examine the output at varying levels of granularity.
  
  You can read the paper on [bioRxiv](http://biorxiv.org/content/early/2016/07/08/042580) or download the package from [Bioconductor](https://bioconductor.org/packages/release/bioc/html/EGSEA.html).
  
  > **Comments:**
  > **username_0**: The ranking is already done, through the p-value (one could argue that a more elaborated test like the proposed by EGSEA would be better) but this doesn't seem to answer how to select relevant pathways from the output of EGSEA or other software/tools/methods  
  > **username_3**: You shouldn't be ranking by p-value. The p-value is only an indication of whether the observed change is statistically significant, not an indication of the magnitude of the observed change.  
  
  ---
  
  