<p>There are two things that I notice from these plots that are unusual for GSEA analyses that people do:</p>
<ol>
<li><p>The zero cross is at the extreme end of the plot, meaning that <em>all</em> selected genes have a positive test statistic. I think it's a good idea to separate out the positive and negative test statistics (because then the zero point cross is at zero on the Y axis), but other people disagree with me, preferring that the plots show <em>all</em> genes, rather than positive or negative genes. In any case, GSEA seems to work best when the ranked gene list is unfiltered.</p>
</li>
<li><p>The &quot;negative phenotype&quot; plot has an unusual shape, with high enrichment score boosts for what should be low-ranked genes (and, now that I look at it, the first &quot;positive phenotype&quot; plot has similar issues). Most often, I see GSEA plots that have gradually decreasing enrichment score boosts as the graph moves further down the list of genes. The &quot;negative phenotype&quot; plot also doesn't have any sign changes; the bottom bits should be blue, not red, if the flip has been done correctly.</p>
</li>
</ol>
<p>I suspect what's happened here is something like that there is no test statistic in the list of ranked genes, and the gene rank is being used as a distinguishing statistic. For the GSEA to look &quot;normal&quot;, the gene list should have a field that indicates signed difference (e.g. mean expression of mutant minus mean expression of control). With a list presented in this fashion with signed difference, it doesn't really make sense to compare mutant and control phenotypes separately, as the test statistic incorporates both at once.</p>

CC BY-SA 4.0
2021-07-21T10:27:54.600Z
2021-07-21T10:27:54.600Z
gringer
<p>What do you mean by having the same results but <strong>opposite</strong> direction?</p>
<p>What GSEA does is that it goes through the gene list from the top to bottom, whenever it encounters a gene that belongs to a gene set, it adds a positive score to that gene set, and if not, it penalizes the score. That is what you see in the green line in the results.</p>
<p>Now imagine that you reverse the order of your input gene list, it is obvious the results are going to be different if the program still goes through the list from top to bottom.</p>
<p>I think as a general rule, whenever you change the order of input gene list, results are going to be different.</p>

CC BY-SA 4.0
2020-06-25T16:15:01.437Z
There's a misunderstanding. With 2 phenotypes, e.g. Case and Control, the ranking is the opposite, correct. However, I can test Case by looking at genes upregulated using the "Case" ranking (top genes upregulated in Case), or by looking at genes downregulated in Control. GSEA provides the two results for each phenotype (e.g. genes upregulated and downregulated in Case). I understand what the running sum does, and I think the difference in results (for each phenotype, e.g. Case) is due to the nature of the running sum and the leading edge. What I don't understand is which result to consider.
gc5
CC BY-SA 4.0
2020-06-25T16:00:27.100Z
2020-06-25T16:00:27.100Z
Phoenix Mu
<p>I am running an analysis of two phenotypes: mutant and control.</p>
<p>I have a statistic used to rank the different genes, and the ranking is exactly the opposite between mutant and control. Moreover, there are no duplicates in the ranking (which excludes that genes are ranked alphabetically). I uploaded the test file <a href="https://pastebin.com/raw/JKEJ20xF" rel="nofollow noreferrer">here</a>.</p>
<p>My expectation is that running GSEA using mutant as positive phenotype, should give me the same results (but in opposite direction) than running GSEA using control as a positive phenotype - since there are only two phenotypes, and the ranking statistic is computed mutant vs control.</p>
<p>However, when I run Gene Set Enrichment Analysis using mutant as positive phenotype, the results I get are not the same with respect to running GSEA using mutant as negative phenotype.</p>
<p>I initially thought that it might be related to the choice of the random seed, however, I get the same results even setting the same random seed in all runs.</p>
<p>The following is an example of an enriched result of the positive phenotype:</p>
<p><a href="https://i.sstatic.net/ATA63.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ATA63.png" alt="enter image description here" /></a></p>
<p><a href="https://i.sstatic.net/1pBeX.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/1pBeX.png" alt="enter image description here" /></a></p>
<p>The same results with the negative phenotype:</p>
<p><a href="https://i.sstatic.net/ZNitu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZNitu.png" alt="enter image description here" /></a>
<a href="https://i.sstatic.net/dnGFo.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/dnGFo.png" alt="enter image description here" /></a></p>
<p>The ranking is exactly the same, however, the leading edge is different in the two cases. It's probably due to the fact that the ranking sum goes in one direction (increasing the enrichment score) in both phenotypes. This is probably the cause of different scores in the opposite phenotypes, however, which is the result I should use in this case?</p>

