Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Worked Deconvolution Example with Sparse Counts

Normalization of Sparse Counts · Tutorial 93 of 700

Worked Deconvolution Example with Sparse Counts

Work through how overlapping pools turn sparse gene counts into pooled ratios, cell-level size factors, and normalized values.

Intermediate 9 min read

What You'll Learn

  • Sum gene counts across specified cell pools, including when individual cells contain zeros.
  • Calculate pooled ratios against a stated reference profile.
  • Set up and solve the linear equations that recover cell-level size factors.
  • Normalize cell counts by their estimated deconvolution factors.
  • Check whether the pool design and ratio assumptions support the calculation.
  • Compare the worked approach with library-size and gene-wise size-factor methods.

Why Work Through a Deconvolution Example?

Deconvolution uses overlapping pools to estimate cell-level size factors when counts in individual cells are sparse. Pooling increases the counts available for estimating a relative scale; overlap then supplies equations that can be solved for the individual cell factors. The key is to keep three quantities distinct: pooled gene counts, pooled ratios, and the cell-level factors recovered from those ratios.

The earlier material on pooling and deriving cell-level factors established the basic idea. Here, the calculations are carried through on a small hypothetical matrix, including the final division of counts by the estimated factors. This is an arithmetic illustration, not evidence that a particular reference profile or set of factors would be reliable in a real experiment.

Definition: Let \(Y_{gi}\) be the observed count for gene \(g\) in cell \(i\). For a pool \(P_k\), its pooled count for gene \(g\) is \(Y_{gP_k}=\sum_{i\in P_k}Y_{gi}\). Given a positive reference profile \(\rho_g\), a pooled ratio \(r_k\) can be estimated as the median of \(Y_{gP_k}/\rho_g\) across eligible genes. Under the deconvolution model, \(r_k\) estimates the sum of the cell-level size factors in that pool: \(r_k\approx\sum_{i\in P_k}s_i\).

Worked Example: Pooling a Sparse Count Matrix

Suppose a hypothetical experiment records counts for five genes in three cells. Zeros are genuine observed zeros. The table gives the complete count matrix.

GeneCell 1Cell 2Cell 3
Gene A402
Gene B041
Gene C210
Gene D022
Gene E104

Use three overlapping pools: \(P_1=\{1,2\}\), \(P_2=\{2,3\}\), and \(P_3=\{1,3\}\). For this arithmetic example, take the fixed positive reference profile to be \(\rho_g=2\) counts per factor unit for each of the five genes. This reference is supplied for the illustration; it is not estimated from this tiny matrix.

First sum the counts gene by gene within each pool. For example, in \(P_1\), Gene A has \(4+0=4\) counts and Gene B has \(0+4=4\). Applying the same addition to every gene gives:

GenePool 1: cells 1 + 2Pool 2: cells 2 + 3Pool 3: cells 1 + 3
Gene A426
Gene B451
Gene C312
Gene D242
Gene E145

Now divide each pooled count by the corresponding reference value, which is 2 for every gene. The five ratios for Pool 1 are \(2,2,1.5,1,0.5\); their median is \(1.5\). Pool 2 gives \(1,2.5,0.5,2,2\), with median \(2\). Pool 3 gives \(3,0.5,1,1,2.5\), with median \(1\). Thus the pooled ratios are \(r_1=1.5\), \(r_2=2\), and \(r_3=1\). For instance, Pool 1’s median is the middle value after sorting \(0.5,1,1.5,2,2\).

All pooled counts in this example are positive, even though the cell-level matrix is sparse. In a general calculation, a zero pooled count gives a zero gene-wise ratio when the reference is positive; it is not silently replaced by a positive value. Genes with a zero reference cannot be used to form a ratio.

Recovering the Cell-Level Factors

Write the unknown factors for the three cells as \(s_1,s_2,s_3\). Each pooled ratio estimates the sum of the factors for the cells in its pool. The three pools therefore give three equations:

