<p>PCA works best when the input data is approximately normally distributed on each dimension. It would be a good idea to do some initial data quality checks to verify that this is the case (and transform the data appropriately if not), or at least verify that the data is approximately normally distributed in the aggregate.</p>

<p>For looking at Illumina RNASeq data, what worked best for me (i.e. produced the most normal-looking data) was the following steps:</p>

<ol>
<li>Removing genes that had low raw counts in all samples</li>
<li>Using DESeq's variance-stabilized transform (which transforms counts into a log-like distribution)</li>
<li>Further normalising the VST values by dividing by the longest transcript length within each gene (which I call VSTPk)</li>
</ol>

<p>These steps are stated in a bit more detail in our Th2 paper that was published at the end of last year:</p>

<p><a href="http://jem.rupress.org/content/early/2016/12/01/jem.20160470#materials-methods" rel="nofollow noreferrer">http://jem.rupress.org/content/early/2016/12/01/jem.20160470#materials-methods</a></p>

CC BY-SA 3.0
2017-08-18T11:17:31.007Z
Given that I'm working with bacteria I will probably need to skip step 3. Thanks for the insight!
mgalardini
CC BY-SA 3.0
2017-08-18T12:07:24.507Z
Do you have a reference for the claim that PCA assumes normality, because its not something I've come across before, and indeed, many sources say it is not. e.g. https://stats.stackexchange.com/questions/32105/pca-of-non-gaussian-data
Ian Sudbery
CC BY-SA 3.0
2017-08-18T21:19:32.953Z
I'll preface this with "I am not a statistician", and am basing this on my memories of conversations I had with a biostatistician I worked with. The [operations carried out for a PCA](http://www.datasciencecentral.com/profiles/blogs/introduction-to-principal-component-analysis) assume that things like mean and variance and euclidean distance work normally and predictably; a grossly non-normal distribution can affect this. PCA is fairly robust to non-normal distributions, but not completely immune.
gringer
CC BY-SA 3.0
2017-08-18T11:13:10.100Z
2017-08-18T21:13:03.153Z
2017-08-18T21:13:03.153Z
gringer
<p>tldr: log transform counts and TPMs, but rlog/vst are preferred</p>

<p>TPM should be log transformed to get more useful results. If you're using DESeq2 already (given the reference to <code>rlog</code> and <code>vst</code>, this seems likely), then please go ahead and use <code>rlog</code> or <code>vst</code>. That will give you more reasonable results than raw counts. If you're stuck with counts for some reason, then first use normalized counts so they're at least a bit more comparable and then log transform them so your highly expressed genes aren't driving everything.</p>

<p><strong>Edit</strong>: As an aside, if you know what the batch effect is (e.g., library prep. date), it's sometimes convenient to include that in your model. You can then assess the genes that are actually changed due to that, which is sometimes handy to know (e.g., which genes might be more/less prone to degradation).</p>

CC BY-SA 3.0
2017-08-18T10:20:16.640Z
by "normalized counts" you mean something like quantile-normalization or batch-effect removal?
mgalardini
CC BY-SA 3.0
2017-08-18T10:55:13.333Z
@mgalardini Quantile normalized, or whatever method you prefer (e.g., the ones use by default be DESeq2/edgeR/limma).
Devon Ryan
CC BY-SA 3.0
2017-08-18T10:17:53.487Z
2017-08-18T10:57:03.527Z
2017-08-18T10:57:03.527Z
Devon Ryan
<p>I'm trying to understand the magnitude of batch effects in my RNA-seq samples, and I was wondering which expression units are more suitable to draw a PCA. I'm thinking of either <code>counts</code> or <code>TPM</code>, but things like <a href="http://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#data-transformations-and-visualization" rel="noreferrer"><code>rlog</code> or <code>vst</code></a> could work too.</p>

<p>Additionally, I'm wondering whether either of this units should be log-transformed first, to avoid high-abundance transcripts driving the PCA.</p>

<rna-seq>
Which measure should be used in a PCA or RNA-seq data? TPM or counts?
# Which measure should be used in a PCA or RNA-seq data? TPM or counts?

(Asked by: username_0 on 2017-08-18)

I'm trying to understand the magnitude of batch effects in my RNA-seq samples, and I was wondering which expression units are more suitable to draw a PCA. I'm thinking of either `counts` or `TPM`, but things like [`rlog` or `vst`](http://bioconductor.org/packages/devel/bioc/vignettes/DESeq2/inst/doc/DESeq2.html#data-transformations-and-visualization) could work too.

Additionally, I'm wondering whether either of this units should be log-transformed first, to avoid high-abundance transcripts driving the PCA.

**Tags:** rna-seq

---

## 2 answers

### Answer by username_3 on 2017-08-18. Score: 5 | Accepted answer

tldr: log transform counts and TPMs, but rlog/vst are preferred

TPM should be log transformed to get more useful results. If you're using DESeq2 already (given the reference to `rlog` and `vst`, this seems likely), then please go ahead and use `rlog` or `vst`. That will give you more reasonable results than raw counts. If you're stuck with counts for some reason, then first use normalized counts so they're at least a bit more comparable and then log transform them so your highly expressed genes aren't driving everything.

**Edit**: As an aside, if you know what the batch effect is (e.g., library prep. date), it's sometimes convenient to include that in your model. You can then assess the genes that are actually changed due to that, which is sometimes handy to know (e.g., which genes might be more/less prone to degradation).

> **Comments:**
> **username_0**: by "normalized counts" you mean something like quantile-normalization or batch-effect removal?  
> **username_3**: @mgalardini Quantile normalized, or whatever method you prefer (e.g., the ones use by default be DESeq2/edgeR/limma).  

---

### Answer by username_1 on 2017-08-18. Score: 4

PCA works best when the input data is approximately normally distributed on each dimension. It would be a good idea to do some initial data quality checks to verify that this is the case (and transform the data appropriately if not), or at least verify that the data is approximately normally distributed in the aggregate.

For looking at Illumina RNASeq data, what worked best for me (i.e. produced the most normal-looking data) was the following steps:

1. Removing genes that had low raw counts in all samples
2. Using DESeq's variance-stabilized transform (which transforms counts into a log-like distribution)
3. Further normalising the VST values by dividing by the longest transcript length within each gene (which I call VSTPk)

These steps are stated in a bit more detail in our Th2 paper that was published at the end of last year:

<http://jem.rupress.org/content/early/2016/12/01/jem.20160470#materials-methods>

> **Comments:**
> **username_0**: Given that I'm working with bacteria I will probably need to skip step 3. Thanks for the insight!  
> **username_2**: Do you have a reference for the claim that PCA assumes normality, because its not something I've come across before, and indeed, many sources say it is not. e.g. https://stats.stackexchange.com/questions/32105/pca-of-non-gaussian-data  
> **username_1**: I'll preface this with "I am not a statistician", and am basing this on my memories of conversations I had with a biostatistician I worked with. The [operations carried out for a PCA](http://www.datasciencecentral.com/profiles/blogs/introduction-to-principal-component-analysis) assume that things like mean and variance and euclidean distance work normally and predictably; a grossly non-normal distribution can affect this. PCA is fairly robust to non-normal distributions, but not completely immune.  

---

