Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Total-Count Scaling and Counts Per Million

Normalization of Sparse Counts · Tutorial 80 of 700

Total-Count Scaling and Counts Per Million

Calculate total-count size factors and CPM, and see how scaling changes a sparse count matrix while preserving each cell’s measured relative profile.

Intermediate 12 min read

What You'll Learn

  • Calculate each cell’s library total and a size factor relative to a stated target total.
  • Convert raw counts to scaled counts and CPM, with units and denominators made explicit.
  • Verify the relationship between CPM, size factors, and the sum of normalized values.
  • Work through a sparse count matrix and identify which within-cell quantities scaling preserves.
  • Recognize when zero totals, small totals, or a changing feature set make the calculations unreliable.

Why Scale Counts by the Library Total?

A cell with more recorded counts can have larger counts for many genes simply because more molecules were captured or sequenced. Comparing its raw counts directly with those from a cell with a smaller library total can therefore mix differences in sampling depth with differences in the distribution of counts across genes. Total-count scaling provides a direct calculation that puts cells on a common total-count scale.

The method starts with a count matrix: rows represent genes, columns represent cells, and each entry is a nonnegative integer count. It uses the sum of counts in each cell as an estimate of that cell’s sampling exposure. This is useful when library totals are reasonable proxies for relative exposure and the cells are sufficiently comparable for total-count scaling to be meaningful. It does not turn counts into absolute molecule numbers per cell.

Definition: Let \(x_{gj}\) be the observed count for gene \(g\) in cell \(j\), summed over a specified set of genes. The library total for cell \(j\) is \(L_j=\sum_g x_{gj}\). For a positive target total \(L_{\mathrm{ref}}\), the total-count size factor is \(s_j=L_j/L_{\mathrm{ref}}\). The scaled count is \(x_{gj}/s_j\). Counts per million (CPM) for that gene and cell are \(10^6x_{gj}/L_j\), provided \(L_j>0\).

The feature set used in the sum matters. If the analysis includes a selected set of genes, then \(L_j\) is the total over that set, not necessarily the total over every possible transcript or molecule in the cell. Keep the set fixed when comparing cells. CPM is a relative measure: for a particular cell, it reports the count as a fraction of that cell’s chosen total, multiplied by one million.

Size Factors, Scaled Counts, and CPM

A common choice for \(L_{\mathrm{ref}}\) is the arithmetic mean library total across the cells being normalized. This makes the factors average to one. Other target totals can be used; changing the target changes the numerical scale of the scaled counts, but not their within-cell proportions. State the target explicitly so that the reported scaled counts are interpretable.

$$ \bar{L}=\frac{1}{m}\sum_{j=1}^{m}L_j,\qquad s_j=\frac{L_j}{\bar{L}},\qquad x^{\mathrm{scaled}}_{gj}=\frac{x_{gj}}{s_j} =x_{gj}\frac{\bar{L}}{L_j} $$

Here \(m\) is the number of cells. With this choice, the sum of scaled counts in each cell is \(\bar{L}\). CPM uses a fixed target of one million rather than the average library total. The two forms are directly related:

$$ \mathrm{CPM}_{gj}=10^6\frac{x_{gj}}{L_j}, \qquad \mathrm{CPM}_{gj} =x^{\mathrm{scaled}}_{gj}\frac{10^6}{\bar{L}} $$

Thus CPM and total-count scaling use the same cell-specific denominator. They differ only in the target scale: scaled counts sum to \(\bar{L}\), while CPM values sum to one million over the same genes. CPM is not a count of one million observed molecules; it is a rescaled proportion.

Why the Scaling Formula Works

The size factor is intended to represent relative sampling exposure. To see the rationale, suppose the expected count for gene \(g\) in cell \(j\) is \(d_j a_g\), where \(d_j\) is that cell’s exposure and \(a_g\) is the gene’s expected contribution under a common profile. Summing over genes gives an expected library total proportional to \(d_j\). In that setting, the ratio of library totals estimates the ratio of exposures, and dividing by the size factor removes that relative exposure.

The argument depends on comparability: the underlying total contribution across the summed genes must not systematically vary in a way that is confused with exposure. If it does vary, a library total can reflect both exposure and biology. This is a limitation of the assumption, not an arithmetic error in the calculation.