CC BY-SA 4.0
2020-06-25T15:32:04.650Z
@ATpoint I have added an example of the results because I think it is useful to identify the issue here. I also added the ranking test file. My code is just the execution of the Broad version of GSEA, I can provide the data if necessary, but I think that the results example I added should be sufficient. Does it work?
gc5
<gsea>
GSEA preranked different results opposing phenotypes
# GSEA preranked different results opposing phenotypes

(Asked by: username_0 on 2020-05-28)

I am running an analysis of two phenotypes: mutant and control.

I have a statistic used to rank the different genes, and the ranking is exactly the opposite between mutant and control. Moreover, there are no duplicates in the ranking (which excludes that genes are ranked alphabetically). I uploaded the test file [here](https://pastebin.com/raw/JKEJ20xF).

My expectation is that running GSEA using mutant as positive phenotype, should give me the same results (but in opposite direction) than running GSEA using control as a positive phenotype - since there are only two phenotypes, and the ranking statistic is computed mutant vs control.

However, when I run Gene Set Enrichment Analysis using mutant as positive phenotype, the results I get are not the same with respect to running GSEA using mutant as negative phenotype.

I initially thought that it might be related to the choice of the random seed, however, I get the same results even setting the same random seed in all runs.

The following is an example of an enriched result of the positive phenotype:

[![enter image description here](https://i.sstatic.net/ATA63.png)](https://i.sstatic.net/ATA63.png)

[![enter image description here](https://i.sstatic.net/1pBeX.png)](https://i.sstatic.net/1pBeX.png)

The same results with the negative phenotype:

[![enter image description here](https://i.sstatic.net/ZNitu.png)](https://i.sstatic.net/ZNitu.png)
[![enter image description here](https://i.sstatic.net/dnGFo.png)](https://i.sstatic.net/dnGFo.png)

The ranking is exactly the same, however, the leading edge is different in the two cases. It's probably due to the fact that the ranking sum goes in one direction (increasing the enrichment score) in both phenotypes. This is probably the cause of different scores in the opposite phenotypes, however, which is the result I should use in this case?

**Tags:** gsea
> **Comments:**
> **username_0**: @ATpoint I have added an example of the results because I think it is useful to identify the issue here. I also added the ranking test file. My code is just the execution of the Broad version of GSEA, I can provide the data if necessary, but I think that the results example I added should be sufficient. Does it work?  

---

## 2 answers

### Answer by username_1 on 2021-07-21. Score: 1

There are two things that I notice from these plots that are unusual for GSEA analyses that people do:

1. The zero cross is at the extreme end of the plot, meaning that *all* selected genes have a positive test statistic. I think it's a good idea to separate out the positive and negative test statistics (because then the zero point cross is at zero on the Y axis), but other people disagree with me, preferring that the plots show *all* genes, rather than positive or negative genes. In any case, GSEA seems to work best when the ranked gene list is unfiltered.
2. The "negative phenotype" plot has an unusual shape, with high enrichment score boosts for what should be low-ranked genes (and, now that I look at it, the first "positive phenotype" plot has similar issues). Most often, I see GSEA plots that have gradually decreasing enrichment score boosts as the graph moves further down the list of genes. The "negative phenotype" plot also doesn't have any sign changes; the bottom bits should be blue, not red, if the flip has been done correctly.

I suspect what's happened here is something like that there is no test statistic in the list of ranked genes, and the gene rank is being used as a distinguishing statistic. For the GSEA to look "normal", the gene list should have a field that indicates signed difference (e.g. mean expression of mutant minus mean expression of control). With a list presented in this fashion with signed difference, it doesn't really make sense to compare mutant and control phenotypes separately, as the test statistic incorporates both at once.


---

### Answer by username_2 on 2020-06-25. Score: 0

What do you mean by having the same results but **opposite** direction?

What GSEA does is that it goes through the gene list from the top to bottom, whenever it encounters a gene that belongs to a gene set, it adds a positive score to that gene set, and if not, it penalizes the score. That is what you see in the green line in the results.

Now imagine that you reverse the order of your input gene list, it is obvious the results are going to be different if the program still goes through the list from top to bottom.

I think as a general rule, whenever you change the order of input gene list, results are going to be different.

> **Comments:**
> **username_0**: There's a misunderstanding. With 2 phenotypes, e.g. Case and Control, the ranking is the opposite, correct. However, I can test Case by looking at genes upregulated using the "Case" ranking (top genes upregulated in Case), or by looking at genes downregulated in Control. GSEA provides the two results for each phenotype (e.g. genes upregulated and downregulated in Case). I understand what the running sum does, and I think the difference in results (for each phenotype, e.g. Case) is due to the nature of the running sum and the leading edge. What I don't understand is which result to consider.  

---

