Why Harmonization Errors Matter
A polygenic risk score (PRS) combines many genotype dosages with their estimated effects. A variant can enter that sum with the wrong effect allele, at the wrong genomic position, or more than once. Each error may change a score even when the arithmetic in the final calculation is correct. In a large score, errors can be difficult to notice by inspecting individual predictions; a few wrongly oriented effects may also partially cancel, masking the problem.
The earlier material on allele harmonization and dosage coding establishes the basic requirement: each effect estimate must be paired with a dosage that counts the same allele. This tutorial focuses on three data-integrity problems that complicate that pairing: strand ambiguity at palindromic variants, mismatches between genome builds, and duplicated variant identifiers.
Strand Ambiguity at A/T and C/G Variants
DNA alleles are reported on a reference strand, but data sources may represent the opposite strand. Complementation changes A to T, T to A, C to G, and G to C. For a non-palindromic pair such as A/G, the complementary pair is T/C, which is distinguishable from A/G if the allele pair is known. The pairs A/T and C/G are palindromic: their complements have the same unordered allele labels. Consequently, labels alone cannot tell whether two files use the same strand or opposite strands.
Frequency information can sometimes help. For example, if the discovery effect allele has frequency 0.20, while a target allele has frequency 0.79, comparing both allele orientations may favor the target's complementary allele, whose frequency is about 0.21. But a frequency comparison is supporting evidence, not proof. Sampling uncertainty, differences in ancestry or imputation, and allele-frequency changes between cohorts can all weaken the comparison. When both frequencies are close to 0.5, the two orientations can be especially hard to distinguish.
Worked Example: Frequency Evidence for a C/G Variant
Suppose a discovery file reports the effect allele as C, with estimated frequency 0.49. A target cohort reports C frequency 0.51 and G frequency 0.49. The variant is C/G, so its allele labels are unchanged by strand complementation. Which target allele is more consistent with the discovery effect allele?
The target G frequency, 0.49, matches the discovery C frequency, 0.49; the target C frequency is 0.51. Thus the frequency comparison numerically favors matching discovery C to target G. It does not establish that orientation with certainty: both frequencies are close to 0.5, and the uncertainty of the estimates and comparability of the populations have not been established.
If subsequent checks support that match, the discovery effect estimate is still an effect per copy of the same biological allele, now labelled G in the target representation. The coefficient remains \(\beta\) when the target dosage counts G. If the available target dosage instead counts C, the dosage is for the opposite allele and its coefficient must be \(-\beta\) to preserve the same genetic contrast.
The sign change for recoding can be shown directly. For a diploid biallelic variant, if \(d\) counts one allele, the dosage of the other allele is \(2-d\). If the original contribution is \(\beta d\), then expressing it using the opposite dosage gives
Thus the opposite-allele coefficient is \(-\beta\), with a constant shift of \(2\beta\) in an uncentered score. If genotypes and effects are centered consistently, the contribution is exactly unchanged by recoding: with allele frequency \(f\), \(\beta(d-2f)=(-\beta)\{(2-d)-2(1-f)\}\). This is why changing the dosage allele requires changing the effect sign; complementing the strand label while continuing to count the same biological allele does not.
Genome-Build Mismatches
A genome build is a particular reference assembly that assigns genomic coordinates and reference sequences. A coordinate such as chromosome 2, position 100,000 is incomplete unless its build is known. The same variant may have a different coordinate in another assembly because the reference sequence and its numbering can differ. Therefore, joining discovery and target files by chromosome and position is safe only when their build and coordinate conventions agree.
A coordinate conversion, often called liftover, maps positions from one assembly to another. It is a useful way to reconcile builds, but a successful coordinate mapping alone does not prove that the records represent the intended variant. After conversion, check the destination reference allele and the alternate allele against the destination reference sequence, accounting for strand representation. If the mapping is ambiguous, fails, or produces an incompatible reference allele, do not silently keep the row as though it were verified.
Worked Example: Converting a Position Before Matching
Suppose a discovery summary reports a biallelic variant as build 37, chromosome 2, position 100,000, reference A, alternate G, with effect allele G and \(\beta=0.12\) outcome units per G allele. The target genotype file is in build 38 and reports the corresponding variant at chromosome 2, position 101,234. For one target individual, the dosage of G is 1.70. Assume a validated conversion maps the discovery record to that build 38 position and reference checks confirm the same A/G variant.
After this validation, the contribution is
The contribution is 0.204 outcome units on the model's score scale. Matching the original position 100,000 directly to the build 38 file would fail to find the variant, potentially omitting this contribution. More dangerously, an unvalidated coordinate assumption could pair the effect with a different variant that happens to occupy a similar position. The validated conversion and allele check, not numerical proximity, justify the match.
Build checks should be applied consistently, not only to variants that fail an initial join. Useful diagnostics include counting records that fail conversion, checking for multiple source positions mapping to one destination position, and tabulating reference-allele mismatches after conversion. A high mismatch rate can indicate an incorrect build label, a strand issue, or an unsuitable conversion rather than a handful of harmless exceptions.
Duplicated Identifiers and Ambiguous Records
An rsID is useful metadata, but an identifier alone is not a sufficient guarantee that two rows can be joined one-to-one. Duplicates may arise from repeated rows, merges of files, multiple allele records, or inconsistent annotations. Two rows with the same identifier may be exact duplicates, may describe distinct records, or may disagree in position or allele coding. A join on a duplicated key can multiply rows and thereby count a score contribution more than once.
A robust variant key includes the genome build, chromosome, position, reference allele, and alternate allele, with a consistent representation of the alleles. Keep the rsID as an additional cross-check rather than treating it as the sole key. Before scoring, inspect duplicate keys and determine whether they are exact copies, alternative representations of the same variant, or conflicting records. Do not resolve conflicts by arbitrarily retaining the first row.
Worked Example: A Duplicate Row Doubles a Contribution
Suppose the harmonized target data contain one row for a variant, with effect allele G and dosage 1.20 for an individual. The GWAS effect for G is \(\beta=0.10\). The correct contribution is
Now suppose a file merge has duplicated that exact variant row, and the scoring program sums both rows. The computed contribution becomes
The score is inflated by \(0.240-0.120=0.120\) for this individual from this duplicated record. The error is not fixed by the fact that both rows have the same rsID or the same dosage: those facts are precisely why a duplicate can pass an unexamined join and be counted twice. Deduplicating is appropriate only after confirming that the rows are redundant; conflicting rows require investigation.
A Practical Harmonization and Audit Sequence
The following sequence separates identity checks from allele-orientation checks. It is designed to catch errors before score calculation, when they are easier to localize.
Record each file's genome build, coordinate convention, strand and allele coding, and whether dosages count the effect allele or another allele.
Use build-aware coordinates and allele fields to match records. Convert coordinates where needed, then validate converted reference alleles against the destination assembly.
Check whether the target dosage counts the discovery effect allele. Complement allele labels when the strand differs; reverse the effect sign only when the dosage is recoded to the opposite allele.
For A/T and C/G variants, use reliable frequency evidence only when allele frequencies are comparable and orientation is sufficiently clear. Otherwise exclude or separately report the unresolved records.
Check for duplicate keys, conflicting rows, unexpected missing matches, and implausible score changes. Reconcile the number of source, matched, excluded, and scored variants.
This workflow relies on accurate build annotations, correct reference sequence data, and allele-frequency estimates from populations relevant to the comparison. It cannot recover missing or erroneous provenance. If allele orientation remains uncertain, exclusion with transparent reporting is safer than guessing: a smaller correctly harmonized score is preferable to a larger score with unknown sign errors.
Alternatives, Diagnostics, and Common Pitfalls
| Approach | Useful when | Main limitation |
|---|---|---|
| Match by rsID alone | As an initial lookup or cross-check | Does not by itself verify build, alleles, or unique records |
| Match by build-aware position and alleles | Build and allele fields are reliable | Can fail with inconsistent builds or strand conventions |
| Use allele frequencies to orient palindromic variants | Frequency estimates are precise and populations comparable | May not distinguish orientations, especially near frequency 0.5 |
| Exclude unresolved or conflicting variants | Identity or orientation cannot be verified | Reduces the set of scored variants and should be reported |
Several diagnostics help identify a failing harmonization. Inspect how many variants match before and after build conversion; list reference-allele disagreements and duplicate keys; compare effect-allele frequencies only after ensuring the compared alleles are correctly identified; and review a sample of records by hand. Also compare score distributions and per-variant contributions before and after harmonization. Large shifts may be explainable, but are a reason to investigate, not proof that one version is correct.
Common mistake: “The allele letters match, so the effect estimate and dosage are aligned.” That reasoning fails for palindromic variants: C/G has the same labels on either strand, and matching letters does not establish which allele the dosage counts. The correction is to verify variant identity and dosage coding, use frequency evidence cautiously if appropriate, and leave orientation unresolved when the evidence is inadequate. A related mistake is to flip \(\beta\) merely because strand labels were complemented. Complementation changes the label; the sign changes only if the dosage is recoded to count the opposite allele.
A second frequent mistake is treating a successful identifier join or coordinate conversion as a complete validation. Neither guarantees unique, correct allele correspondence. Build, reference allele, dosage allele, and record uniqueness each require their own check. No single diagnostic can certify all four.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- A discovery effect is reported per A allele at an A/T variant. The target dosage counts T. What must happen to the coefficient if that target dosage is used directly?
- A discovery record is build 37, while the target file is build 38. Why is joining on chromosome and numeric position alone unsafe, and what should be checked after coordinate conversion?
- A C/G discovery variant has effect allele C at frequency 0.49. The target reports C frequency 0.51 and G frequency 0.49. What does this frequency comparison suggest, and what does it not establish?
- A variant with \(\beta=0.06\) has dosage 1.50 and is accidentally included twice. Calculate the correct contribution and the duplicated contribution.
Solutions. (1) Reverse the sign: the T dosage counts the opposite allele, so its coefficient is \(-\beta\). (2) Coordinates can differ between builds, and the same numerical position need not identify the same variant. Convert using a validated mapping, then check the destination reference and alternate alleles and inspect for ambiguous mappings. (3) The target G frequency of 0.49 matches the discovery C frequency and numerically favors matching discovery C to target G. It does not prove the orientation because both frequencies are near 0.5 and uncertainty and population comparability are unspecified. (4) Correct contribution: \(0.06\times1.50=0.090\). Duplicated contribution: \(2\times0.090=0.180\), an excess of 0.090.