Answers.Body: <p>The scenario you described would be reported by the code because:</p>
  <pre><code>... [abs(geneList) &gt; 2]
  </code></pre>
  <p>The <code>abs</code> will change any negative value to positive and retain all positive values as positive. Therefore values &lt;-2 will be reported as well as values &gt;2. <code>abs</code> = absolute and to take the absolute value of a number is exactly the operation just described.</p>
  <hr />
  <p>From comments. Just remove <code>abs</code></p>
  <pre><code>negative &lt;- names(geneList)[geneList &lt; -2]
  positive &lt;- names(geneList)[geneList &gt; 2]
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-06T22:25:34.013Z
Answers.Text: Thank you for your feedback M__. Yes, this operation selects all genes with >2 and all genes with <-2 fold change in expression. However, none of the values are themselves retained. It is only the names of the genes that are taken forward to the next step. Therefore, the direction (- or +) is lost after this step. In other words, if you have gene A +8 fold change, gene B +3 and gene C +2.4, then the end result is the same if gene A had been -6.2 fold change, gene B -2.4 and gene C +2.1. I suppose I conclude that we are looking at *representation*, rather than at up/downregulated pathways?
Answers.UserDisplayName: Sylvia Rodriguez
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-07T03:02:40.107Z
Answers.Text: @SylviaRodriguez addressed in the comments
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-08T21:38:35.727Z
Answers.Text: Thank you. I like that solution. Two separate analyses.
Answers.UserDisplayName: Sylvia Rodriguez
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-08T21:45:08.433Z
Answers.Text: Thanks @SylviaRodriguez I'm glad its resolved.
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-08-06T22:10:33.040Z
Answers.LastActivityDate: 2023-08-07T03:02:23.450Z
Answers.LastEditDate: 2023-08-07T03:02:23.450Z
Answers.UserDisplayName: M__
Body: <p>I am using clusterProfiler for differential gene expression using this code:
  <a href="https://yulab-smu.top/biomedical-knowledge-mining-book/enrichplot.html" rel="nofollow noreferrer">https://yulab-smu.top/biomedical-knowledge-mining-book/enrichplot.html</a></p>
  <p>I have a question about the third line of code:</p>
  <pre><code> de &lt;- names(geneList)[abs(geneList) &gt; 2]
  </code></pre>
  <p>Here all gene names are taken with absolute fold change &gt;2. As an example, if in a hypothetical extreme case you have 100 downregulated genes (log2 fold change &lt;-2) and zero upregulated genes (log2 fold change &gt;2), then you may incorrectly think that identified pathways are activated, but they are actually repressed. How is this accounted for? Thank you.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-06T22:08:34.790Z
Comments.Text: Hypothetical scenarios don't make the best questions, but this question's ok. Do keep in mind this is differential gene expression rather than explicitly being repression (don't always intersect).
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-08-06T22:26:44.880Z
Comments.Text: I agree with you :)
Comments.UserDisplayName: Sylvia Rodriguez
Tags: <r><differential-expression><gene-expression><pathway><clusterprofiler>
Title: Interpretation of clusterProfiler results
ThreadText: # Interpretation of clusterProfiler results
  
  (Asked by: username_0 on 2023-08-06)
  
  I am using clusterProfiler for differential gene expression using this code:
  <https://yulab-smu.top/biomedical-knowledge-mining-book/enrichplot.html>
  
  I have a question about the third line of code:
  
  ```
   de <- names(geneList)[abs(geneList) > 2]
  
  ```
  
  Here all gene names are taken with absolute fold change >2. As an example, if in a hypothetical extreme case you have 100 downregulated genes (log2 fold change <-2) and zero upregulated genes (log2 fold change >2), then you may incorrectly think that identified pathways are activated, but they are actually repressed. How is this accounted for? Thank you.
  
  **Tags:** r, differential-expression, gene-expression, pathway, clusterprofiler
  
  > **Comments:**
  > **username_1**: Hypothetical scenarios don't make the best questions, but this question's ok. Do keep in mind this is differential gene expression rather than explicitly being repression (don't always intersect).  
  > **username_0**: I agree with you :)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-08-06. Score: 1 | Accepted answer
  
  The scenario you described would be reported by the code because:
  
  ```
  ... [abs(geneList) > 2]
  
  ```
  
  The `abs` will change any negative value to positive and retain all positive values as positive. Therefore values <-2 will be reported as well as values >2. `abs` = absolute and to take the absolute value of a number is exactly the operation just described.
  
  ---
  
  From comments. Just remove `abs`
  
  ```
  negative <- names(geneList)[geneList < -2]
  positive <- names(geneList)[geneList > 2]
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you for your feedback M__. Yes, this operation selects all genes with >2 and all genes with <-2 fold change in expression. However, none of the values are themselves retained. It is only the names of the genes that are taken forward to the next step. Therefore, the direction (- or +) is lost after this step. In other words, if you have gene A +8 fold change, gene B +3 and gene C +2.4, then the end result is the same if gene A had been -6.2 fold change, gene B -2.4 and gene C +2.1. I suppose I conclude that we are looking at *representation*, rather than at up/downregulated pathways?  
  > **username_1**: @username_0 addressed in the comments  
  > **username_0**: Thank you. I like that solution. Two separate analyses.  
  > **username_1**: Thanks @username_0 I'm glad its resolved.  
  
  ---
  
  