Tutorials › High-Dimensional Genomic Data Analysis › Choosing Between Median-Ratio And TMM Factors

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

Choosing Between Median-Ratio And TMM Factors

Learn how median-ratio and TMM normalization estimate relative expression scales, when their assumptions are plausible, and how to diagnose composition-related problems.

Intermediate 11 min read

What You'll Learn

  • Explain how the median-ratio method constructs gene-wise references across samples.
  • Explain how TMM uses a reference sample, trimmed log ratios, and precision weights.
  • Distinguish a library size from a normalization factor and an effective library size.
  • Calculate and compare relative scaling estimates in simple count examples.
  • Identify expression patterns that can undermine either method’s assumptions.
  • Use log-ratio diagnostics and sensitivity checks to assess normalization choices.

Why Two Normalization Methods?

RNA-seq library sizes can differ, but dividing every count by its library size does not always make samples comparable. If a small number of genes account for a large share of reads in one sample, the remaining genes can receive fewer reads even when their underlying expression has not changed. A normalization method must estimate the scale difference relevant to the genes being compared, not merely divide by the total number of reads.

The median-ratio method and TMM (trimmed mean of M-values) both use information across genes to estimate relative sample scales. They differ in how they construct a reference and summarize gene-wise comparisons. Neither can identify an absolute biological scale from sequencing counts alone: each relies on the idea that enough genes provide a useful baseline for comparison.

Definition: Let \(K_{gi}\) be the observed count for gene \(g\) in sample \(i\), and let \(L_i\) be that sample’s library size (the total number of reads or counts used for scaling). A normalization factor adjusts the scale associated with \(L_i\). The resulting effective library size is \(L_i\) multiplied by the normalization factor. Relative factors matter; multiplying every sample’s factor by the same constant does not change the relative normalization.

For clarity, the formulas below describe the positive-count case, so the ratios and geometric means shown are defined. Implementations have conventions for zero counts and factor centering; those details do not change the central distinction between the methods.

How the Methods Construct References

The median-ratio method constructs a reference separately for each gene. With \(m\) samples, its gene-wise reference is the geometric mean of that gene’s counts across samples. Each sample’s count is divided by the corresponding reference, and the sample’s size factor is the median of those ratios across genes:

$$ g_g=\left(\prod_{i=1}^{m}K_{gi}\right)^{1/m}, \qquad s_i=\operatorname{median}_{g}\left(\frac{K_{gi}}{g_g}\right). $$

The factors are usually centered so that their geometric mean across samples is 1. The method’s robustness comes from taking a median: a minority of genes with very large or small ratios has limited influence. It does not explicitly remove genes based on abundance or assign different precision weights to genes.

TMM instead selects a reference sample and compares each other sample with it gene by gene. For sample \(i\) and reference sample \(r\), define the log-ratio \(M_g\) and average abundance \(A_g\) by:

$$ M_g=\log_2\left(\frac{K_{gi}/L_i}{K_{gr}/L_r}\right), \qquad A_g=\frac{1}{2}\log_2\left(\frac{K_{gi}}{L_i}\frac{K_{gr}}{L_r}\right). $$

TMM trims genes with extreme \(M_g\) values and, in its usual form, also trims extreme \(A_g\) values. It then takes a precision-weighted mean of the retained \(M_g\) values. The weights are based on the approximate sampling variability of the log ratios, so more precise comparisons have greater influence. The resulting pairwise factor is typically expressed on the original scale by raising 2 to the weighted mean. Factors are then centered across samples.

Thus, the median-ratio method uses a gene-wise reference assembled from all samples, while TMM uses a sample-level reference and a trimmed, weighted summary of pairwise comparisons. TMM’s reference is not a biological control group: it is a computational baseline for estimating relative scale.

Worked Examples

Worked Example: A Stable Majority and One Extreme Gene

Suppose two hypothetical samples have the following counts. Their library sizes are \(L_r=500\) and \(L_i=1000\).