The basic identities also follow directly from the definitions. For \(L_j>0\), summing scaled counts over genes gives:

$$ \sum_g x^{\mathrm{scaled}}_{gj} =\sum_g x_{gj}\frac{\bar{L}}{L_j} =\frac{\bar{L}}{L_j}\sum_g x_{gj} =\frac{\bar{L}}{L_j}L_j =\bar{L} $$

Likewise, the sum of CPM values over the same genes is \(10^6\), since \(\sum_g 10^6 x_{gj}/L_j=10^6L_j/L_j\). These are useful arithmetic checks, but they do not show that the normalization assumption is appropriate.

Worked Example: Scaling a Small Sparse Count Matrix

Consider this hypothetical matrix. The zeros are observed zeros, and the library total is calculated over these four genes.

GeneCell ACell BCell C
Gene 18160
Gene 2006
Gene 3240
Gene 4004

Step 1: Calculate library totals and the reference. The totals are \(L_A=8+0+2+0=10\), \(L_B=16+0+4+0=20\), and \(L_C=0+6+0+4=10\). Their mean is \(\bar{L}=(10+20+10)/3=13.333\) counts.

Step 2: Calculate size factors. The factors are \(s_A=10/13.333=0.7500\), \(s_B=20/13.333=1.500\), and \(s_C=10/13.333=0.7500\). A factor above one indicates a larger library than the reference; dividing by it reduces that cell’s counts.

Step 3: Scale the counts. For example, Gene 1 in Cell A becomes \(8/0.7500=10.667\), while Gene 1 in Cell B becomes \(16/1.500=10.667\). The scaled matrix has columns \((10.667,0,2.667,0)\), \((10.667,0,2.667,0)\), and \((0,8,0,5.333)\). Each column sums to \(13.333\), allowing for rounding.

Step 4: Calculate CPM. Gene 1 in Cell A has \(10^6(8/10)=800{,}000\) CPM. Gene 1 in Cell B also has \(10^6(16/20)=800{,}000\) CPM. For Cell C, Gene 2 has \(10^6(6/10)=600{,}000\) CPM and Gene 4 has \(400{,}000\) CPM; its other genes have zero CPM.

Cell A and Cell B have the same proportions across the measured genes, so their scaled profiles and CPM values match even though their raw counts differ by a factor of two. Cell C has a different relative profile; scaling does not make its gene proportions match the other cells. Zeros remain zero because multiplying or dividing zero by a positive factor leaves it zero.

Worked Example: From a Size Factor to CPM

Suppose three hypothetical cells have library totals of 5,000, 10,000, and 15,000 counts. The mean total is \((5{,}000+10{,}000+15{,}000)/3=10{,}000\) counts. Their size factors are therefore \(0.5000\), \(1.000\), and \(1.500\).

For one gene, suppose the observed counts are 50, 100, and 75. The scaled counts are \(50/0.5000=100\), \(100/1.000=100\), and \(75/1.500=50\). These are on the 10,000-count reference scale.

The CPM calculations use each cell’s own total: \(10^6(50/5{,}000)=10{,}000\) CPM, \(10^6(100/10{,}000)=10{,}000\) CPM, and \(10^6(75/15{,}000)=5{,}000\) CPM. As a check, multiplying the scaled counts by \(10^6/10{,}000=100\) gives the same CPM values: 10,000, 10,000, and 5,000. The third cell has a lower relative count for this gene after scaling; the conclusion is about its share of the measured library, not its absolute RNA abundance.

Worked Example: Zeros and the Choice of Feature Set

A hypothetical cell has counts 0 and 12 for two genes in a selected two-gene panel. If the denominator is the total for that panel, then \(L=0+12=12\). The first gene has \(10^6(0/12)=0\) CPM, and the second has \(10^6(12/12)=1{,}000{,}000\) CPM.

Now suppose the declared feature set also includes another measured gene with count 8. The total over all three genes is \(L=0+12+8=20\), so the second gene has \(10^6(12/20)=600{,}000\) CPM and the third has \(400{,}000\) CPM. The value changed because the denominator changed, not because the count of the second gene changed. When reporting CPM, specify the feature set used to define the library total.

Assumptions, Checks, and Failure Modes

