Answers.Body: <p>Yes this is nothing but a z-score. The scale function calculates column z-scores, but since you use t (transpose), it is actually performed on rows. There are many other ways to calculate z-scores, but if done correctly they will all give the same results.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-16T17:31:02.737Z
Answers.LastActivityDate: 2019-01-16T17:48:33.573Z
Answers.LastEditDate: 2019-01-16T17:48:33.573Z
Answers.UserDisplayName: benn
Body: <p>I have the raw counts for RNA-Seq data. I converted counts data to logCPM using edgeR package.</p>
  
  <p>Lets say I have a dataframe <code>A</code> with 15000 genes as rows and 100 samples as columns with counts data. I have used following code from edgeR tutorial.</p>
  
  <pre><code>logCPM &lt;- cpm(A, prior.count=2, log=TRUE)
  head(logCPM)[1:5,1:5]
                 Sample1          Sample2          Sample3         Sample4
  A1BG          -1.019429        0.8333739        -1.192960       -0.6717287
  A2M            7.622280        7.8057767         7.932570        8.6409077
  A2ML1          1.004541        1.0909119         5.462613        6.4149348
  A4GALT         2.126502        1.8403954         5.322601        2.9469345
  AAAS           5.785888        5.1639501         5.259789        5.3248026
                 Sample5
  A1BG          0.3121975
  A2M           9.1949911
  A2ML1         9.4740594
  A4GALT        2.9214979
  AAAS          4.3708063
  </code></pre>
  
  <p>After converting counts to <code>logCPM</code> I see there is another command for scaling which is used for heatmaps.</p>
  
  <pre><code>logCPM &lt;- t(scale(t(logCPM)))
  </code></pre>
  
  <p>It is given there that <code>scaling each row (each gene) to have mean zero and standard deviation one</code> in page 15 <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4934518/pdf/f1000research-5-9996.pdf" rel="nofollow noreferrer">edgeR</a></p>
  
  <p>Is this nothing but z-score? or Is there any otherway to calculate z-score from logCPM data?</p>
  
  <p>thanq</p>
  
Tags: <r><rna-seq><normalization><edger>
Title: Calculating Z-score from logCPM values using edgeR
ThreadText: # Calculating Z-score from logCPM values using edgeR
  
  (Asked by: username_0 on 2019-01-16)
  
  I have the raw counts for RNA-Seq data. I converted counts data to logCPM using edgeR package.
  
  Lets say I have a dataframe `A` with 15000 genes as rows and 100 samples as columns with counts data. I have used following code from edgeR tutorial.
  
  ```
  logCPM <- cpm(A, prior.count=2, log=TRUE)
  head(logCPM)[1:5,1:5]
                 Sample1          Sample2          Sample3         Sample4
  A1BG          -1.019429        0.8333739        -1.192960       -0.6717287
  A2M            7.622280        7.8057767         7.932570        8.6409077
  A2ML1          1.004541        1.0909119         5.462613        6.4149348
  A4GALT         2.126502        1.8403954         5.322601        2.9469345
  AAAS           5.785888        5.1639501         5.259789        5.3248026
                 Sample5
  A1BG          0.3121975
  A2M           9.1949911
  A2ML1         9.4740594
  A4GALT        2.9214979
  AAAS          4.3708063
  
  ```
  
  After converting counts to `logCPM` I see there is another command for scaling which is used for heatmaps.
  
  ```
  logCPM <- t(scale(t(logCPM)))
  
  ```
  
  It is given there that `scaling each row (each gene) to have mean zero and standard deviation one` in page 15 [edgeR](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4934518/pdf/f1000research-5-9996.pdf)
  
  Is this nothing but z-score? or Is there any otherway to calculate z-score from logCPM data?
  
  thanq
  
  **Tags:** r, rna-seq, normalization, edger
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-01-16. Score: 1 | Accepted answer
  
  Yes this is nothing but a z-score. The scale function calculates column z-scores, but since you use t (transpose), it is actually performed on rows. There are many other ways to calculate z-scores, but if done correctly they will all give the same results.
  
  
  ---
  
  