Why the Feature Space Matters
A mutual nearest neighbor (MNN) is defined through distances between cells, so it depends not only on which cells are present but also on which features define those distances. A cell pair can be mutual nearest neighbors in one representation and not in another. Choosing genes and dimensions is therefore part of defining the alignment problem, not a neutral preprocessing detail.
Let \(x_i\) denote the normalized expression vector for cell \(i\), with one coordinate per gene. An integration feature space is specified by a set of genes \(G\), any scaling or transformation applied to those genes, and possibly a projection to fewer dimensions. Write the resulting representation as \(z_i=T_G(x_i)\). Distances such as Euclidean distance between \(z_i\) and \(z_j\) determine the neighbor rankings. For MNNs, the cells must also be reciprocal nearest neighbors across the batches; a nearest candidate in only one direction is not, by itself, an MNN.
A useful space should make distances reflect cell-state differences that are relevant to the intended integration target, while limiting variation that is mostly technical or irrelevant to that target. This is a trade-off: excluding informative genes can erase real distinctions, while including noisy or biologically variable genes can create misleading local geometry. The shared-state assumptions and the intended target matter: integration should not be expected to align states that are genuinely absent from one batch.
How Extra Features Change Distances
For a selected set of \(p\) coordinates, squared Euclidean distance is the sum of the squared coordinate differences. Adding coordinates adds nonnegative terms to every squared distance, but it need not add the same amount for each candidate pair. A pair that is close on a few useful features can become farther than another pair if it differs substantially on added features.
A simple noise model helps explain the risk. Suppose \(q\) added coordinates are irrelevant to the cell-state distinctions of interest, and each cell has independent noise with variance \(\tau^2\) on each such coordinate. For any pair of cells, the expected added squared distance is \(2q\tau^2\). This common expectation does not necessarily change the expected ordering of pairwise distances. However, the realized noise contribution differs from pair to pair, so it can obscure small differences in the informative coordinates and change nearest-neighbor rankings. Indeed, each coordinate's squared difference has variance \(8\tau^4\), so the variance of the total added squared distance is \(8q\tau^4\), under this model.
The calculation assumes independent, mean-zero Gaussian noise in each cell and coordinate, with the same variance. Real expression data need not satisfy those assumptions; the calculation is a justification for concern about added noisy dimensions, not a complete model of expression. In practice, a feature can be noisy in one batch, dominated by dropout, or variable for reasons unrelated to the shared states being aligned.
Worked Example: A Noisy Feature Reverses the Closest Candidate
Suppose a cell in batch A has two informative coordinates, giving it two candidate cells in batch B. On the informative coordinates, candidate M differs by \((0.2,0)\), while candidate N differs by \((0.8,0)\). M is closer using these coordinates:
Now add two coordinates that are noisy for this comparison. Suppose M's differences on them are \((0.8,0.8)\), whereas N's are \((0,0)\). The full squared distances are
With only the informative coordinates, M is closer; with all four coordinates, N is closer. These hypothetical values show how realized noise differences can reverse a neighborhood ranking. They do not establish an MNN: one must still check whether the candidate is also nearest in the reverse batch-to-batch direction.
Biological Variation Can Be Misleading for Alignment
Not all problematic features are technical noise. A gene can be measured reliably yet vary because of a condition, activation program, cell cycle, or other biological axis that is not meant to define the shared-state correspondence. If that axis differs systematically across batches, it can dominate distances and pull neighborhoods toward cells that are similar on that axis but not on the identity of interest. Earlier material on confounding is relevant here: if condition and batch are inseparable in the data, feature selection alone cannot identify which differences are batch effects and which are condition effects.
Worked Example: Identity and Condition Coordinates Compete
Consider a cell \(A=(0,0)\) in batch A, where the first coordinate represents an identity-related feature and the second a condition-associated feature. Two candidates in batch B are \(B=(0.4,0.1)\), intended to represent the same identity, and \(C=(0.05,0.3)\), intended to represent a different identity. On the identity coordinate, C is closer to A: its difference is \(0.05\), compared with \(0.4\) for B. On the condition-associated coordinate, B is closer: its difference is \(0.1\), compared with \(0.3\) for C.
Using both coordinates with ordinary Euclidean distance gives
Thus C is closer in the full space: its advantage on the identity coordinate outweighs B's advantage on the condition-associated coordinate. If the condition coordinate were given much greater weight, the ranking could change. For example, multiplying that coordinate by 2 gives squared distances \(0.4^2+(2\times0.1)^2=0.20\) for B and \(0.05^2+(2\times0.3)^2=0.3625\) for C, so B becomes closer. This is a hypothetical illustration of how weighting can change candidate rankings; it does not show that either candidate is a mutual nearest neighbor.
Highly variable genes are often useful because they can distinguish cell states, but high variability alone is not evidence that a gene is suitable for alignment. A batch-specific technical effect can make a gene variable, as can a genuine biological program whose differences should be preserved. Conversely, a gene with modest overall variability may still be important for a rare but relevant state. Feature selection should therefore be checked against the integration target and the experimental design rather than treated as an automatic rule.
Selected Genes and Reduced-Dimension Representations
Using selected genes directly retains a clear coordinate-to-gene interpretation. A low-dimensional representation, such as a truncated principal-component representation, can reduce the number of coordinates and concentrate broad patterns of variation. But a projection changes the distance geometry: it retains variation in directions included in the projection and discards variation in omitted directions. Principal components are ordered by total variance, not by whether a direction represents shared cell identity, technical variation, or a biological difference that should remain distinct.
For an orthonormal projection onto the first \(r\) component directions, the squared distance in the projected representation is the sum of squared differences along those directions. It is no greater than the full squared distance, because omitted squared coordinate differences are nonnegative. The ranking of pairs, however, can change: different pairs lose different amounts of distance when their differences lie in omitted directions.
Here \(v_k\) are orthonormal projection directions and \(P_r\) retains the first \(r\) directions. The inequality follows by expressing the difference in a complete orthonormal basis: the full squared norm sums the squared coefficients over all directions, while the projection sums only the first \(r\). This justification assumes an orthonormal projection and the same original coordinate scaling on both sides. If genes are rescaled before projection, that scaling defines a different geometry.
Worked Example: Truncating a Component Changes the Nearest Cell
Suppose the first component mainly reflects a broad, high-variance expression pattern, while a second component contains a useful distinction between two cell states. In a two-dimensional representation, cell A in batch A is at \((0,0)\), and two batch-B candidates are \(B=(0.2,1)\) and \(C=(0.6,0)\). With both coordinates retained,
C is closer in the two-dimensional space. If only the first coordinate is retained, the distances become \(0.2\) for B and \(0.6\) for C, so B is closer. If the second coordinate carries the relevant state distinction, truncating to the first component has removed information that mattered for this comparison. The hypothetical example does not imply that retaining more components is always better: additional dimensions can also add noise or unwanted variation.
Choosing and Checking a Representation
A defensible choice begins with the biological target and then examines how plausible feature choices affect neighborhoods. There is no universally optimal number of genes or components: the answer depends on the scale of shared states, the noise structure, the normalization and scaling, and which differences the analysis is intended to preserve.
Specify the cell states expected to be shared across batches and the biological differences that should remain distinguishable. If batch and condition are confounded, do not treat a convenient feature choice as a solution to non-identifiability.
Use features that plausibly encode shared state, and inspect whether extreme variation is driven by technical effects or biology outside the alignment target. Keep the gene set and preprocessing consistent across batches when calculating cross-batch distances.
Repeat the neighbor calculation under reasonable alternatives, such as a different feature set or a different number of retained dimensions. Check whether candidate neighborhoods persist or change sharply; a sensitive ranking signals that the proposed matches depend strongly on the representation.
Examine whether neighbors agree on known cell-state markers and whether batch-specific patterns or condition-associated programs dominate the selected coordinates. This is a diagnostic, not proof that the shared-state assumptions hold.
Comparing alternatives has practical limits. Selected-gene distances are interpretable but can be sensitive to which genes are included and how they are scaled. Truncated PCA can make neighborhoods less sensitive to individual genes, but may discard low-variance, biologically important directions or retain high-variance technical and condition effects. Increasing the number of dimensions preserves more of the original variation but can also admit more noisy coordinates. No option removes the need to check whether the resulting neighborhoods make sense for the intended integration target.
Warning signs include neighbor rankings that change substantially with small feature-set or dimension-count changes, matches driven by a small number of strongly varying coordinates, and apparent matches that disagree on known state markers. These signs do not prove the matches are wrong, but they call for investigation. In particular, a visually compact integrated representation is not by itself evidence that the chosen feature space produced valid cross-batch correspondences.
Check Your Understanding
Answer the questions, then compare your reasoning with the solutions below.
- Two candidate cells have distances 0.3 and 0.5 on selected informative genes. After adding noisy coordinates, their full distances are 0.9 and 0.6. Which candidate is nearest in each representation, and what does this tell you?
- Why can a highly variable gene be a poor choice for defining cross-batch neighborhoods?
- With an orthonormal projection, why can projected distance be smaller than full distance, even though the neighbor ranking can change?
- Does finding that one cell is another cell's nearest neighbor establish an MNN match? Explain.
Solutions. (1) The first candidate is nearer using the selected informative genes because \(0.3<0.5\); the second is nearer using the full representation because \(0.6<0.9\). The reversal shows that added coordinates changed the ranking, so the neighborhood depends on the feature space. (2) High variability can reflect technical noise, batch effects, or biological variation outside the integration target, rather than shared cell-state information. (3) An orthonormal projection sums squared differences only along retained directions, omitting nonnegative squared contributions from other directions. Different pairs can lose different amounts, so their distance ordering can change. (4) No. An MNN requires reciprocity: each cell must be the other's nearest neighbor across the batches under the chosen representation and distance rule.