$$ \begin{aligned} s_1+s_2&=1.5,\\ s_2+s_3&=2,\\ s_1+s_3&=1. \end{aligned} $$

The pool membership matters: Pool 1 contains cells 1 and 2, Pool 2 contains cells 2 and 3, and Pool 3 contains cells 1 and 3. The equations can be solved by adding and subtracting them. Adding the first and third equations and subtracting the second leaves \(2s_1\):

$$ s_1=\frac{r_1+r_3-r_2}{2} =\frac{1.5+1-2}{2} =\frac{0.5}{2} =0.25. $$

Similarly, adding the first and second equations and subtracting the third gives \(2s_2\); adding the second and third and subtracting the first gives \(2s_3\):

$$ \begin{aligned} s_2&=\frac{r_1+r_2-r_3}{2} =\frac{1.5+2-1}{2} =\frac{2.5}{2} =1.25,\\ s_3&=\frac{r_2+r_3-r_1}{2} =\frac{2+1-1.5}{2} =\frac{1.5}{2} =0.75. \end{aligned} $$

The factors are positive and reproduce every pooled ratio: \(0.25+1.25=1.5\), \(1.25+0.75=2\), and \(0.25+0.75=1\). This substitution is an important check against a pool-label or arithmetic error.

Justification: In matrix form, the pool equations are \(A\mathbf{s}=\mathbf{r}\), where \(A\) records which cells belong to each pool. Here, \(A=\begin{pmatrix}1&1&0\\0&1&1\\1&0&1\end{pmatrix}\). Its determinant is \(2\), which is nonzero, so the equations have a unique solution. If the pool membership equations do not uniquely identify the cell factors, the factors cannot be recovered from those pooled ratios alone.

Final Normalization

For this calculation, normalize each cell’s gene counts by dividing by that cell’s estimated factor. For example, the normalized Gene A value in Cell 1 is \(4/0.25=16\). Applying the same operation to every entry gives:

$$ \begin{array}{c|ccc} & \text{Cell 1} & \text{Cell 2} & \text{Cell 3}\\ \hline \text{Gene A} & 4/0.25=16 & 0/1.25=0 & 2/0.75=2.667\\ \text{Gene B} & 0/0.25=0 & 4/1.25=3.2 & 1/0.75=1.333\\ \text{Gene C} & 2/0.25=8 & 1/1.25=0.8 & 0/0.75=0\\ \text{Gene D} & 0/0.25=0 & 2/1.25=1.6 & 2/0.75=2.667\\ \text{Gene E} & 1/0.25=4 & 0/1.25=0 & 4/0.75=5.333 \end{array} $$

These are factor-adjusted counts, not newly observed counts. The factor estimates put cells on a common relative scale under the reference-profile assumptions. Their absolute scale depends on the scale of the reference profile: multiplying every factor by the same positive constant would divide every normalized value by that constant. The calculation has not converted the values to counts per million.

Worked Example: Checking a Pool Equation

Use the estimated factors \(0.25,1.25,0.75\) to check Pool 2, which contains Cells 2 and 3. The implied pooled factor is \(1.25+0.75=2\). This matches the estimated pooled ratio \(r_2=2\).

The same check can be made for the underlying pooled counts at Gene D: the pool contains \(2+2=4\) counts, and its gene-wise ratio to the reference value 2 is \(4/2=2\). That individual gene ratio happens to equal the pooled median here, but the method uses the median across genes; it does not require every gene to have the same ratio.

If the factor sum had instead been \(1.8\), it would not reproduce the specified pooled ratio of 2. The discrepancy would indicate an arithmetic or equation setup error in an exact three-equation solution.

Worked Example: Normalizing One Gene Across Cells

For Gene D, the observed counts are \(0,2,2\), and the corresponding factors are \(0.25,1.25,0.75\). Divide each count by its own cell factor:

Cell 1: \(0/0.25=0\). Cell 2: \(2/1.25=1.6\). Cell 3: \(2/0.75=2.667\). Thus the normalized values for Gene D are \(0,1.6,2.667\) on the factor-adjusted scale. A zero remains zero under this division; normalization does not impute an unobserved count.

