Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Diagnosing MNN Match Quality

Integration Methods and Their Benchmarking · Tutorial 164 of 700

Diagnosing MNN Match Quality

Use complementary geometric and directional checks to judge whether mutual nearest-neighbor pairs support a plausible batch alignment.

Advanced 10 min read

What You'll Learn

  • Compare cross-batch MNN distances with local within-batch neighbor scales.
  • Summarize how many cells participate in reciprocal matches and how concentrated the matches are.
  • Calculate directional coherence from nonzero MNN correction vectors, including when it is undefined.
  • Interpret diagnostic patterns without treating them as proof of shared biology or successful integration.
  • Recognize how feature scaling, density, and confounding can distort match-quality summaries.

Why Diagnose MNN Matches?

Mutual nearest neighbors (MNNs) are candidate cross-batch cell pairs: each cell is among the other's nearest neighbors in the selected feature space. The earlier material on shared-state assumptions and MNN construction establishes why such pairs can help estimate local batch displacement. But an algorithm can return reciprocal pairs even when the feature space, cell neighborhoods, or biological overlap do not support a convincing alignment. A match is therefore evidence to assess, not a guarantee that the paired cells represent the same state.

This tutorial focuses on three complementary diagnostics: the distances between matched cells relative to local neighbor distances, the number and distribution of reciprocal matches, and the directional coherence of the resulting correction vectors. None has a universal cutoff. Their value comes from checking whether several aspects of the observed geometry tell a compatible story.

Definition: For two batches represented in a chosen feature space, an MNN pair is a pair of cells for which each cell is among the other's selected nearest neighbors across batches. A match-quality diagnostic summarizes a feature of these candidate pairs, such as their geometric proximity, their coverage of cells, or the consistency of their implied correction directions. A diagnostic describes the computed matches; it does not establish biological equivalence.

Distance in Local Context

A cross-batch distance alone is hard to interpret. Its numerical size depends on the feature representation, scaling, and local spread. A distance of 0.2 may be small in a diffuse region and large in a tightly packed one. For each MNN pair, compare its cross-batch distance with a local within-batch neighbor scale computed using the same feature space and distance metric. For example, if \(d_r\) is the distance for pair \(r\), and \(s_{A,r}\) and \(s_{B,r}\) summarize the typical within-batch neighbor distances near its two cells, a useful descriptive ratio is:

$$ R_r=\frac{d_r}{\sqrt{s_{A,r}s_{B,r}}}. $$

The geometric mean in the denominator puts the pair distance in relation to the local scales on both sides. A ratio near 1 means the cross-batch separation is on the order of those local neighbor distances; a substantially larger ratio flags a pair separated by more than the typical local spacing. This is a comparison, not a formal test or a universal acceptance rule. Inspecting the distribution of ratios can reveal a tail of questionable matches that a mean alone would hide.

Worked Example: Putting an MNN Distance in Context

Suppose a hypothetical analysis uses one fixed, scaled feature space and the same Euclidean distance for all comparisons. One MNN pair has cross-batch distance \(d_r=0.18\). The median local within-batch neighbor distances near its cells are \(s_{A,r}=0.20\) and \(s_{B,r}=0.22\). Calculate and interpret the ratio.

Calculation.

$$ R_r=\frac{0.18}{\sqrt{0.20(0.22)}} =\frac{0.18}{\sqrt{0.044}} =\frac{0.18}{0.2098} \approx 0.858. $$

The pair distance is about 0.86 times the geometric mean of the two local neighbor scales. In this feature space, it is not unusually large relative to those local scales. That supports geometric plausibility, but it does not show that the cells are biologically the same state: nearby cells can still differ in biology, and the chosen representation may omit relevant distinctions.

Distance diagnostics can also fail in predictable ways. If features have inappropriate scales, a few high-variance dimensions can dominate both cross-batch and within-batch distances. If local density differs sharply between batches, a ratio can be affected by that density difference rather than by a simple match-versus-mismatch distinction. Distances from one region should therefore be interpreted against local scales from that region, not against an unexamined global cutoff.

How Many Cells Are Supported by Matches?

