Tutorials › High-Dimensional Genomic Data Analysis › Why Library-Size Scaling Can Fail

Count-Based Differential Expression for RNA-seq · Tutorial 421 of 795

Why Library-Size Scaling Can Fail

Learn why total-count scaling can confuse sequencing depth with RNA composition, and how that can bias gene-level comparisons.

Intermediate 11 min read

What You'll Learn

  • Distinguish sequencing depth from the composition of a library.
  • Derive how a composition shift changes a gene’s expected normalized count.
  • Calculate the bias caused by a highly expressed gene using hypothetical counts.
  • Identify assumptions required for total-count offsets to support comparisons.
  • Recognize diagnostics, alternative approaches, and limits of count-only data.

Why Total Counts Can Mislead

A library-size offset corrects for differences in the number of reads available across RNA-seq samples. This correction is useful when a larger library reflects greater sequencing depth and the libraries have broadly comparable RNA composition. But the total number of reads assigned to a sample is not a pure measure of sequencing depth: it can also change because a small number of transcripts occupy a larger share of the reads.

This distinction matters because sequencing counts describe the allocation of reads among transcripts. If a few genes become much more abundant, they can take up a larger fraction of a fixed number of reads. Other genes may then receive fewer reads even if their abundance has not changed. Conversely, if a library contains more reads overall because it was sequenced more deeply, counts may rise across genes without any biological expression change. Total-count scaling can fail when it treats these different situations as though they were the same.

Definition: For sample \(j\), let \(Y_{gj}\) be the observed read count for gene \(g\), and let \(L_j=\sum_g Y_{gj}\) be the total count across genes included in the library. Total-count scaling uses \(L_j\), or a quantity proportional to it, as an exposure in a count model. It is reliable as a depth correction when library totals are comparable measures of sequencing depth and RNA composition is sufficiently similar across samples. It can bias comparisons when composition changes substantially.

In the log-linked count model introduced in the earlier material on library sizes as offsets, the offset is fixed rather than estimated as a gene-specific effect. A simplified expression is \(\log(\mu_{gj})=\log(L_j)+\eta_{gj}\), where \(\mu_{gj}\) is the expected count and \(\eta_{gj}\) contains the gene and sample effects of interest. The offset accounts for library size, but it does not itself determine whether \(L_j\) represents depth alone or depth entangled with a compositional shift.

The Compositional Mechanism

Let \(M_{gj}\) denote the amount of RNA from gene \(g\) in sample \(j\), and let \(M_{\cdot j}=\sum_g M_{gj}\) be the total RNA amount represented in the sample. Under a simple sampling model, a read from sample \(j\) comes from gene \(g\) with probability \(p_{gj}=M_{gj}/M_{\cdot j}\). If \(D_j\) reads are sampled, then the expected count is \(E(Y_{gj})=D_jp_{gj}\). The observed library total \(L_j\) is approximately the read depth \(D_j\), but the proportion of those reads assigned to a gene depends on the entire RNA composition.

After dividing by the library total, the expected normalized count is approximately \(p_{gj}\), not the absolute amount \(M_{gj}\). For two samples, the ratio of expected normalized counts is therefore approximately \(\frac{p_{gB}}{p_{gA}}=\frac{M_{gB}}{M_{gA}}\frac{M_{\cdot A}}{M_{\cdot B}}\). If a gene’s amount stays constant while total RNA doubles, its relative share is halved. A normalization that interprets that halving as a gene-specific decrease will report a misleading comparison if the scientific target is unchanged absolute abundance.

$$ \frac{E(Y_{gB}/L_B)}{E(Y_{gA}/L_A)} \approx \frac{p_{gB}}{p_{gA}} = \frac{M_{gB}}{M_{gA}} \frac{M_{\cdot A}}{M_{\cdot B}} $$

