Tutorials › Statistical Genetics › Common Construction Errors in a Polygenic Score Pipeline

Polygenic Score Construction · Tutorial 715 of 989

Common Construction Errors in a Polygenic Score Pipeline

Follow a careful variant-and-weight harmonization workflow and see how common pipeline mistakes change score contributions or invalidate them.

Intermediate 11 min read

What You'll Learn

  • Define an additive polygenic score using dosage and effect-allele weights
  • Detect and correct an allele-sign reversal, including its intercept shift
  • Explain why duplicate variants and inconsistent genome builds corrupt variant matching
  • Harmonize allele orientation between genotypes, summary statistics, and an LD matrix
  • Identify incompatible effect scales and convert odds ratios to log-odds weights

Why Construction Errors Matter

A polygenic score is built by matching genetic variants to weights and combining their contributions. The arithmetic can be simple; the matching is not. If a genotype dosage counts the opposite allele from the one named by its weight, the contribution can have the wrong sign. If a variant is counted twice, its contribution is doubled. If the variants or effect scales do not match across files, a calculated number may not represent the intended score at all.

This tutorial focuses on auditing those construction steps, from summary statistics to an individual score. It does not assess how well a finished score predicts in a target population. The earlier material on GWAS weights and linkage disequilibrium provides the context for interpreting weights; here the priority is preserving their meaning when combining files.

Definition: For \(m\) matched variants, an additive polygenic score for individual \(i\) is $$ S_i=\sum_{j=1}^{m} G_{ij}\beta_j, $$ where \(G_{ij}\) is the dosage of the specified effect allele at variant \(j\), usually between 0 and 2 for a diploid biallelic variant, and \(\beta_j\) is the corresponding per-allele effect weight. A dosage may be an expected allele count between 0 and 2 rather than an observed integer. The score's units follow the units of the weights and phenotype scale.

The formula assumes that each row in the weight file corresponds to the same biological variant in the genotype data, that the dosage counts the weight's effect allele, and that each variant is included only as intended. It also assumes the weights are on a compatible scale. These are data-alignment and interpretation requirements, not details that can be repaired by the final summation.

Establish the Meaning of Each Variant Record

A variant record should be identified using enough information to distinguish the intended site and alleles. A chromosome-position pair is meaningful only relative to a genome build. Variant identifiers such as rsIDs can help, but should not replace checks of position and alleles: records can be missing identifiers, identifiers may be updated, and multiallelic sites require care. For an ordinary biallelic record, keep the reference and alternate alleles, the effect allele in the summary statistics, and the allele counted in the genotype dosage explicit.

The weight and dosage must refer to the same allele. If a study reports \(\beta\) per copy of allele A, but the genotype file gives dosage of the other allele G, those values cannot be multiplied as if both counted A. For a biallelic diploid variant, if \(G_A\) counts A, then \(G_G=2-G_A\). Therefore,

$$ \beta G_A=\beta(2-G_G)=2\beta-\beta G_G. $$

Thus, changing which allele is counted changes the coefficient's sign and also introduces a constant term. When scores are used only for ranking, a common constant shift does not change their ordering. But the score values and any prediction intercept must be interpreted consistently; silently reversing a weight is not a harmless relabeling.

Worked Example: Correcting an Allele-Sign Reversal

Suppose the summary statistics report a weight of \(-0.20\) phenotype units per copy of G at a biallelic variant. The genotype file instead provides dosage of C, the other allele. For one hypothetical individual, the C dosage is 0, so the G dosage is 2. Calculate the correct contribution and compare it with the naive calculation.

Correct calculation. The weight is per G allele, so use G dosage: $$ (-0.20)(2)=-0.40 $$ phenotype units.

Naive calculation. Multiplying the same weight by the C dosage gives $$ (-0.20)(0)=0. $$ This is incorrect because the weight is not per C allele; the contribution is too high by \(0.40\) phenotype units for this individual.

Equivalent C-dosage coding. Since \(G=2-C\), $$ (-0.20)G=(-0.20)(2-C)=-0.40+0.20C. $$ A score expressed using C dosage therefore needs a coefficient of \(+0.20\) per C allele and a constant of \(-0.40\) for this variant. At C dosage 0, the contribution remains \(-0.40\), as required. This calculation checks both the sign and the constant shift.

Allele harmonization also requires attention to strand. Complementary alleles can represent the same base pair on opposite DNA strands. A/T and C/G variants are especially difficult to resolve from allele labels alone because their complements do not change the unordered allele pair. When strand or allele identity cannot be established reliably, the record should be resolved using suitable metadata, such as validated frequency information, or excluded rather than guessed.

Check Variant Identity, Build, and Multiplicity

