Tutorials › Statistical Genetics › Building an LD Reference for Fine-Mapping

Bayesian Statistical Fine-Mapping · Tutorial 630 of 989

Building an LD Reference for Fine-Mapping

Learn to construct and quality-check a signed LD matrix whose variants and allele coding match the fine-mapping analysis.

Advanced 11 min read

What You'll Learn

  • Define an LD reference as genotype correlations among matched variants in a reference panel
  • Match variants using genome build, chromosome, position, and alleles
  • Harmonize dosage coding and identify strand-ambiguous variants
  • Calculate and check a signed LD correlation matrix
  • Explain how sample size and allele frequency affect LD estimate reliability
  • Recognize when the reference panel may poorly represent the association study

Why Fine-Mapping Needs a Carefully Built LD Reference

Fine-mapping uses the pattern of correlation among variants to distinguish association signals that may be difficult to separate. A reference panel supplies an estimate of that pattern when individual-level genotypes from the association study are unavailable. The estimate is useful only if it refers to the same variants, positions, and allele coding as the study data. A mismatch can change the signs or ordering of correlations, or make the matrix describe different variants altogether.

An LD reference is therefore not just a numerical matrix downloaded from a database. It is a matrix built from genotypes after checking variant identity, genomic coordinates, allele orientation, and the characteristics of the reference sample. This tutorial focuses on preparing and assessing that matrix, not on interpreting fine-mapping posterior probabilities.

Definition: A reference panel is a set of individuals with genotype data used to estimate genetic relationships among variants. An LD matrix for \(m\) variants is an \(m \times m\) matrix whose entry \(r_{jk}\) is the sample correlation between the allele dosages for variants \(j\) and \(k\), calculated in the reference panel. Its diagonal entries are 1; its off-diagonal entries are signed correlations between -1 and 1.

For a biallelic variant, an allele dosage records how many copies of a specified allele an individual carries, taking values 0, 1, or 2 for hard genotype calls. Dosage data from imputation may instead take fractional values between 0 and 2. The allele being counted must be stated: counting the other allele replaces dosage \(G\) by \(2-G\).

Definition: For \(n\) reference individuals, let \(G_{ij}\) be the dosage of the consistently specified allele at variant \(j\) for individual \(i\). The sample LD correlation between variants \(j\) and \(k\) is $$ r_{jk} = \frac{\sum_{i=1}^{n}(G_{ij}-\bar{G}_j)(G_{ik}-\bar{G}_k)} {\sqrt{\sum_{i=1}^{n}(G_{ij}-\bar{G}_j)^2 \sum_{i=1}^{n}(G_{ik}-\bar{G}_k)^2}}, $$ where \(\bar{G}_j\) is the mean dosage at variant \(j\). The signed value \(r_{jk}\) depends on allele coding. The squared correlation \(r_{jk}^2\) does not change when the dosage at just one of the two variants is flipped.

Match Variants Before Calculating Correlations

The rows and columns of the reference matrix must represent the same variants, in the same order, as the variants used in the fine-mapping analysis. Matching by a variant identifier alone is not always sufficient: identifiers may be missing, reused, or represented differently across data sources. A reliable match uses the chromosome, position, genome build, and allele pair together, with identifiers as supporting information.

Positions are meaningful only relative to a genome build. A coordinate from one build must not be matched directly to a coordinate from another as if both referred to the same location. Insertions and deletions can also have multiple equivalent representations unless they are normalized consistently against the same reference genome. Multiallelic records require particular care: the analysis and reference data must refer to the same alternate allele, not merely the same site.

After identifying records, put them in the intended variant order and verify that each position and allele pair agrees. Exclude variants that cannot be matched unambiguously. Also exclude monomorphic variants from the correlation matrix: if all reference individuals have the same dosage, the denominator in the correlation formula is zero and the correlation is undefined.

Harmonize Alleles and Check the Sign

A variant can be correctly matched by position but still be coded in the opposite direction. If one data set counts allele A and another counts allele G at the same A/G variant, their dosages satisfy \(G_{\mathrm{A}}=2-G_{\mathrm{G}}\). Flipping one dosage vector multiplies its centered values by \(-1\), so every correlation involving that variant changes sign. If both vectors are flipped, the correlation between them retains its sign.

This distinction matters because fine-mapping likelihoods using an LD matrix require signed correlations, not just \(r^2\). An unsigned matrix can conceal an allele-orientation error. Strand complements also need attention: A/G corresponds to T/C on the opposite strand, whereas A/T and C/G pairs are palindromic. For a palindromic pair, strand information alone cannot determine which allele is being counted. Allele frequencies can sometimes help, but when frequencies are close to one half or differ between samples, frequency alone may not resolve the orientation reliably.