GeneReference countSample \(i\) count
1100100
2100100
3100100
4100100
5100600

For the median-ratio method with two samples, each gene’s ratio to its geometric-mean reference is the square root of the count ratio between samples. The sample-\(i\)-to-reference ratios are \(1,1,1,1,\sqrt{6}\), so the median is \(1\). The estimated relative size factor is therefore \(s_i/s_r=1\).

For TMM, genes 1–4 have normalized-rate ratios \((100/1000)/(100/500)=0.5\), giving \(M_g=\log_2(0.5)=-1\). Gene 5 has a normalized-rate ratio of \((600/1000)/(100/500)=3\), giving \(M_5=\log_2(3)\approx1.585\). If the extreme gene is trimmed and the four stable genes are retained, the TMM log-ratio summary is \(-1\), so the pairwise factor is \(2^{-1}=0.5\).

The methods’ reported factors look different because of their conventions. The median-ratio estimate gives a relative scale of 1; TMM’s composition correction is 0.5 relative to the reference. After applying the library sizes, the median-ratio effective-size ratio is \(1000/500=2\), whereas the TMM effective-size ratio is \((1000\times0.5)/500=1\). Here the stable genes support equal effective scales, while the strongly elevated gene inflates the second library’s total count.

Worked Example: When a Weighted Trimmed Mean Differs from a Median

Consider a hypothetical pairwise comparison with five gene-wise log-ratios \(M_g\): \(-0.5,-0.1,0.1,0.2,0.8\). For illustration, suppose the two extreme values are removed by trimming and the retained values \(-0.1,0.1,0.2\) have weights \(1,2,1\).

The TMM weighted mean is:

$$ \overline{M}_{\mathrm{TMM}} =\frac{1(-0.1)+2(0.1)+1(0.2)}{1+2+1} =\frac{0.3}{4}=0.075. $$

Its pairwise factor is \(2^{0.075}\approx1.053\). The median of all five log-ratios is \(0.1\), corresponding to a factor \(2^{0.1}\approx1.072\). In this constructed example the estimates are close, but not identical: TMM’s trimming and weighting change the summary. The calculation is illustrative, not a claim that these five values determine trimming thresholds in a practical analysis; actual trimming depends on the chosen settings and abundance values.

Worked Example: Recognizing a Weak Baseline

Suppose a hypothetical experiment has 100 genes, and almost all show a similar two-fold increase in sample B relative to sample A. If the observed count ratios are approximately 2 for 90 genes and vary widely for the remaining 10, what will the methods tend to estimate?

The median-ratio method will tend to estimate a relative factor near 2, because the median gene-wise ratio is near 2. TMM will also tend to retain many of the log-ratios near \(\log_2(2)=1\); trimming a minority of extreme values will not remove the broad shift. Thus, both methods can interpret the widespread shift as a difference in sample scale rather than as a biological change shared by most genes.

This is not a computational failure. With only relative count data, a widespread change in expression and a sample-wide scale change can be difficult to distinguish without additional information or assumptions. The example shows why normalization results must be interpreted in light of the experimental context and the assumed baseline.

Why TMM’s Log-Ratio Summary Works

The core justification is that, for genes providing a stable baseline, normalized rates should be similar after the appropriate relative scale correction. Suppose the correction for sample \(i\) relative to reference \(r\) is \(f_i/f_r\). The log-ratio of corrected rates is:

$$ \log_2\left( \frac{K_{gi}/(L_i f_i)}{K_{gr}/(L_r f_r)} \right) =M_g-\log_2(f_i/f_r). $$

If the retained genes are representative of a stable baseline, a reasonable correction makes their average corrected log-ratio approximately zero. Replacing the ordinary average with TMM’s weighted trimmed mean gives the estimating relation below.