Assumptions, Checks, and Alternatives

The algebra can be exact while the estimated factors are still poor estimates of cell-specific scale. The interpretation of each pooled ratio as a sum of cell factors relies on a suitable reference profile and on enough genes having comparable underlying expression across cells for the median ratio to represent scale rather than broad biological change. The factor model also treats the pool ratio as additive across its member cells. These are modeling assumptions, not consequences of solving the equations.

A useful calculation check is to substitute the recovered factors into every pool equation. Also check that the chosen pools cover the cells of interest, that the equations identify the factors, and that the solutions are positive. A zero or negative solution is not a valid positive exposure factor under this model and calls for reviewing the ratios, pool definitions, and assumptions. A perfect fit to the equations alone is not a diagnostic of whether the reference profile or stable-gene assumption was appropriate.

Pooling is particularly helpful when individual cells have many zeros: summing overlapping cells can make gene-wise ratios estimable even when single-cell ratios are not. It does not guarantee stability. If the pools still have few informative genes, or if a small number of genes dominate the ratios, the median can be unrepresentative. Investigating such instability requires more than the arithmetic checks shown here.

The main alternatives address scale in different ways. Total-count scaling uses each cell’s library total directly; it is simple, but the total can change with composition as well as depth. Median-ratio and TMM methods estimate relative scaling from gene-wise comparisons, with their own assumptions about the genes contributing to those comparisons. Deconvolution instead obtains ratios from pools and solves for the cell factors. None of these methods removes the need to assess whether the assumptions fit the experiment.

Worked Example: A Pool Design That Does Not Identify Every Factor

Suppose four cells are represented only by two pools, \(P_1=\{1,2\}\) and \(P_2=\{3,4\}\), with ratios \(r_1=2\) and \(r_2=3\). The equations are \(s_1+s_2=2\) and \(s_3+s_4=3\). The first equation allows many positive pairs, such as \((0.5,1.5)\) and \((1,1)\); the second also allows many pairs, such as \((1,2)\) and \((1.5,1.5)\). The pooled ratios determine the two sums, but not the four individual factors. More informative overlapping pools are needed for unique recovery.

Common Mistake

Wrong reasoning: “Pool 1 has a ratio of 1.5, so both cells in Pool 1 have a factor of 1.5.” This assigns a pooled quantity to each member separately and would imply a pool sum of \(1.5+1.5=3\), not 1.5.

Correction: A pooled ratio estimates the sum of the factors in that pool. Recover individual factors by solving the full set of overlapping-pool equations. Then verify that the recovered factors reproduce every observed pooled ratio.

Key takeaway: Sum counts within each pool, calculate pooled ratios relative to a stated reference, solve the pool-sum equations for cell factors, and divide each cell’s counts by its own factor. The computation is only as trustworthy as the reference, gene-stability, and pool-identifiability assumptions that support it.

Check Your Understanding

Answer the questions, then compare your work with the solutions below.

  1. For counts \(3\) and \(0\) for one gene in Cells 1 and 2, what is the pooled count for pool \(\{1,2\}\)?
  2. If a pool ratio is \(2.4\) and the pool contains two cells with factors \(0.9\) and \(1.5\), does the pool equation hold?
  3. For pools \(\{1,2\},\{2,3\},\{1,3\}\) with ratios \(2,3,1\), calculate the three cell factors.
  4. If a count is \(6\) and its cell factor is \(1.5\), what is the factor-adjusted value?

Solutions. 1. The pooled count is \(3+0=3\). 2. Yes: \(0.9+1.5=2.4\). 3. Using the pair-sum formulas, \(s_1=(2+1-3)/2=0\), \(s_2=(2+3-1)/2=2\), and \(s_3=(3+1-2)/2=1\). This exact solution includes a zero factor, so although it solves the equations, it is not a positive factor solution under the usual model and should prompt review of the estimates and assumptions. 4. The adjusted value is \(6/1.5=4\).

Clinical Biostats