Answers.Body: <p>FPKM are inherently experiment specific and can not be used to compare across samples. Let's consider the following two sequencing runs. Let <span class="math-container">$E1$</span> and <span class="math-container">$E2$</span> be the true, underlying expression in two samples of genes 1-6. Let <span class="math-container">$S1$</span> and <span class="math-container">$S2$</span> be the observed expression in our sequencing.</p>
  <p><span class="math-container">$$
  \begin{matrix}
  Gene &amp; E1 &amp; S1 &amp; E2 &amp; S2 \\
    G1 &amp; 100 &amp; 10 &amp; 100 &amp; 20 \\
    G2 &amp; 100 &amp; 10 &amp; 100 &amp; 20 \\
    G3 &amp; 100 &amp; 10 &amp; 100 &amp; 20 \\
    G4 &amp; 100 &amp; 10 &amp; 0 &amp; 0 \\
    G5 &amp; 100 &amp; 10 &amp; 0 &amp; 0 \\
    G6 &amp; 100 &amp; 10 &amp; 0 &amp; 0 \\
  \end{matrix}
  $$</span></p>
  <p>Our totals are 60 counts for <span class="math-container">$S1$</span> and 60 for <span class="math-container">$S2$</span>. We sequenced both libraries to the same depth, but as there are fewer genes expressed in <span class="math-container">$E2$</span>, we just naturally capture the genes that are expressed more often. For simplicity's sake, let's assume the genes all have the same length of 1, so we ignore the &quot;K&quot; in FPKM. Let's also forget the scaling by a million, since that's just to make nice numbers:</p>
  <p><span class="math-container">$$
  \begin{matrix}
  Gene &amp; E1 &amp; S1 &amp; E2 &amp; S2 \\
    G1 &amp; 100 &amp; 0.167 &amp; 100 &amp; 0.333 \\
    G2 &amp; 100 &amp; 0.167 &amp; 100 &amp; 0.333 \\
    G3 &amp; 100 &amp; 0.167 &amp; 100 &amp; 0.333 \\
    G4 &amp; 100 &amp; 0.167 &amp; 0 &amp; 0 \\
    G5 &amp; 100 &amp; 0.167 &amp; 0 &amp; 0 \\
    G6 &amp; 100 &amp; 0.167 &amp; 0 &amp; 0 \\
  \end{matrix}
  $$</span></p>
  <p>Now let's calculate size factors. In DESeq2, we create a pseudo-sample which is the geometric mean of all counts of each gene, so <span class="math-container">$\sqrt{10 \cdot 20} = 14.14$</span> for genes 1-3 and genes 3-6 are ignored as they have a member with 0-valued counts. The size factor for each library is the median ratio for each library compared to that pseudo-sample:</p>
  <p><span class="math-container">$$
  med([\frac{10}{14.14}, \frac{10}{14.14}, \frac{10}{14.14}) = 0.71
  $$</span></p>
  <p><span class="math-container">$$
  med([\frac{20}{14.14}, \frac{20}{14.14}, \frac{20}{14.14}]) = 1.41
  $$</span></p>
  <p>So where do we end up if we divide by the size factors?</p>
  <p><span class="math-container">$$
  \begin{matrix}
  Gene &amp; E1 &amp; S1 &amp; E2 &amp; S2 \\
    G1 &amp; 100 &amp; 141 &amp; 100 &amp; 142 \\
    G2 &amp; 100 &amp; 141 &amp; 100 &amp; 142 \\
    G3 &amp; 100 &amp; 141 &amp; 100 &amp; 142 \\
    G4 &amp; 100 &amp; 141 &amp; 0 &amp; 0 \\
    G5 &amp; 100 &amp; 141 &amp; 0 &amp; 0 \\
    G6 &amp; 100 &amp; 141 &amp; 0 &amp; 0 \\
  \end{matrix}
  $$</span></p>
  <p>So in this simple example, size factors produce a better estimate than FPKM or TPM to compare values <em>across experiments</em>, hence the &quot;robustness&quot;. Please note that this is still not great for any statistical testing, and in general should be used with caution anywhere.</p>
  <p>Finally, I'll leave some more reading material concerning FPKMs and cross-sample comparisons here:</p>
  <ul>
  <li>[1] Dillies M.A., Briefings in Bioinf. 2012</li>
  <li>[2] Soneson &amp; Delorenzi, BMC Bioinf. 2013</li>
  <li>[3] Lior Pachter’s lecture at CSHL (Cold Spring Harbour Laboratory) from minutes 32 on: <a href="https://www.youtube.com/watch?v=5NiFibnbE8o&amp;t=32m" rel="noreferrer">https://www.youtube.com/watch?v=5NiFibnbE8o&amp;t=32m</a></li>
  <li>[4] From Answer: &quot;Over-correction&quot; in the size-factors of the DESeq2 package: <a href="https://support.bioconductor.org/p/80733/#80736" rel="noreferrer">https://support.bioconductor.org/p/80733/#80736</a></li>
  <li>[5] <a href="http://www.biomedcentral.com/1471-2105/14/370" rel="noreferrer">http://www.biomedcentral.com/1471-2105/14/370</a></li>
  <li>[6] <a href="https://liorpachter.wordpress.com/2014/04/30/estimating-number-of-transcripts-from-rna-seq-measurements-and-why-i-believe-in-paywall/" rel="noreferrer">https://liorpachter.wordpress.com/2014/04/30/estimating-number-of-transcripts-from-rna-seq-measurements-and-why-i-believe-in-paywall/</a></li>
  <li>[7] <a href="http://rnajournal.cshlp.org/content/22/6/839" rel="noreferrer">http://rnajournal.cshlp.org/content/22/6/839</a></li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-28T02:03:43.363Z
Answers.Text: Great explanation. Those would be normalized counts and I get why they make sense. But this does not really answer the question of why mix normalization and FPKMs.
Answers.UserDisplayName: burger
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-28T13:08:32.230Z
Answers.Text: Right, maybe the point I was trying to make wasn't exactly clear. The "M" in FPKM is attempting to correct for library size, but simply taking the column sums is too naive of an approach. Using size factors as a library size estimate is a more robust way to calculate that (hence the name of the option). It's not really mixed, it just replaces what's used as the library size term in the formula, since the default is inadequate in many respects.
Answers.UserDisplayName: Bastian Schiffthaler
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-27T07:23:12.487Z
Answers.LastActivityDate: 2020-10-27T07:23:12.487Z
Answers.UserDisplayName: Bastian Schiffthaler
Body: <p>Both DESeq2 and edgeR have an FPKM/RPKM function that by default uses normalized library sizes (&quot;robust&quot; option in DESeq2). FPKMs have their own issues, but I thought the main benefit was to have comparable units across independent experiments. If you are adding an experiment-specific normalization factor, then why even use FPKMs?</p>
  
Tags: <rna-seq><deseq2><edger><fpkm>
Title: Why use "robust" FPKMs?
ThreadText: # Why use "robust" FPKMs?
  
  (Asked by: username_0 on 2020-10-27)
  
  Both DESeq2 and edgeR have an FPKM/RPKM function that by default uses normalized library sizes ("robust" option in DESeq2). FPKMs have their own issues, but I thought the main benefit was to have comparable units across independent experiments. If you are adding an experiment-specific normalization factor, then why even use FPKMs?
  
  **Tags:** rna-seq, deseq2, edger, fpkm
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-10-27. Score: 5
  
  FPKM are inherently experiment specific and can not be used to compare across samples. Let's consider the following two sequencing runs. Let $E1$ and $E2$ be the true, underlying expression in two samples of genes 1-6. Let $S1$ and $S2$ be the observed expression in our sequencing.
  
  $$
  \begin{matrix}
  Gene & E1 & S1 & E2 & S2 \\
  G1 & 100 & 10 & 100 & 20 \\
  G2 & 100 & 10 & 100 & 20 \\
  G3 & 100 & 10 & 100 & 20 \\
  G4 & 100 & 10 & 0 & 0 \\
  G5 & 100 & 10 & 0 & 0 \\
  G6 & 100 & 10 & 0 & 0 \\
  \end{matrix}
  $$
  
  Our totals are 60 counts for $S1$ and 60 for $S2$. We sequenced both libraries to the same depth, but as there are fewer genes expressed in $E2$, we just naturally capture the genes that are expressed more often. For simplicity's sake, let's assume the genes all have the same length of 1, so we ignore the "K" in FPKM. Let's also forget the scaling by a million, since that's just to make nice numbers:
  
  $$
  \begin{matrix}
  Gene & E1 & S1 & E2 & S2 \\
  G1 & 100 & 0.167 & 100 & 0.333 \\
  G2 & 100 & 0.167 & 100 & 0.333 \\
  G3 & 100 & 0.167 & 100 & 0.333 \\
  G4 & 100 & 0.167 & 0 & 0 \\
  G5 & 100 & 0.167 & 0 & 0 \\
  G6 & 100 & 0.167 & 0 & 0 \\
  \end{matrix}
  $$
  
  Now let's calculate size factors. In DESeq2, we create a pseudo-sample which is the geometric mean of all counts of each gene, so $\sqrt{10 \cdot 20} = 14.14$ for genes 1-3 and genes 3-6 are ignored as they have a member with 0-valued counts. The size factor for each library is the median ratio for each library compared to that pseudo-sample:
  
  $$
  med([\frac{10}{14.14}, \frac{10}{14.14}, \frac{10}{14.14}) = 0.71
  $$
  
  $$
  med([\frac{20}{14.14}, \frac{20}{14.14}, \frac{20}{14.14}]) = 1.41
  $$
  
  So where do we end up if we divide by the size factors?
  
  $$
  \begin{matrix}
  Gene & E1 & S1 & E2 & S2 \\
  G1 & 100 & 141 & 100 & 142 \\
  G2 & 100 & 141 & 100 & 142 \\
  G3 & 100 & 141 & 100 & 142 \\
  G4 & 100 & 141 & 0 & 0 \\
  G5 & 100 & 141 & 0 & 0 \\
  G6 & 100 & 141 & 0 & 0 \\
  \end{matrix}
  $$
  
  So in this simple example, size factors produce a better estimate than FPKM or TPM to compare values *across experiments*, hence the "robustness". Please note that this is still not great for any statistical testing, and in general should be used with caution anywhere.
  
  Finally, I'll leave some more reading material concerning FPKMs and cross-sample comparisons here:
  
  * [1] Dillies M.A., Briefings in Bioinf. 2012
  * [2] Soneson & Delorenzi, BMC Bioinf. 2013
  * [3] Lior Pachter’s lecture at CSHL (Cold Spring Harbour Laboratory) from minutes 32 on: <https://www.youtube.com/watch?v=5NiFibnbE8o&t=32m>
  * [4] From Answer: "Over-correction" in the size-factors of the DESeq2 package: <https://support.bioconductor.org/p/80733/#80736>
  * [5] <http://www.biomedcentral.com/1471-2105/14/370>
  * [6] <https://liorpachter.wordpress.com/2014/04/30/estimating-number-of-transcripts-from-rna-seq-measurements-and-why-i-believe-in-paywall/>
  * [7] <http://rnajournal.cshlp.org/content/22/6/839>
  
  > **Comments:**
  > **username_0**: Great explanation. Those would be normalized counts and I get why they make sense. But this does not really answer the question of why mix normalization and FPKMs.  
  > **username_1**: Right, maybe the point I was trying to make wasn't exactly clear. The "M" in FPKM is attempting to correct for library size, but simply taking the column sums is too naive of an approach. Using size factors as a library size estimate is a more robust way to calculate that (hence the name of the option). It's not really mixed, it just replaces what's used as the library size term in the formula, since the default is inadequate in many respects.  
  
  ---
  
  