Mapping a Query to a Fixed Reference
Reference-based anchor mapping asks a directional question: where should cells in a new query dataset be placed relative to an existing reference? The reference supplies a coordinate system that is held fixed. Anchor pairs connect cells judged to represent shared states across the two datasets, and their local displacements are used to adjust query coordinates. This is useful when a reference atlas must remain stable as new samples arrive, but it does not make the reference complete or guarantee that every query cell has a valid counterpart.
The central distinction is between correcting the query and jointly integrating datasets. In reference-based mapping, the reference coordinates are the target and are not changed by the query. In joint integration, the datasets are generally aligned as a collection, so the resulting coordinates can depend on which datasets were included and how they were integrated. A fixed reference therefore supports a consistent coordinate frame across successive queries, provided the same reference representation and mapping procedure are used.
Both datasets must be represented on a compatible basis for these differences to be meaningful. In practice, this requires compatible features and a shared latent representation, such as a representation constructed or projected using the reference. The coordinates should also have comparable normalization and scale. A vector difference between coordinates from unrelated spaces has no well-defined interpretation as a batch correction.
For a query cell with relevant anchors, let \(w_{i\ell}\) be a nonnegative weight expressing how much anchor \(\ell\) contributes to the local correction of cell \(i\). The normalized weights sum to one, and the correction is their weighted average. Anchor selection and reliability assessment are prerequisites: the calculation cannot turn an invalid anchor into evidence of a shared state.
Here \(\mathcal{A}_i\) is the set of anchors used for query cell \(i\). The weights may reflect local proximity or anchor reliability, but their construction is method-dependent. The essential interpretation is that \(c_i\) estimates a local shift from query coordinates toward the reference. If the correction vectors around a cell are inconsistent, a single weighted average may obscure rather than resolve that inconsistency.
Why the Weighted Correction Is a Local Estimate
The weighted-average formula can be justified as the constant vector that best represents the anchor displacements under weighted squared error. For a fixed query cell \(i\), consider choosing a vector \(c\) to minimize the weighted sum of squared distances between \(c\) and the contributing anchor vectors. The weights are held fixed, nonnegative, and normalized to sum to one.
Differentiating with respect to the vector \(c\), setting the gradient to zero, and using the weight normalization gives the minimizer:
Thus the weighted correction is the least-squares summary of the selected anchor displacements. This derivation justifies the average once the anchors and weights have been chosen; it does not prove that those anchors represent true biological correspondences. Nor does it justify using a local translation when the displacement changes sharply across the neighborhood. Mapping is most plausible where shared states are represented in both datasets and the query-to-reference shift varies smoothly enough for nearby anchors to inform the query cell.
Worked Example: Correcting a Query Cell From Two Anchors
Suppose a two-dimensional shared representation contains two anchor pairs. The query anchor coordinates are \(z_{q_1}^Q=(1,1)\) and \(z_{q_2}^Q=(1,3)\); the corresponding reference coordinates are \(z_{r_1}^R=(2,1)\) and \(z_{r_2}^R=(1.6,3.2)\). A query cell has coordinate \(z_i^Q=(1.2,1.4)\), and the mapping assigns weights \(w_{i1}=0.75\) and \(w_{i2}=0.25\).
The anchor vectors, with the direction defined from query to reference, are \(d_1=(2,1)-(1,1)=(1,0)\) and \(d_2=(1.6,3.2)-(1,3)=(0.6,0.2)\). The weights are nonnegative and sum to \(0.75+0.25=1\), so the weighted correction is
The corrected query coordinate is \(z_i^{Q,*}=(1.2,1.4)+(0.90,0.05)=(2.10,1.45)\). These are coordinates in the shared latent space, not gene-expression units. The calculation moves this query cell toward the reference using the specified local anchors; by itself, it does not establish a cell type or a biological effect.
Assumptions and the Fixed-Reference Advantage
Several conditions support a useful mapping. First, the reference and query must have a meaningful shared representation. Second, the anchors used for a cell must connect genuinely shared states rather than merely nearby but biologically distinct cells. Third, there must be enough relevant anchors around the query cell to estimate its local displacement. Finally, a local correction should be a reasonable approximation: anchor displacements near that cell should provide relevant information about its shift. These are substantive assumptions, not consequences of the weighted-average calculation.
Holding the reference fixed has practical advantages. Its coordinates and annotations do not move when a new query is processed, and separate queries can be mapped to the same coordinate frame. This is valuable for atlas updating and repeated projection. It also means the mapping is directional: it estimates how to place the query relative to the reference, rather than finding a compromise alignment that adjusts both datasets.
The fixed frame does not imply that the query is biologically identical to the reference. Mapping can produce corrected coordinates even where overlap is weak, so the numerical existence of \(z_i^{Q,*}\) is not evidence that the cell has a well-supported reference counterpart. Nor does a coordinate mapping automatically transfer a label. Label transfer is a separate inference that uses mapped locations or other evidence and should reflect uncertainty in the match.
Worked Example: A Query State Missing From the Reference
Consider a reference containing two states, with coordinates \((1,0)\) and \((1,2)\). For the shared query states, suppose the corresponding query anchors are \((0,0)\) and \((0,2)\). Both anchor displacements are therefore \((1,0)\). Now suppose a query cell from a third, distinct state is at \((5,0)\), and the mapping uses the nearest available anchor displacement.
The nearest query anchor is \((0,0)\), at distance \(\sqrt{(5-0)^2+(0-0)^2}=5\), compared with distance \(\sqrt{(5-0)^2+(0-2)^2}=\sqrt{29}\approx5.385\) to the other anchor. The nearest-anchor correction is \((1,0)\), so the mapped coordinate is
This calculation does not create a reference counterpart for the third state. In this hypothetical example, the corrected cell remains far from both reference states. If a downstream rule nevertheless assigned it the label of the nearest reference cell, that label would not be justified by the correction arithmetic alone. A state absent from the reference cannot be represented as a distinct reference state merely by translating query coordinates.
Mapping Versus Joint Integration
The two strategies answer different questions. Reference mapping asks how to express query cells relative to a designated, fixed target. Joint integration asks how to place the included datasets into a common representation through an alignment that can involve all of them. A joint solution may be appropriate when the goal is a shared analysis of a specified collection of datasets; reference mapping is useful when preserving a stable reference frame is important. Neither strategy guarantees that biological differences and technical differences can be separated without adequate shared-state information.
| Feature | Reference-based anchor mapping | Joint integration |
|---|---|---|
| Coordinates held fixed | The reference coordinates are the target and remain unchanged. | Datasets are aligned as a collection; coordinates may change for multiple datasets. |
| Direction | Directional: query is placed relative to the reference. | Typically treats the included datasets as participants in a shared alignment. |
| Adding another dataset | A new query can be mapped to the same reference frame, subject to the same representation and procedure. | The joint result can depend on the datasets included in the integration. |
| Key limitation | Cannot supply a distinct reference state that is absent from the reference. | Joint alignment also cannot establish missing biological states simply by integrating datasets. |
Worked Example: Two Queries in One Reference Frame
Suppose the reference contains cells at coordinates \((2,0)\) and \((2,2)\), and the two shared anchor pairs imply the same query-to-reference displacement \(d=(1,0)\). Query A contains a shared-state cell at \((1.1,0.4)\); Query B contains a shared-state cell at \((0.8,1.6)\). If each cell receives the single-anchor correction \((1,0)\), their mapped coordinates are
The reference stays at \((2,0)\) and \((2,2)\) for both mappings. The query coordinates are expressed in the same reference frame, making their locations comparable under the stated shared representation and correction. This does not mean the two queries were jointly optimized, or that their biological composition is the same.
Diagnostics, Failure Modes, and Interpretation
A mapping result should be evaluated in light of its assumptions. Relevant checks include whether the query and reference use compatible features and representations, whether mapped shared-state cells occupy plausible reference neighborhoods, and whether the anchors contributing to a cell give coherent displacement estimates. These checks can reveal that a calculation is poorly supported, but no geometric diagnostic can prove biological equivalence. A query cell far from the regions supported by anchors deserves particular caution; the weighted formula may still return a coordinate, even when the local evidence is inadequate.
- Reversing the displacement. Using \(z_{q_\ell}^Q-z_{r_\ell}^R\) and then adding it to the query moves in the opposite direction. Keep the convention \(d_\ell=z_{r_\ell}^R-z_{q_\ell}^Q\).
- Changing the reference inadvertently. Updating reference coordinates during query correction changes the target frame and defeats the fixed-reference interpretation.
- Equating a mapped coordinate with a valid match. A formula can return coordinates without adequate overlap or reliable anchors. Treat the output as a mapping estimate, not proof of a shared cell state.
- Forcing a label for an unrepresented state. The nearest available reference label may be a poor description when the query state has no reference counterpart. Report the limitation rather than interpreting forced proximity as evidence.
- Confusing latent coordinates with expression values. A correction in a low-dimensional representation does not, on its own, define corrected gene-expression counts or establish which genes caused a shift.
Reference mapping is particularly useful for projection into a stable atlas, but it inherits the atlas’s coverage limitations. If an important query state is absent from the reference, mapping cannot recover that state as a new reference category. The result may still help locate related cells or highlight a mismatch, but biological conclusions about the absent state require evidence beyond the mapped coordinate. In contrast, joint integration changes the alignment target by considering multiple datasets together; it does not remove the fundamental need to distinguish shared states from genuinely different ones.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- An anchor has query coordinate \((2,1)\) and reference coordinate \((3,0)\). What is its correction vector under the convention used here?
- Two anchors have correction vectors \((1,0)\) and \((0,2)\), with normalized weights \(0.4\) and \(0.6\). Find the weighted correction.
- Why does reference-based mapping leave reference coordinates unchanged, and how does that differ from the aim of joint integration?
- A query cell is mapped near a reference cell, but the query state is not represented in the reference. What can and cannot be concluded from the mapped location?
Solutions. (1) \(d=(3,0)-(2,1)=(1,-1)\). (2) \(c=0.4(1,0)+0.6(0,2)=(0.4,1.2)\). (3) The reference defines the target coordinate frame, so the query is adjusted relative to it; joint integration aligns the included datasets as a collection and may adjust multiple datasets. (4) The location is a geometric mapping estimate, not evidence that the reference contains that state or that a transferred label is correct. The missing state cannot be recovered as a distinct reference state by correction alone.