Worked Example: Harmonizing a Study Dosage With a Reference Panel

Suppose a study and reference panel both report a hypothetical variant at chromosome 7, position 550,000, on the same genome build, with alleles A/G. The reference dosage counts G, while the study dosage counts A. The two records identify the same site, but their dosage directions differ.

For a study dosage of 0, 1, or 2 copies of A, the corresponding dosage of G is \(2-G_{\mathrm{A}}\). Thus a study dosage vector \((0,1,2)\) must be converted to \((2,1,0)\) to match the reference's G-counting convention. Equivalently, the reference can be recoded to count A, provided that all other variants and the analysis data are kept consistently aligned.

If the correlation between this G-counting dosage and another variant is \(0.40\), the correlation using the A-counting dosage at this site is \(-0.40\). The squared correlation remains \(0.16\). A signed LD matrix must use one of these orientations consistently with the alleles in the association results.

Now consider a hypothetical A/T variant with effect allele A and frequency 0.48 in the study, but a reference record whose strand orientation is uncertain. The frequency being near 0.50 gives little help in distinguishing A from T, and modest sampling differences could move the estimates on either side of 0.50. If the orientation cannot be resolved from reliable records, the safe choice is to omit the variant rather than guess and risk reversing its correlations.

Calculate a Consistent Matrix

Once variants are matched and dosage directions are fixed, calculate the correlation for each pair using a consistent set of reference individuals and the same allele coding throughout. The matrix is symmetric because \(r_{jk}=r_{kj}\), and its diagonal is 1 for each variant with nonzero genotype variance. A useful quality check is to confirm that these properties hold and that all entries lie between -1 and 1, allowing only negligible rounding error.

Using the same individuals across variant pairs is important. A correlation matrix computed from one common set of genotype rows is positive semidefinite: for any vector \(a\), the quadratic form \(a^\mathsf{T}Ra\) is nonnegative. Pairwise deletion, which calculates each pair using a different set of individuals, does not in general preserve this property. It can produce a matrix that is not a valid correlation matrix. Use a consistent missing-data procedure and check the resulting matrix rather than assuming that pairwise correlations automatically form a coherent whole.

Worked Example: Calculating One Entry of the LD Matrix

Consider five hypothetical reference individuals. Their dosages for variants A and B are respectively \((0,0,1,1,2)\) and \((0,1,1,2,2)\). Assume the records are correctly matched, both vectors count the intended alleles, and all five individuals have observed dosages at both variants.

The means are \(\bar{G}_A=0.8\) and \(\bar{G}_B=1.2\). The centered vectors are \((-0.8,-0.8,0.2,0.2,1.2)\) and \((-1.2,-0.2,-0.2,0.8,0.8)\). Their cross-product sum is $$ (-0.8)(-1.2)+(-0.8)(-0.2)+(0.2)(-0.2)+(0.2)(0.8)+(1.2)(0.8)=2.20. $$

The sums of squared centered values are 2.80 for A and 2.80 for B. Therefore, $$ r_{AB}=\frac{2.20}{\sqrt{2.80 \times 2.80}} =\frac{2.20}{2.80}=0.7857. $$

The corresponding two-variant matrix is \(\begin{pmatrix}1 & 0.7857\\0.7857 & 1\end{pmatrix}\). This calculation is valid for illustrating the procedure, but five individuals are far too few to regard the estimated correlation as precise.

Why Panel Size and Allele Frequency Affect Reliability

An LD estimate is a sample estimate. Increasing the number of independent reference individuals generally reduces its sampling variability, but does not fix incorrect variant matching, allele coding, or a systematically unrepresentative panel. The size that matters is the effective number of informative, sufficiently independent individuals contributing to the estimate, not merely the number of genotype records listed.

A useful rough guide, under independent sampling and conditions where a bivariate-normal approximation is reasonable, is the Fisher transformation \(z=\operatorname{atanh}(r)\), whose standard error is approximately \(1/\sqrt{n-3}\). On the correlation scale, a corresponding local approximation is $$ SE(r) \mathrel{\approx} \frac{1-r^2}{\sqrt{n-1}}. $$ These are approximations, not universal guarantees for discrete genotype data. They are less dependable for rare variants, small samples, related individuals, or panels with substantial missingness. They help convey why a correlation from a small panel should not be treated as exact.

Allele frequency affects how much genotype variation is available to estimate a correlation. Under Hardy–Weinberg equilibrium, if an allele has frequency \(p\), its genotype dosage has variance \(2p(1-p)\). When \(p\) is small, most individuals carry zero copies; relatively few carry one or two. Correlations involving such a variant can be sensitive to a small number of individuals and may have substantial sampling variability. A high estimated correlation involving a rare variant is not, by itself, evidence of a stable relationship.