$$ 0\approx\overline{M}_{\mathrm{TMM}}-\log_2(f_i/f_r), \qquad \frac{f_i}{f_r}\approx2^{\overline{M}_{\mathrm{TMM}}}. $$

Trimming reduces the influence of unusual log-ratios and, through abundance trimming, comparisons at the extremes of abundance. Weighting gives more influence to comparisons estimated with greater precision. This justification depends on a usable subset of genes that is not systematically shifted in one direction; trimming cannot recover a baseline if the retained genes are themselves broadly biased.

Choosing and Checking a Method

FeatureMedian-ratioTMM
Reference constructionGene-wise geometric means across samplesOne reference sample for pairwise comparisons
SummaryMedian of gene-wise ratiosPrecision-weighted mean after trimming log-ratios and abundances
Outlier handlingMedian limits the influence of a minority of extreme ratiosTrimming explicitly removes selected extremes; weights reflect precision
Useful perspectiveSimple, robust summary when most genes provide a suitable baselineUseful when composition effects and abundance-dependent precision merit explicit treatment

A practical choice depends on the expression pattern, not on a universal ranking. Median-ratio normalization is a natural option when a large majority of genes have ratios that form a representative baseline and no small set of highly expressed genes dominates the comparison. TMM is attractive when composition differences are prominent and a suitable subset of genes can be compared after trimming. TMM’s weighting and trimming are explicit, but they do not guarantee protection when most genes shift together or when the reference sample is atypical.

Useful checks include comparing estimated effective library sizes, inspecting log-ratio-versus-abundance plots, and checking whether a few highly expressed genes dominate raw library totals. For TMM, examine whether many genes remain after trimming and whether the retained log-ratios have a plausible center. Also compare conclusions under both methods when the choice is consequential. Large discrepancies are a reason to investigate the counts and assumptions, not a reason to choose whichever result is preferred.

Normalization is a scale adjustment, not a test of differential expression and not evidence that any particular gene is unchanged. It does not correct an unsuitable experimental design, resolve all technical artifacts, or establish absolute expression changes. Both methods estimate relative scales from the observed gene set; if that set lacks a credible baseline, additional experimental information may be needed.

Common Mistake and Limitations

Common mistake: “TMM’s factor is 0.5, so sample \(i\) has half as many reads as the reference.” This confuses a composition correction with the library size. In the first worked example, \(L_i=1000\) and \(L_r=500\); the TMM effective sizes are \(1000(0.5)=500\) and \(500\), respectively. The correction accounts for composition so the two effective scales are equal in that comparison. Always distinguish the raw library size, the normalization factor, and their product.

A second limitation is shared by both methods: if most genes truly change in the same direction, or if the set of genes used as a baseline is systematically affected, relative normalization can absorb biological signal into the estimated scale. A minority of extreme genes may be handled differently by the methods, but no robust summary can identify which genes are biologically stable without assumptions or external information.

Check Your Understanding

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

  1. In one sentence, distinguish the reference used by the median-ratio method from the reference used by TMM.
  2. For two samples, suppose gene-wise count ratios are \(1,1,1,4\). What is the median-ratio relative scale estimate, and why might TMM give a similar estimate?
  3. A TMM pairwise factor is 0.8, while the sample’s library size is twice the reference library size. What is the ratio of their effective library sizes?
  4. Why can both methods give misleading biological interpretations if nearly all genes increase by the same factor?

Solutions. (1) Median-ratio forms a geometric-mean reference separately for each gene across samples; TMM compares genes with a selected reference sample. (2) The median of \(1,1,1,4\) is 1, so the median-ratio relative scale estimate is 1. If the ratio 4 is an extreme gene and the other genes form a stable baseline, TMM may trim it and estimate a factor near 1. (3) The effective-size ratio is \(2\times0.8=1.6\), sample relative to reference. (4) A widespread shift can look like a sample-wide scale difference; without a stable baseline or external information, the data may not distinguish that scale difference from a shared biological change.

Clinical Biostats