Answers.Body: <p>While I'm not familiar with GSEA software in particular, I believe your problem is that it only tests for <em>upregulated</em> gene sets. Notice:  </p>
  
  <blockquote>
    <ul>
    <li>866/4408 gene sets are upregulated   </li>
    <li>3542/4408 gene sets are upregulated  </li>
    </ul>
  </blockquote>
  
  <p>3542+866 = 4408. I.e., 866 sets have higher mean expression in positive condition, the rest have higher mean expression in negative condition. To avoid this confusion, I personally would reserve using the terms "up/down-regulated" only for sets where this change is at least remotely significant.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-11T15:55:23.543Z
Answers.LastActivityDate: 2017-09-11T15:55:23.543Z
Answers.UserDisplayName: juod
Answers.Body: <p>If you compare A vs B the genes's fold change will have the opposite sign to B vs A. So will be the gene set up or down-regulated depending on the comparison to take.</p>
  
  <p>The gene set test analyze if a given group of elements is sorted in a certain way in a list (I am talking about the GSE like the one you performed or the one in the Broad Institute). Usually it is used to say that gene set X is up-regulated in the comparison A vs B, that is, gene set X (in general) is more expressed in A than in B. The enrichment is measured in a enrichment score (or a normalized enrichment score, the higher, the clearer trend/distribution group X has. To asses X is really differentially expressed a p-value is also calculated.</p>
  
  <p>Despite that the number of the up-regulated gene sets sum up all the gene sets tested as pointed by <a href="https://bioinformatics.stackexchange.com/a/2510/48">juod</a>, the number of gene sets with a a p-value below 5% and 1% is not the same in both comparisons which indicates that you are not really using the same samples in both gene sets. </p>
  
  <p>Check how you performed your comparison. Are the genes in each comparison with the same value and opposite sign?<br>
  Check also the software used to run the GSEA analysis (if I recongize the type of report is from a package in Bioconductor [I don't recognize which one now]) as you (or me) might have misunderstood something or there is an error if the comparisons are done properly. For instance it could be that the report of p-values below the threshold would be from only the up-regulated gene sets. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-12T20:29:40.627Z
Answers.Text: Thanks for the answer! I'm still having some trouble, most likely because I'm so new to this. This came from RNAseq data from the same experiment, but there are 3 "PBS-Treated" samples and 3 "CpG-Treated" samples. I'd expect lots of upregulation in the CpG treated samples. 
  In the GSE results, one of the top PBS groups is 'GO_NEGATIVE_REGULATION_OF_B_CELL_ACTIVATION'. This means that particular gene set is enriched in PBS and not in CpG, right? Wouldn't I expect to see B cell activation in the CpG sample, then?
Answers.UserDisplayName: julianstanley
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-12T20:32:07.513Z
Answers.Text: It might make it easier to explain the biological answer I'm looking for. I'd want to be able to say, "When we injected with CpG (as opposed to PBS control), the following gene sets were upregulated:". Is it just that there are no such gene sets?
Answers.UserDisplayName: julianstanley
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T07:05:29.480Z
Answers.Text: @JulianStanley If you use GO as gene sets you don't use the relationship and the structure of the gene ontologies, (use topGO Bioconductor packages that take that into account). I think the GSE is not correctly performed: did you check what I said? But yes GSE will answer this kind of questions when done correctly. See my edit too
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T10:45:31.990Z
Answers.Text: @Llopis I think the key here is to find out which test exactly is performed in that package. Your description sounds like Mann-Whitney or something similar, which I agree should be symmetric. However, I am more used to enrichment testing by Fisher's test (i.e. contingency table "belongs to set-does not" vs. "is upregulated-is not"). Maybe the latter approach doesn't necessarily give symmetric p-values?..
Answers.UserDisplayName: juod
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T10:54:51.603Z
Answers.Text: @juod I agree that knowing which test OP used is important. The Mann-Whitney is different from GSEA in that you don't have up/down-regulated gene sets, but over represented (OR) gene sets. The p-values if it's a OR test won't be symmetric, if it is a GSEA they should.
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T11:40:34.543Z
Answers.Text: Hey all--thanks again for the discussion. I just use GSEA (the software provided by the Broad). With basically default settings--including noise-to-signal stats and I used the GO gene sets from MsigDB. You also said to check that the values are the same but opposite, but I wasn't sure what you meant by that. They're RNAseq counts--so no negative values.
Answers.UserDisplayName: julianstanley
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T11:57:55.867Z
Answers.Text: @JulianStanley Great to know the tool. Did you provide your expression or a sorted list of differentially expressed genes? I said to check the opposite sign thinking you have a fold change or as it is called in the program a sorted list. If you upload the AvsB and the BvsA the same gene set will have the same p-value and different sign, 0.5 to -0.5 normalized enrichment score for instance.
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T11:59:27.680Z
Answers.Text: @Llopis ahh that makes sense! The program did provide me a gene list with enrichment scores, but I didn't know how to interpret it. I just provided my expression (deseq normalized). Notably I also tried AvB and BvA and the results looked the same at first glance
Answers.UserDisplayName: julianstanley
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-13T12:16:58.463Z
Answers.Text: @JulianStanley Great to know that finally it make sense, I'll try to update the answer.  If you have other questions I'll be glad to answer them. Also to mark as solved consider marking one answer as accepted.
Answers.UserDisplayName: llrs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-12T07:08:37.687Z
Answers.LastActivityDate: 2017-09-15T07:04:13.467Z
Answers.LastEditDate: 2017-09-15T07:04:13.467Z
Answers.UserDisplayName: llrs
Body: <p>When I run a GSEA analysis on two conditions from the same RNaseq (negative control PBS injection VS positive control CpG injection) from the same dataset/same gene list, I get results that look something like this:</p>
  
  <p><a href="https://i.sstatic.net/lvm91.jpg" rel="noreferrer"><img src="https://i.sstatic.net/lvm91.jpg" alt="Example GSEA Image"></a></p>
  
  <p>Notice in my example that many gene sets are significantly enriched in PBS VS CpG, but none are very significantly enriched in the inverse, CpG VS PBS.</p>
  
  <p>I have a basic question:</p>
  
  <p>If we're comparing two items, say A and B, shouldn't a up-regulated gene set that's enriched in A have a corresponding down-regulated gene set that's enriched in B?</p>
  
  <p><strong>I'm consistently confused about how to interpret the fact that one of my two conditions has many more enriched gene sets than the other.</strong> What am I missing/misunderstanding?</p>
  
  <p>Thanks!</p>
  
Tags: <rna-seq><gsea><go-enrichment>
Title: Clarification on Gene Enrichment
ThreadText: # Clarification on Gene Enrichment
  
  (Asked by: username_0 on 2017-09-08)
  
  When I run a GSEA analysis on two conditions from the same RNaseq (negative control PBS injection VS positive control CpG injection) from the same dataset/same gene list, I get results that look something like this:
  
  [![Example GSEA Image](https://i.sstatic.net/lvm91.jpg)](https://i.sstatic.net/lvm91.jpg)
  
  Notice in my example that many gene sets are significantly enriched in PBS VS CpG, but none are very significantly enriched in the inverse, CpG VS PBS.
  
  I have a basic question:
  
  If we're comparing two items, say A and B, shouldn't a up-regulated gene set that's enriched in A have a corresponding down-regulated gene set that's enriched in B?
  
  **I'm consistently confused about how to interpret the fact that one of my two conditions has many more enriched gene sets than the other.** What am I missing/misunderstanding?
  
  Thanks!
  
  **Tags:** rna-seq, gsea, go-enrichment
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2017-09-12. Score: 8 | Accepted answer
  
  If you compare A vs B the genes's fold change will have the opposite sign to B vs A. So will be the gene set up or down-regulated depending on the comparison to take.
  
  The gene set test analyze if a given group of elements is sorted in a certain way in a list (I am talking about the GSE like the one you performed or the one in the Broad Institute). Usually it is used to say that gene set X is up-regulated in the comparison A vs B, that is, gene set X (in general) is more expressed in A than in B. The enrichment is measured in a enrichment score (or a normalized enrichment score, the higher, the clearer trend/distribution group X has. To asses X is really differentially expressed a p-value is also calculated.
  
  Despite that the number of the up-regulated gene sets sum up all the gene sets tested as pointed by [username_1](https://bioinformatics.stackexchange.com/a/2510/48), the number of gene sets with a a p-value below 5% and 1% is not the same in both comparisons which indicates that you are not really using the same samples in both gene sets.
  
  Check how you performed your comparison. Are the genes in each comparison with the same value and opposite sign?  
  Check also the software used to run the GSEA analysis (if I recongize the type of report is from a package in Bioconductor [I don't recognize which one now]) as you (or me) might have misunderstood something or there is an error if the comparisons are done properly. For instance it could be that the report of p-values below the threshold would be from only the up-regulated gene sets.
  
  > **Comments:**
  > **username_0**: Thanks for the answer! I'm still having some trouble, most likely because I'm so new to this. This came from RNAseq data from the same experiment, but there are 3 "PBS-Treated" samples and 3 "CpG-Treated" samples. I'd expect lots of upregulation in the CpG treated samples.  In the GSE results, one of the top PBS groups is 'GO_NEGATIVE_REGULATION_OF_B_CELL_ACTIVATION'. This means that particular gene set is enriched in PBS and not in CpG, right? Wouldn't I expect to see B cell activation in the CpG sample, then?  
  > **username_0**: It might make it easier to explain the biological answer I'm looking for. I'd want to be able to say, "When we injected with CpG (as opposed to PBS control), the following gene sets were upregulated:". Is it just that there are no such gene sets?  
  > **username_2**: @JulianStanley If you use GO as gene sets you don't use the relationship and the structure of the gene ontologies, (use topGO Bioconductor packages that take that into account). I think the GSE is not correctly performed: did you check what I said? But yes GSE will answer this kind of questions when done correctly. See my edit too  
  > **username_1**: @Llopis I think the key here is to find out which test exactly is performed in that package. Your description sounds like Mann-Whitney or something similar, which I agree should be symmetric. However, I am more used to enrichment testing by Fisher's test (i.e. contingency table "belongs to set-does not" vs. "is upregulated-is not"). Maybe the latter approach doesn't necessarily give symmetric p-values?..  
  > **username_2**: @username_1 I agree that knowing which test OP used is important. The Mann-Whitney is different from GSEA in that you don't have up/down-regulated gene sets, but over represented (OR) gene sets. The p-values if it's a OR test won't be symmetric, if it is a GSEA they should.  
  > **username_0**: Hey all--thanks again for the discussion. I just use GSEA (the software provided by the Broad). With basically default settings--including noise-to-signal stats and I used the GO gene sets from MsigDB. You also said to check that the values are the same but opposite, but I wasn't sure what you meant by that. They're RNAseq counts--so no negative values.  
  > **username_2**: @JulianStanley Great to know the tool. Did you provide your expression or a sorted list of differentially expressed genes? I said to check the opposite sign thinking you have a fold change or as it is called in the program a sorted list. If you upload the AvsB and the BvsA the same gene set will have the same p-value and different sign, 0.5 to -0.5 normalized enrichment score for instance.  
  > **username_0**: @Llopis ahh that makes sense! The program did provide me a gene list with enrichment scores, but I didn't know how to interpret it. I just provided my expression (deseq normalized). Notably I also tried AvB and BvA and the results looked the same at first glance  
  > **username_2**: @JulianStanley Great to know that finally it make sense, I'll try to update the answer.  If you have other questions I'll be glad to answer them. Also to mark as solved consider marking one answer as accepted.  
  
  ---
  
  ### Answer by username_1 on 2017-09-11. Score: 5
  
  While I'm not familiar with GSEA software in particular, I believe your problem is that it only tests for *upregulated* gene sets. Notice:
  
  > * 866/4408 gene sets are upregulated
  > * 3542/4408 gene sets are upregulated
  
  3542+866 = 4408. I.e., 866 sets have higher mean expression in positive condition, the rest have higher mean expression in negative condition. To avoid this confusion, I personally would reserve using the terms "up/down-regulated" only for sets where this change is at least remotely significant.
  
  
  ---
  
  