The reference panel should also be appropriate for the association data. If allele frequencies and LD patterns differ between the panel and the study sample, the reference matrix may represent the wrong correlation structure for the study's fine-mapping likelihood. Frequency differences are a diagnostic signal to investigate, not a mathematical correction that can be applied mechanically to the matrix. The relevant comparison is whether the reference sample provides a suitable estimate for the individuals contributing the association results.

Worked Example: Interpreting Panel Size and Allele Frequency

Suppose two hypothetical estimates have \(r=0.50\), one from \(n=100\) unrelated reference individuals and one from \(n=1{,}000\). Using the rough correlation-scale approximation, $$ SE(r) \mathrel{\approx} \frac{1-r^2}{\sqrt{n-1}}, $$ the estimate from 100 individuals has approximate standard error \(0.75/\sqrt{99}=0.0754\). For 1,000 individuals it is \(0.75/\sqrt{999}=0.0237\). Under the approximation's assumptions, the larger panel gives a more precise estimate; neither value accounts for mismatch between the panel and study population.

Now consider a hypothetical allele with frequency \(p=0.01\) in a panel of 200 unrelated individuals. The expected number of copies is \(2np=2(200)(0.01)=4\), and the genotype variance under Hardy–Weinberg equilibrium is \(2p(1-p)=2(0.01)(0.99)=0.0198\). By comparison, at \(p=0.30\) the expected number of copies is \(2(200)(0.30)=120\), and the variance is \(2(0.30)(0.70)=0.42\). The rare allele offers much less genotype variation, so its correlation estimates may be unstable even though both variants are observed in the same number of people.

These calculations are expectations under stated assumptions, not a guarantee about the realized genotype counts. They show why panel size should be considered together with allele frequency and genotype quality, rather than treated as a single adequacy threshold.

A Practical Quality-Control Sequence

A defensible LD reference is built through a sequence of checks. Each step addresses a distinct way the matrix could fail to correspond to the fine-mapping analysis.

1
Define the target variants.
Record chromosome, position, genome build, alleles, and variant order from the association data. Use identifiers as additional evidence, not as the only match criterion.
2
Match and normalize records.
Confirm positions in the same genome build, align allele pairs, and represent indels and multiallelic sites consistently. Set aside variants with unresolved identity or strand orientation.
3
Harmonize dosage direction.
For every retained variant, specify the counted allele and transform dosages if needed. Check strand-ambiguous variants carefully; do not infer an uncertain orientation from uninformative frequency differences.
4
Estimate and validate the matrix.
Use a consistent missing-data procedure and calculate pairwise correlations. Check symmetry, diagonal entries, bounds, matrix validity, and the final row and column order.
5
Assess whether the estimate is suitable.
Review panel size, relatedness, genotype quality, allele frequencies, and representativeness for the association sample. Document limitations, especially for rare variants and uncertain matches.

Common Mistake: Treating an LD Matrix as Allele-Free

A frequent error is to match variants by identifier, calculate correlations, and assume that the matrix is ready because its entries look plausible. The reasoning is wrong because a dosage vector for one allele is the negative of the centered dosage vector for the other allele. A mismatch at even one variant can therefore reverse an entire row and column of signed correlations while leaving their squared values unchanged.

The correction is to verify each variant's position and allele pair, define the counted allele explicitly, and align that choice with the association data before interpreting the signs. Then assess the panel itself: a correctly harmonized matrix can still be a poor reference if it is small, has unreliable genotypes, or does not represent the study sample. A checked matrix supports fine-mapping; it does not establish that any particular variant is causal.

Key takeaway: A useful LD reference is a signed correlation matrix for the correct variants, in the correct order, with allele dosages consistently oriented and correlations estimated from a suitable reference sample. Matching, coding, sample size, and allele frequency all affect whether the matrix is trustworthy.

Check Your Understanding

Answer each question using the definitions and checks in this tutorial.

  1. Why must the genome build be confirmed before matching variants by chromosome and position?
  2. If dosage at one variant is recoded from allele A to the other allele G, what happens to its correlation with a second variant, and what happens to the squared correlation?
  3. Why can pairwise deletion of missing genotypes produce a matrix that is not positive semidefinite?
  4. Under Hardy–Weinberg equilibrium, what is the genotype dosage variance for an allele with frequency \(p\), and why can a rare allele yield an unstable correlation estimate?
  5. What checks would you make before using a reference panel that has more individuals but noticeably different allele frequencies from the association sample?
Clinical Biostats