The total number of reciprocal pairs is a basic measure of the available match evidence, but counts alone can be misleading. A large number of pairs might be concentrated around a small number of cells, while another analysis with fewer pairs might cover more cells broadly. For each cell, record how many MNN pairs involve it. Summaries can include the fraction of cells with at least one match, the distribution of per-cell counts, and the maximum count for any one cell. Report counts separately by batch when coverage may be asymmetric.

Worked Example: Match Count and Cell Coverage

In a hypothetical comparison, batch B has eight cells. The cells participate in \(2,2,1,1,0,0,0,0\) reciprocal pairs, respectively. Assume each listed count is the number of distinct MNN pairs involving that cell. Summarize the match count and coverage.

Total pairs. Every pair contains exactly one batch B cell, so summing the per-cell counts for batch B counts each pair once:

$$ M=2+2+1+1+0+0+0+0=6. $$

Coverage. Four of the eight batch B cells occur in at least one pair, so the matched fraction is \(4/8=0.50\), or 50%. The counts are concentrated: two cells each participate in two pairs, while four have no reciprocal match. Thus, “six pairs” by itself would conceal limited and uneven cell coverage.

This summary does not imply that the four unmatched cells are erroneous or that their biology should be removed. It says only that the MNN procedure found no reciprocal partner for them under the particular feature space and neighborhood choices.

Low counts can reflect limited overlap, an unsuitable feature space, or parameter choices such as the number of neighbors used to define reciprocity. High counts are not automatically reassuring: repeated pairings around a few cells may indicate concentration, and a permissive neighborhood size may produce more matches without making them more credible. Comparing batches and checking how summaries change under reasonable analysis choices is more informative than declaring a count “good” in isolation.

Correction-Vector Coherence

For this diagnostic, take batch A as the reference and batch B as the batch to move. For MNN pair \(r\), define its correction vector \(v_r=z_{A,r}-z_{B,r}\), where \(z_{A,r}\) and \(z_{B,r}\) are the paired cell coordinates in the chosen feature space. This is the displacement that would move the batch B cell toward its batch A partner. Its direction can be compared with directions from other pairs.

Definition: Suppose there are \(M>0\) reciprocal pairs with nonzero correction vectors \(v_1,\ldots,v_M\). Their pair-weighted directional coherence is $$ C=\frac{1}{M}\left\|\sum_{r=1}^{M}\frac{v_r}{\|v_r\|}\right\|. $$ Then \(0\le C\le 1\). If there are no reciprocal pairs, or if there are no nonzero correction vectors to include, coherence is undefined and should be reported as such—not as zero.

Each included vector contributes a unit direction, so the measure focuses on directional agreement rather than displacement magnitude. By the triangle inequality, the norm of a sum of \(M\) unit vectors is at most the sum of their norms, \(M\); dividing by \(M\) gives \(C\le 1\). A norm cannot be negative, giving \(C\ge 0\). If all directions are identical, the sum has norm \(M\) and \(C=1\). Opposing directions can cancel, yielding a value near 0. Intermediate values indicate partial alignment of directions, not a calibrated probability that the matches are correct.

Worked Example: Calculating Directional Coherence

Consider four hypothetical nonzero correction vectors whose unit directions are \((1,0)\), \((0.8,0.6)\), \((-1,0)\), and \((0,1)\). Each is already of unit length. Calculate their pair-weighted coherence.

Sum the unit directions: \((1+0.8-1+0,\;0+0.6+0+1)=(0.8,1.6)\). Its norm is \(\sqrt{0.8^2+1.6^2}=\sqrt{3.20}\approx1.789\). Therefore:

$$ C=\frac{\sqrt{3.20}}{4} \approx \frac{1.789}{4} \approx 0.447. $$

The directions show some net agreement, but they are not strongly aligned: the opposing horizontal directions partly cancel, while the two other directions contribute an upward component. This value is a descriptive summary of these four directions only. In particular, it does not say that 44.7% of pairs are correct.