The calculation is straightforward, but its interpretation requires care. Total-count scaling is most defensible when the cells are measured over a consistent feature set, their library totals are positive and reliable, and differences in those totals largely represent sampling exposure rather than meaningful differences in total RNA contribution. These conditions are substantive assumptions; the sum-to-target identity alone cannot establish them.

Several practical checks help identify arithmetic or data problems:

  • Recalculate \(L_j\) from the exact matrix being normalized and confirm that every cell has \(L_j>0\). A zero total makes both the size factor and CPM undefined.
  • Check that the scaled column totals equal the chosen target, and that CPM column totals equal one million, using the same feature set in numerator summaries and denominator totals.
  • Inspect the distribution of library totals. A cell with a very small positive total can receive very large CPM values for a few observed counts, making its profile noisy.
  • Confirm that counts are nonnegative and that cells were not summed over different gene sets. Changing the feature set changes the denominator and therefore the normalized values.
  • Remember that total-count scaling cannot recover information about genes with zero observed counts. A zero remains zero, whether it reflects low abundance, limited sampling, or another source of non-detection.

A cell with \(L_j=0\) cannot be normalized by this method: dividing by zero is undefined. It must be investigated or handled under a separately justified data-processing rule, rather than assigned an arbitrary factor. Very small totals are also a warning: the formulas still calculate, but the resulting proportions can be highly variable because they are based on few counts.

How This Relates to Other Summaries

Raw counts retain the observed integer measurements, which are needed for analyses that model count variability. Total-count scaled counts put each cell on a chosen common total scale. CPM expresses the same relative information on a one-million scale, which can be convenient for reporting or comparing relative profiles. Neither scaled counts nor CPM should be mistaken for raw counts or treated as direct measurements of absolute molecules per cell.

QuantityCalculationWhat the scale meansImportant caution
Raw count\(x_{gj}\)Observed count for a gene in a cellCells with different library totals are not directly on a common total scale
Scaled count\(x_{gj}/s_j\)Count on the stated reference-total scaleMay be fractional; it is a transformed value, not a new observed count
CPM\(10^6x_{gj}/L_j\)Relative share per million counts in the chosen feature setDepends on the denominator and does not represent absolute abundance

This method is simple and transparent, but its suitability depends on whether library totals act as appropriate exposure corrections. A correct calculation is not, by itself, evidence that the normalization target is scientifically appropriate. Keep the distinction between the numerical operation and the assumption behind its interpretation clear.

Common Mistakes

  • Using the wrong direction for the size factor. If \(s_j=L_j/\bar{L}\), scaled counts are \(x_{gj}/s_j\), not \(x_{gj}s_j\). A larger-than-reference library must be reduced to the reference scale.
  • Calling CPM a raw count. CPM can be fractional and is a rescaled proportion, not a number of molecules observed.
  • Assuming every CPM column must sum to one million under any calculation. It does so only when the denominator and sum use the same specified feature set.
  • Treating zeros as missing or replacing them during scaling. Total-count scaling leaves observed zeros at zero; it does not determine why they were not detected.
  • Interpreting equal CPM as equal absolute expression. Equal CPM means equal shares of the chosen library totals. It does not establish equal absolute RNA abundance per cell.

Check Your Understanding

Try each calculation first, then compare with the solutions below.

  1. Two cells have totals of 4,000 and 8,000 counts. Using their mean as the reference, calculate the size factors.
  2. A gene has 30 counts in a cell with a total of 6,000. Calculate its CPM.
  3. A cell has counts 3, 0, and 9 over the chosen feature set. Calculate the total and the CPM for each gene.
  4. Why can a zero library total not be normalized by total-count scaling?
  5. In one sentence, explain what equal CPM for a gene in two cells does and does not imply.

Solutions. 1. The mean total is \((4{,}000+8{,}000)/2=6{,}000\), so the factors are \(4{,}000/6{,}000=0.6667\) and \(8{,}000/6{,}000=1.333\). 2. CPM is \(10^6(30/6{,}000)=5{,}000\). 3. The total is \(3+0+9=12\); the CPM values are \(10^6(3/12)=250{,}000\), \(0\), and \(10^6(9/12)=750{,}000\). They sum to one million. 4. The size factor and CPM require division by the library total, so both are undefined when that total is zero. 5. Equal CPM means equal relative shares of the specified library totals; it does not imply equal absolute RNA abundance per cell.

Clinical Biostats