This relationship is a consequence of sampling proportions. Since \(E(Y_{gj})=D_jp_{gj}\) and \(L_j\) is approximately \(D_j\), dividing expected counts by library size leaves approximately \(p_{gj}\). Substituting \(p_{gj}=M_{gj}/M_{\cdot j}\) for each sample and taking their ratio gives the displayed expression. When \(M_{gB}=M_{gA}\) but \(M_{\cdot B}=2M_{\cdot A}\), the normalized-count ratio is approximately \(1/2\), even though the gene’s amount did not change.

Worked Example: One Dominant Gene Changes the Offset Comparison

Consider two hypothetical samples. In sample A, the RNA amounts are 800,000 molecules for a highly expressed gene, 1,000 for a gene of interest, and 199,000 for all remaining genes combined. In sample B, the corresponding amounts are 1,800,000, 1,000, and 199,000 molecules. The gene of interest is unchanged, while the highly expressed gene has increased substantially. Suppose sample A is sequenced to 100,000 reads and sample B to 200,000 reads.

The total RNA amounts are \(M_{\cdot A}=800{,}000+1{,}000+199{,}000=1{,}000{,}000\) and \(M_{\cdot B}=1{,}800{,}000+1{,}000+199{,}000=2{,}000{,}000\). Thus the gene of interest has relative abundances \(1{,}000/1{,}000{,}000=0.001\) and \(1{,}000/2{,}000{,}000=0.0005\).

The expected counts for that gene are \(100{,}000(0.001)=100\) reads in sample A and \(200{,}000(0.0005)=100\) reads in sample B. The total counts are 100,000 and 200,000, respectively. Total-count scaling gives normalized counts \(100/100{,}000=0.001\) and \(100/200{,}000=0.0005\). Their ratio is \(0.0005/0.001=0.5\), corresponding to an apparent twofold decrease after scaling, despite the gene’s unchanged amount in the hypothetical samples.

The high-abundance gene accounts for 80% of the RNA in sample A and 90% in sample B. Its increased share changes the composition against which the other genes are measured. The calculation does not show that total-count scaling is always wrong; it shows that the offset alone cannot separate a depth difference from a change in total RNA composition.

Worked Example: Equal Library Totals Do Not Guarantee Equal Composition

Use the same hypothetical RNA amounts as above, but suppose both samples are sequenced to 100,000 reads. The gene of interest remains at 1,000 molecules in each sample. Its relative abundance is still 0.001 in sample A and 0.0005 in sample B.

The expected counts are \(100{,}000(0.001)=100\) reads in sample A and \(100{,}000(0.0005)=50\) reads in sample B. Both libraries have \(L=100{,}000\), so total-count scaling applies the same offset. The normalized counts are \(100/100{,}000=0.001\) and \(50/100{,}000=0.0005\), again giving a ratio of \(0.5\).

Here there is no difference in total read count to correct. The apparent decrease arises because the highly expressed gene takes up more reads in sample B, reducing the share available to other transcripts. Equal library totals therefore do not establish equal RNA composition or make the samples automatically comparable for every biological target.

Assumptions and Practical Checks

Total-count scaling is most defensible when differences in total counts primarily reflect sequencing depth and when composition is sufficiently stable that the library total provides a useful common scale. It does not require every gene to be unchanged. Rather, the normalization interpretation becomes unreliable when compositional changes are large enough to make the total a poor proxy for depth across samples. A few very abundant genes can have this effect because their counts contribute heavily to \(L_j\).

The following checks can reveal reasons to question a total-count offset. None proves, from the counts alone, that a particular normalization is correct; they help identify evidence that the composition assumption may be strained.

  • Inspect the largest contributors. Check whether a small number of genes account for a very large or substantially different fraction of each library.
  • Compare library totals with known technical information. Sequencing depth, read filtering, and the number of mapped reads help explain whether total-count differences are plausibly technical.
  • Look for broad directional changes. If many genes appear to shift in the same direction after total-count scaling, a global compositional change is one possible explanation, alongside real widespread biological changes.
  • Use reliable external information where available. Spike-in controls or well-justified reference genes can provide a comparison not based solely on the sample’s own total RNA composition. Their validity depends on how they were added or selected.

