Why Search for Anchors in a Shared Space?
To integrate two single-cell datasets, we need a way to identify cells that may represent the same underlying state despite being measured in different batches. The earlier material on anchor pairs established their role as evidence for shared cell states. Here the task is operational: given cell coordinates in a shared latent space, determine which cross-dataset pairs qualify as anchors under a reciprocal-neighbor rule.
A latent representation assigns each cell a vector of coordinates, usually in fewer dimensions than the original expression data. The coordinates can be compared across datasets only when they are expressed in a common, comparable space. Having the same number of coordinates is not sufficient: coordinate axes, scales, and distances must have a meaningful relationship across the datasets.
The search is cross-dataset: when finding \(N_B^k(i)\), compare cell \(i\) with cells in \(B\), not with other cells in \(A\). Then reverse the roles of the datasets to check whether the relationship is reciprocal. Unless stated otherwise, the examples use Euclidean distance, \(d(\mathbf{u},\mathbf{v})=\sqrt{\sum_{\ell=1}^{d}(u_\ell-v_\ell)^2}\). The same rule can be defined with another distance, but the choice must be made consistently for both directions.
How the Reciprocal Rule Works
A one-way nearest-neighbor search answers, “Which cell in \(B\) is closest to this cell in \(A\)?” That may produce a match even when the \(B\) cell is much closer to a different \(A\) cell. Reciprocal matching requires both cells to select each other within their respective cross-dataset neighborhoods. It is therefore a rule for proposing pairs, not a statistical test and not a guarantee of biological identity.
Confirm that all compared coordinates lie in the same interpretable latent space, and specify the distance used for neighbor searches.
For every cell \(i\) in \(A\), rank cells in \(B\) by distance and record the first \(k\).
For every cell \(j\) in \(B\), rank cells in \(A\) and record the first \(k\).
Record \((i,j)\) only when each cell appears in the other cell’s recorded neighbor set.
If distances tie at the \(k\)th position, the neighbor-set convention matters. One option is to include all cells tied at the boundary, which can make a neighborhood larger than \(k\). Another is to apply a stated deterministic tie-breaking rule and retain exactly \(k\) cells. The examples below have no ties. A reported anchor set should be reproducible under the chosen convention.
Worked Example: Finding Reciprocal Pairs in Two Dimensions
Suppose a hypothetical shared embedding contains two cells in each dataset: \(A_1=(0,0)\), \(A_2=(4,0)\), \(B_1=(0.8,0)\), and \(B_2=(3.2,0)\). Use Euclidean distance and \(k=1\).
For \(A_1\), the distances to \(B_1\) and \(B_2\) are \(\sqrt{(0-0.8)^2+(0-0)^2}=0.8\) and \(\sqrt{(0-3.2)^2+(0-0)^2}=3.2\). Thus \(N_B^1(A_1)=\{B_1\}\). For \(A_2\), the distances are \(3.2\) to \(B_1\) and \(0.8\) to \(B_2\), so \(N_B^1(A_2)=\{B_2\}\).
Now search in the reverse direction. \(B_1\) is \(0.8\) units from \(A_1\) and \(3.2\) units from \(A_2\), so \(N_A^1(B_1)=\{A_1\}\). Similarly, \(N_A^1(B_2)=\{A_2\}\). Both nearest-neighbor relationships are reciprocal. The anchor pairs are \((A_1,B_1)\) and \((A_2,B_2)\).
The calculation establishes that these pairs are nearest to each other under this representation, distance, and value of \(k\). It does not establish that the cells have identical expression profiles or that they are biologically interchangeable.
Why Reciprocity Removes One-Sided Matches
The reciprocal rule can be understood as intersecting two directed neighbor relations. The first search creates arrows from each cell in \(A\) to its selected neighbors in \(B\); the reverse search creates arrows from \(B\) to \(A\). An anchor is a pair joined by arrows in both directions. This intersection removes a directed match when only one member considers the other sufficiently close.
For \(k=1\), if \(A_i\) and \(B_j\) are mutual nearest neighbors, then each is the closest cell in the other dataset. With \(k>1\), the requirement is weaker: each must fall within the other’s \(k\) nearest cells, but neither must be the single closest. Thus the neighborhood size controls how permissive the reciprocal rule is.
Worked Example: A One-Way Match Is Not an Anchor
Consider hypothetical one-dimensional coordinates \(A_1=0\), \(A_2=0.4\), \(B_1=0.1\), and \(B_2=10\), with Euclidean distance and \(k=1\).
From \(A_1\), the distances are \(|0-0.1|=0.1\) to \(B_1\) and \(|0-10|=10\) to \(B_2\), so \(A_1\) selects \(B_1\). From \(A_2\), the distances are \(|0.4-0.1|=0.3\) and \(|0.4-10|=9.6\), so \(A_2\) also selects \(B_1\).
In the reverse search, \(B_1\) is closer to \(A_1\): its distances are \(0.1\) to \(A_1\) and \(0.3\) to \(A_2\). Hence \(B_1\) selects \(A_1\), making \((A_1,B_1)\) reciprocal. Although \(B_2\) selects \(A_2\), \(A_2\) selects \(B_1\), not \(B_2\). Therefore \((A_2,B_2)\) is a one-way nearest-neighbor match, not an anchor.
Neighborhood Size and Interpretation
The value of \(k\) is part of the anchor definition. A small \(k\) makes the rule selective: a pair must rank near the top in both searches. A larger \(k\) allows more pairs, including pairs that are not each other’s single closest match. Increasing \(k\) does not by itself show that the additional pairs are reliable; it only changes the rank threshold.
Worked Example: How Increasing \(k\) Adds Candidate Pairs
Use hypothetical one-dimensional coordinates \(A_1=0\), \(A_2=2\), \(B_1=0.2\), and \(B_2=1.8\). At \(k=1\), \(A_1\) has distances \(0.2\) to \(B_1\) and \(1.8\) to \(B_2\), while \(A_2\) has distances \(1.8\) to \(B_1\) and \(0.2\) to \(B_2\). The reverse searches give the same closest pairings, so the anchors are \((A_1,B_1)\) and \((A_2,B_2)\).
At \(k=2\), each cell’s neighbor set contains both cells in the other dataset. For example, \(N_B^2(A_1)=\{B_1,B_2\}\), and \(N_A^2(B_2)=\{A_1,A_2\}\). Every cross-dataset pair is now reciprocal: \((A_1,B_1)\), \((A_1,B_2)\), \((A_2,B_1)\), and \((A_2,B_2)\). The extra pairs arise from the less restrictive rank threshold, not from new evidence that those cells represent the same state.
Assumptions, Diagnostics, and Alternatives
Reciprocal-neighbor identification relies on several substantive and computational conditions. First, the coordinates must be comparable across datasets: distances between an \(A\) cell and a \(B\) cell must have an interpretable meaning. Second, shared cell states must be represented in both datasets well enough that corresponding cells can be near each other. Third, the chosen distance should reflect relevant latent-space proximity, and the embedding should not be dominated by an irrelevant scale or dimension. Finally, the chosen \(k\) must be suitable for the intended search; it directly changes the candidate set.
Practical diagnostics include checking that neighbor searches were restricted to the intended cross-dataset comparison, confirming the embedding dimensions and distance metric, and inspecting the number and distribution of reciprocal pairs across the datasets. An unexpectedly empty set can indicate a lack of shared states, incompatible representations, or an overly restrictive search. A very large set can follow from a large \(k\), dense or tied neighborhoods, or weak separation among cells. These observations diagnose the search output; they do not identify a single cause without further investigation.
Reciprocal matching is more restrictive than one-way nearest-neighbor matching because it requires agreement from both cells. It is related to mutual nearest neighbors used in batch alignment: both use cross-dataset reciprocal proximity, while the present definition emphasizes candidate anchors in a shared latent representation. Searching in a shared space is not a substitute for checking whether that space is appropriate. Other approaches can use one-way assignments or compare cells in a different representation, but those choices answer different matching questions. The choice between particular latent representations is a separate methodological decision.
- Do not equate an anchor with a confirmed cell identity. It is a candidate pair supported by reciprocal proximity under specified choices.
- Do not assume equal dimension means shared coordinates. Two embeddings with the same number of axes can still be incomparable.
- Do not report \(k\) without the distance and tie rule. Together, these choices determine the neighbor sets.
- Do not treat more anchors as automatically better. Increasing \(k\) can add pairs by construction, including weakly specific matches.
Check Your Understanding
For each question, first determine the relevant neighbor sets; then compare your reasoning with the solutions below.
- In a shared one-dimensional embedding, \(A_1=1\), \(A_2=5\), \(B_1=2\), and \(B_2=4\). With Euclidean distance and \(k=1\), which pairs are anchors?
- Suppose \(B_1\) is among the two nearest cells in \(B\) to \(A_1\), but \(A_1\) is not among the two nearest cells in \(A\) to \(B_1\). Is \((A_1,B_1)\) an anchor? Explain.
- What happens to the neighbor sets when \(k\) increases from 1 to 3, assuming a fixed distance ranking and no change in tie handling?
- Why is it not enough for two datasets’ embeddings to have the same number of dimensions?
Solutions. (1) From \(A_1=1\), the distances to \(B_1=2\) and \(B_2=4\) are 1 and 3, so \(A_1\) selects \(B_1\). From \(A_2=5\), the distances are 3 and 1, so \(A_2\) selects \(B_2\). In reverse, \(B_1\) is closer to \(A_1\) than \(A_2\), and \(B_2\) is closer to \(A_2\) than \(A_1\). The anchors are \((A_1,B_1)\) and \((A_2,B_2)\). (2) No. Reciprocity requires both membership conditions; one failed condition is enough to exclude the pair. (3) Each neighbor set retains its previous members and may gain more, so additional pairs may become reciprocal; existing reciprocal pairs remain reciprocal. (4) Equal dimension only means the vectors have the same number of entries. Their axes, scales, or meanings may differ, making cross-dataset distances uninterpretable.