Coherence is pair-weighted: a cell that appears in several pairs contributes several vectors. It can therefore be driven by concentrated matches. It also ignores magnitude, so many tiny vectors pointing similarly can yield high coherence, even if their displacements are negligible. Conversely, local correction directions can vary across a curved or heterogeneous manifold, lowering global coherence despite plausible local matches. Inspecting directions and distances by neighborhood or region can help distinguish local structure from a single global pattern.

Combining Diagnostics Without Overclaiming

The three summaries answer different questions. Distances ask whether paired cells are close relative to local spacing. Counts ask how much of each batch participates and whether matches are concentrated. Coherence asks whether nonzero pairwise displacements tend to point in a common direction. A coherent set of long-distance pairs may still be geometrically implausible; short distances with very sparse coverage provide limited support; and many pairs can point in inconsistent directions. The diagnostics should be read together, not collapsed into one unqualified quality score.

They are also distinct from other ways of evaluating an integrated representation. For example, batch-mixing summaries describe how batch labels are distributed among neighbors after integration, while checks on known biological labels ask whether distinctions of interest remain visible. Neither substitutes for assessing whether the original MNNs were plausible. Strong mixing can result from overcorrection, and plausible pairs alone do not prove that all relevant biology was preserved.

A practical review can follow this sequence:

1
Check the representation.
Confirm that the feature space, scaling, and distance metric are appropriate for the intended alignment and are applied consistently across batches.
2
Inspect distance context.
Summarize cross-batch distances relative to local within-batch neighbor scales, looking at distributions and outliers rather than relying only on an average.
3
Check coverage and concentration.
Report total reciprocal pairs, per-batch matched fractions, and per-cell participation so a few highly matched cells do not obscure sparse coverage.
4
Assess direction and sensitivity.
Calculate coherence for nonzero vectors, inspect local variation, and check whether conclusions persist under reasonable neighborhood choices.

Common Pitfalls and Limitations

  • Treating a large pair count as proof of quality. Counts measure pair abundance, not correctness; examine cell coverage and concentration as well.
  • Using a universal distance threshold. Distances depend on the representation and local density. Compare to relevant local scales and state the metric used.
  • Calling coherence a fraction of correct pairs. It is the norm of an average of unit directions, not an estimated accuracy or probability.
  • Reporting zero coherence when no vectors exist. With no reciprocal pairs, or no nonzero correction vectors, the defining average cannot be computed. Report it as undefined and state the reason.
  • Assuming directional agreement validates the biological match. A shared technical displacement can create coherent vectors even when biological states are not equivalent. Match diagnostics cannot resolve confounding or establish identifiability of a condition effect.

These checks have no universal pass/fail thresholds and do not replace biological reasoning. Their limitations are especially important when batches differ in sampled populations or when technical and biological differences are entangled. A cautious conclusion reports what the diagnostics show, the feature space and neighborhood settings used, and what remains uncertain.

Check Your Understanding

Answer each question, then compare with the brief solutions.

  1. A pair has cross-batch distance 0.30, with local scales 0.25 and 0.36. Calculate \(R_r\) and interpret it.
  2. In batch A, six cells have per-cell pair counts \(1,1,0,0,0,0\). How many distinct MNN pairs are represented, and what fraction of batch A cells are matched?
  3. Three nonzero correction vectors have unit directions \((1,0)\), \((1,0)\), and \((-1,0)\). Calculate their coherence.
  4. An analysis reports no reciprocal pairs. What should it report for correction-vector coherence, and why?
  5. Why can high coherence coexist with weak evidence that the MNN pairs are biologically appropriate?

Solutions. (1) \(R_r=0.30/\sqrt{0.25(0.36)}=0.30/0.30=1\); the cross-batch distance equals the geometric mean of the local scales, which is a contextual comparison rather than a pass/fail result. (2) There are two distinct pairs because each pair is counted once by its batch A cell; \(2/6=1/3\) of batch A cells are matched. (3) The unit-vector sum is \((1,0)\), with norm 1, so \(C=1/3\). (4) Coherence is undefined because there are no vectors to average; it is not zero. (5) Coherence describes directional agreement only. It ignores vector magnitude and does not establish that paired cells share a biological state.

Clinical Biostats