A warning sign is not a diagnosis. For example, one gene dominating a library may be biologically meaningful, an artifact, or a feature of the sample type. Also, RNA-seq counts alone identify relative allocation among sequenced molecules; they generally cannot establish absolute RNA molecules per cell without additional information about cell number, total RNA, or external controls.

Worked Example: Quantifying a Composition Shift

Suppose two hypothetical libraries each contain 50,000 mapped reads. A highly expressed gene contributes 20,000 reads in sample A and 35,000 in sample B. A second gene contributes 500 reads in A and 250 in B. Calculate the highly expressed gene’s share of each library and the second gene’s total-count-scaled ratio.

The highly expressed gene’s shares are \(20{,}000/50{,}000=0.40\) in A and \(35{,}000/50{,}000=0.70\) in B. Its share has risen by 0.30, or 30 percentage points. The second gene’s normalized counts are \(500/50{,}000=0.010\) and \(250/50{,}000=0.005\). The ratio is \(0.005/0.010=0.5\).

The calculation shows a pronounced compositional shift alongside a twofold lower relative count for the second gene. It does not establish that the second gene’s absolute amount is unchanged: the observations alone cannot distinguish that possibility from a genuine decrease. Additional biological or technical information is needed to interpret the change as an absolute expression effect.

Comparison, Limitations, and a Common Mistake

Total-count scaling is simple and transparent: it uses each library’s own total as the common measure of scale. It can be appropriate when sample compositions are comparable and library totals mainly represent sequencing depth. Other strategies estimate a scale using information across genes, with the aim of reducing sensitivity to a small number of extreme contributors; robust composition-aware approaches are examples. Such strategies still rely on assumptions about which genes provide a suitable reference. External spike-ins can address a different question by supplying an external scale, but only if their addition and behavior support that use. No scaling choice can recover absolute per-cell RNA abundance from relative counts without relevant additional information.

A common mistake is to reason, “Sample B has twice the total counts, so every gene in B must be divided by two; any gene whose scaled count is lower must therefore be downregulated.” The correction is that dividing by the total converts counts to relative shares. Those shares can change because other transcripts changed, even if the gene being examined did not. State what the offset corrects, inspect the composition, and qualify conclusions when the reference scale is uncertain.

Key takeaway: A library-size offset adjusts counts by a sample total; it does not guarantee that the total is a pure measure of sequencing depth. When a few highly expressed genes alter the composition, total-count scaling can make unchanged genes appear lower in relative abundance. Interpret the resulting comparisons as relative to the chosen scale, and use additional evidence when absolute abundance is the target.

Check Your Understanding

Answer each question, then compare your reasoning with the brief solutions.

  1. If a stable gene’s relative abundance changes from 0.002 to 0.001 while sequencing depth doubles, what is the ratio of its expected counts in the second sample to the first?
  2. Why can two libraries with identical total read counts still show a composition-related decrease for an unchanged gene?
  3. A gene has 80 reads in a 40,000-read library and 120 reads in a 120,000-read library. What are its total-count-scaled values and their ratio?
  4. Does a lower total-count-scaled value prove that a gene’s absolute RNA amount decreased? Explain.
  5. Name one source of information that could help assess or address a compositional concern, and state a limitation of using it.

Solutions. (1) The first expected count is proportional to \(D(0.002)\); the second is proportional to \(2D(0.001)\), which is the same, so the ratio is 1. (2) The same number of reads can be allocated differently if abundant transcripts take a larger share, lowering the unchanged gene’s relative share. (3) The scaled values are \(80/40{,}000=0.002\) and \(120/120{,}000=0.001\); the ratio is \(0.001/0.002=0.5\). (4) No. The scaled value is a relative quantity, and a compositional shift elsewhere in the library can lower it. (5) Spike-ins can provide an external reference, but their usefulness depends on how they were added and whether they behave appropriately for the comparison.

Clinical Biostats