A genome build defines the reference sequence and coordinates used to locate variants. A coordinate from one build must not be joined directly to a coordinate from another as if the numbers necessarily referred to the same site. Harmonization requires converting one file to the other build or using a verified variant mapping, then checking alleles and variant identity after conversion. A coordinate conversion that fails or produces an ambiguous result should be investigated, not silently treated as a match.

Duplicates create a separate problem. If one biological variant appears twice in the score file and both rows are summed, its contribution is included twice. Duplicate records can arise from repeated rows, inconsistent identifiers for the same site, or careless merging. Conversely, indiscriminately dropping every repeated identifier can discard distinct records at complex sites. Resolve duplicates using variant identity, alleles, and the intended analysis rules before scoring.

Worked Example: Detecting a Duplicate Variant

A hypothetical score file contains two intended variants. Variant A has dosage 1 and weight \(0.25\) phenotype units per allele. Variant B has dosage 2 and weight \(-0.10\) phenotype units per allele. A merge accidentally includes Variant A a second time.

Correct score. Include each variant once: $$ S=(1)(0.25)+(2)(-0.10)=0.25-0.20=0.05 $$ phenotype units.

Score with the duplicate. The duplicated row adds Variant A's contribution again: $$ S_{\mathrm{duplicate}}=(1)(0.25)+(2)(-0.10)+(1)(0.25)=0.30 $$ phenotype units.

The error changes the score by \(0.30-0.05=0.25\) phenotype units, exactly one extra copy of Variant A's contribution. A useful audit is to count variant records before and after every merge and check that each intended variant contributes the expected number of times.

Worked Example: Diagnosing a Genome-Build Mismatch

Suppose a hypothetical summary-statistic record identifies a variant at chromosome 7 position 500,000 in build A, with alleles C and T. The genotype file is in build B, where verified mapping information places that same variant at chromosome 7 position 501,200, also with alleles C and T. A separate site in build B happens to be at position 500,000.

A direct join on chromosome and position would pair the summary-statistic weight with the build-B site at 500,000. That is not a valid match: the summary statistic's coordinate uses build A, while the genotype coordinate uses build B. The fact that both rows have a position does not establish that they identify the same variant.

The safe resolution is to convert or map the summary-statistic record to build B, then verify that it matches the genotype record at position 501,200 and that the allele pair is compatible. The record at build-B position 500,000 must not receive this weight merely because its coordinate number matches. If mapping or allele checks do not give a unique, defensible match, omit the unresolved record rather than assign its weight to a possibly different site.

Keep LD Alleles and Ordering Consistent

Some construction methods use an LD matrix, a matrix of correlations among genotype dosages, to estimate or modify weights. The LD matrix is meaningful only for the variants, order, and allele coding used to calculate it. Reordering variants requires the same reordering of matrix rows and columns. Reversing the dosage allele at one variant changes the signs of its correlations with other variants. Using summary statistics aligned to one allele convention with an LD matrix aligned to another can therefore produce incorrect LD-adjusted weights, even when the same variant identifiers appear in both files.

The sign change can be stated precisely. Let \(R\) be the correlation matrix of coded dosages. If the dosage coding of variant \(j\) is reversed, its centered dosage is multiplied by \(-1\). For a set of such reversals, let \(D\) be diagonal, with \(D_{jj}=1\) when coding is unchanged and \(D_{jj}=-1\) when it is reversed. The consistently recoded correlation matrix is

$$ R_{\mathrm{new}}=DRD. $$

The diagonal remains 1, while correlations between a reversed variant and an unchanged one change sign. Correlations between two reversed variants do not change sign. This is why allele harmonization must be applied to the LD reference as well as to the weight and genotype files.

Worked Example: Finding an LD Allele-Coding Mismatch

A hypothetical two-variant LD matrix, calculated using the effect-allele dosages in the summary statistics, is $$ R=\begin{pmatrix}1&0.60\\0.60&1\end{pmatrix}. $$ In the genotype reference, the second variant is instead coded for its other allele. The first variant's coding is unchanged. Find the LD matrix in the genotype reference's coding and identify the error made by using the original matrix without adjustment.

Here \(D=\begin{pmatrix}1&0\\0&-1\end{pmatrix}\), so $$ R_{\mathrm{new}}=DRD =\begin{pmatrix}1&0\\0&-1\end{pmatrix} \begin{pmatrix}1&0.60\\0.60&1\end{pmatrix} \begin{pmatrix}1&0\\0&-1\end{pmatrix} =\begin{pmatrix}1&-0.60\\-0.60&1\end{pmatrix}. $$

The correlation changes from \(+0.60\) to \(-0.60\), because only the second dosage was reversed. If an LD-based method combines summary statistics with the original matrix while treating its alleles as though they matched the genotype reference, the cross-variant relationship has the wrong sign. The correction is to harmonize allele coding, variant order, and matrix rows and columns before applying the LD-based procedure.

Check That Effect Scales Are Compatible

A weight is not just a number: it has a scale and a unit. For a quantitative phenotype, a coefficient might be measured in phenotype units per allele, or in standard deviations of phenotype per allele if the phenotype was standardized. For a binary phenotype analyzed with logistic regression, a coefficient is usually on the log-odds scale per allele. A reported odds ratio is not itself that coefficient; it must be log-transformed. Mixing weights from different phenotype definitions or scales produces a sum whose interpretation is unclear.

Worked Example: Converting an Odds Ratio to a Log-Odds Weight

A hypothetical logistic GWAS reports an odds ratio of 1.20 per copy of an effect allele. A person has dosage 2 for that allele. Calculate the correct score contribution on the log-odds scale, and compare it with mistakenly using the odds ratio as the weight.

The logistic-regression coefficient is the natural logarithm of the odds ratio: $$ \beta=\log(1.20)\approx 0.1823 $$ log-odds units per allele. The person's contribution is therefore $$ (2)(0.1823)=0.3646 $$ log-odds units.

If the odds ratio itself is incorrectly used as the coefficient, the contribution becomes $$ (2)(1.20)=2.40, $$ which is not on the log-odds scale and is not the reported per-allele effect. The discrepancy is not fixed by merely labeling the result a score: the input weight must first be placed on the scale required by the intended score.

The same care applies when one set of weights is per allele and another is per standard-deviation change in genotype, or when phenotype standardization differs across analyses. Check the phenotype definition, model, effect allele, and units in the source of every weight. Do not combine values just because they are all stored in a column called “beta.”

A Practical Audit Before Summation

A short audit can catch many errors before they propagate through a score pipeline. Document the steps so that a reviewer can reconstruct which alleles were counted and why each row was kept, changed, or excluded.

1
Confirm the weight definition.
Record the phenotype, model, effect scale, units, and effect allele for each weight set.
2
Harmonize variant identity.
Put coordinates on a common genome build and verify variant identity and allele compatibility.
3
Align dosage coding.
Check which allele each genotype dosage counts; if coding is reversed, transform the coefficient consistently and account for the constant when interpreting absolute scores.
4
Audit duplicates and missing matches.
Resolve repeated biological variants and document records that cannot be matched reliably.
5
Align LD inputs when used.
Confirm that the LD matrix has the same variants, allele coding, and ordering expected by the weight-estimation procedure.
6
Check score arithmetic.
For a small set of records, calculate contributions by hand and confirm that the software's sum uses each intended dosage-weight product once.

Common Mistakes and Why They Matter

  • Assuming a matching variant ID guarantees matching alleles. The ID does not establish which allele the dosage counts. Check allele labels and coding explicitly.
  • Flipping an allele but not its weight or LD information. Reversing dosage coding changes the weight sign under the equivalent coding and can change LD correlation signs. Harmonize all affected inputs together.
  • Joining coordinates from different builds directly. A coordinate is build-specific. Convert or verify the mapping before joining; otherwise a weight can be assigned to a different site.
  • Keeping repeated rows without checking their identity. A duplicated record can add the same contribution twice, but superficially similar rows may also represent distinct records. Resolve using alleles and variant identity.
  • Treating every effect estimate as the same kind of beta. A log-odds coefficient, an odds ratio, and a standardized quantitative-trait coefficient have different meanings and cannot be interchanged without a justified transformation.
Key takeaway: A score is only as interpretable as the alignment behind it. Before summing, ensure that every weight and dosage refer to the same variant, genome build, counted allele, and effect scale; if an LD matrix is used, align its alleles and order as well.

Check Your Understanding

Use these questions to test whether you can diagnose construction errors rather than merely compute a sum.

  1. A weight is \(-0.15\) per copy of allele A, but a dosage file counts the other allele at a biallelic diploid site. What coefficient and constant are needed to express the same contribution using the other-allele dosage?
  2. Why can a direct coordinate join assign a summary-statistic weight to the wrong genotype variant when the files use different genome builds?
  3. A variant contribution appears twice after a merge. What information should you check before deciding whether one row is a duplicate to remove?
  4. If one variant's dosage coding is reversed in a two-variant LD matrix, what happens to its correlation with an unchanged variant?
  5. A GWAS reports an odds ratio of 0.80 per allele. What transformation gives the logistic-regression coefficient used as a log-odds weight, and on what scale is that coefficient expressed?
Clinical Biostats