Tutorials › Statistical Genetics › A Worked Locus Analysis With TWAS and Colocalization

Colocalization and Transcriptome Association · Tutorial 927 of 989

A Worked Locus Analysis With TWAS and Colocalization

Work through a regional TWAS and colocalization analysis, from aligned summary statistics to posterior evidence and a cautious gene-level interpretation.

Advanced 10 min read

What You'll Learn

  • Prepare aligned GWAS and expression-QTL summary statistics for a regional analysis
  • Calculate a TWAS statistic using prediction weights and linkage disequilibrium
  • Construct and interpret the five colocalization hypothesis weights
  • Reconcile TWAS association with evidence for a shared regional signal
  • Assess how a colocalization conclusion changes when a prior changes

From Regional Data to Gene-Level Evidence

A strong transcriptome-wide association study (TWAS) result and a strong colocalization result answer related but distinct questions. TWAS tests whether a genetically predicted expression score is associated with a trait. Colocalization evaluates whether the regional GWAS and expression-QTL (eQTL) signals are consistent with a shared causal variant rather than separate variants. A worked analysis needs both calculations, along with careful alignment of the variants and a clear account of the assumptions.

The example below uses entirely hypothetical data for one genomic region, one gene, and one tissue. It illustrates a single-signal colocalization analysis. The region contains three aligned variants. The GWAS and eQTL summary statistics refer to the same alleles and variant order, and the LD matrix is appropriate for the GWAS sample. These checks matter: mismatched alleles or an unsuitable LD matrix can change the evidence, not merely its presentation.

Definition: A TWAS statistic tests association between a trait and a genetically predicted expression score, formed by combining variant genotypes with expression-prediction weights. A colocalization analysis compares hypotheses about the number and sharing of causal variants underlying regional association signals. Neither result, by itself, establishes that changing the gene’s expression would change the trait.

Set Up the Hypothetical Locus

Let \(z_G\) denote the GWAS vector of marginal association z-statistics and \(z_E\) the eQTL vector, each ordered by the same three variants. The GWAS statistics are rounded in the table. The approximate Bayes factors (ABFs) shown are calculated from the underlying, unrounded summary estimates using the same illustrative effect prior for each trait and variant.

VariantGWAS z-statisticGWAS ABFeQTL z-statisticeQTL ABF
v15.40010375.5871733
v21.8541.6701.5941.334
v31.0020.9091.0200.917

For example, the Wakefield approximate Bayes factor for an estimated effect \(b\), with sampling variance \(V\) and a zero-centred normal prior of variance \(W\), is

$$ \mathrm{ABF}=\sqrt{\frac{V}{V+W}}\exp\left(\frac{z^2W}{2(V+W)}\right), \qquad z=\frac{b}{\sqrt{V}}. $$

Here the illustrative calculation uses \(V=W=0.04\); the table reports rounded ABFs based on the unrounded z-statistics. An ABF greater than 1 favors association at that variant over the null under this model; an ABF below 1 favors the null. These values are evidence measures, not p-values, and their interpretation depends on the effect prior and the summary-data model.

Worked Example: Calculate a TWAS Association Statistic

Worked Example: Calculate a TWAS Association Statistic

Suppose the expression-prediction weights for this gene and tissue are \(w=(0.6,0.3,0.1)^\mathsf{T}\). Treat the weights as fixed, and suppose the GWAS LD correlation matrix for these variants is

$$ R= \begin{pmatrix} 1 & 0.8 & 0.2\\ 0.8 & 1 & 0.2\\ 0.2 & 0.2 & 1 \end{pmatrix}. $$

Use the rounded GWAS vector \(z_G=(5.400,1.854,1.002)^\mathsf{T}\). The summary-statistic TWAS score and its null standardization are

$$ Z_{\mathrm{TWAS}}= \frac{w^\mathsf{T}z_G}{\sqrt{w^\mathsf{T}Rw}}. $$

The numerator is

$$ w^\mathsf{T}z_G =(0.6)(5.400)+(0.3)(1.854)+(0.1)(1.002) =3.240+0.5562+0.1002 =3.8964. $$

For the denominator, the diagonal terms contribute \(0.6^2+0.3^2+0.1^2=0.4600\). The off-diagonal terms, counted twice in the quadratic form, contribute \(2[(0.6)(0.3)(0.8)+(0.6)(0.1)(0.2)+(0.3)(0.1)(0.2)]=0.3240\). Thus

$$ w^\mathsf{T}Rw=0.4600+0.3240=0.7840, \qquad Z_{\mathrm{TWAS}}=\frac{3.8964}{\sqrt{0.7840}}=4.401. $$

Under the usual null approximation that this standardized score follows a standard normal distribution, the two-sided p-value is approximately \(1.08\times10^{-5}\). This is evidence of association between the genetically predicted expression score and the trait in this analysis. It is not, on its own, evidence that expression mediates a genetic effect on the trait.

Why the LD Standardization Appears

The denominator in the TWAS statistic accounts for correlation among variants. With standardized genotypes, \(R\) is their correlation matrix. Under a null in which the trait is unrelated to the genotypes, the vector of marginal z-statistics has approximate covariance \(R\). For a fixed weight vector, the weighted numerator therefore has variance \(w^\mathsf{T}Rw\). Dividing by its square root gives a statistic with approximate unit variance under the null.

Justification: If \(z_G\) has mean zero and covariance matrix \(R\) under the null, then $$ \operatorname{Var}(w^\mathsf{T}z_G) =w^\mathsf{T}\operatorname{Var}(z_G)w =w^\mathsf{T}Rw. $$ Consequently, standardizing \(w^\mathsf{T}z_G\) by \(\sqrt{w^\mathsf{T}Rw}\) produces the stated null statistic, subject to the summary-statistic approximation and correct LD and allele alignment.

The calculation assumes that the weights correspond to the same variants and allele directions as the GWAS statistics, that the LD matrix reflects the GWAS population adequately, and that the prediction weights can be treated as fixed for this test. If these conditions fail, the displayed statistic may not have the intended calibration. If many genes or tissues are tested, the single-test p-value also does not account for that multiple testing; gene- and tissue-level multiplicity must be handled in the study’s broader analysis.

Colocalization Hypotheses and Weights

For this regional example, use the standard five-hypothesis formulation. It assumes at most one causal variant for each trait in the region. The hypotheses distinguish no association, association with only one trait, two distinct causal variants, and one shared causal variant. This assumption should be justified for the locus; when multiple signals are plausible, a method that models multiple signals is needed instead of treating the single-signal calculation as definitive.

Definition: \(H_0\): neither trait is associated in the region; \(H_1\): only the GWAS trait is associated; \(H_2\): only the eQTL trait is associated; \(H_3\): both traits are associated, with distinct causal variants; \(H_4\): both traits are associated, with the same causal variant.

Let \(A_i\) be the GWAS ABF and \(B_i\) the eQTL ABF for variant \(i\). With per-variant priors \(p_1\) for a GWAS association, \(p_2\) for an eQTL association, and \(p_{12}\) for a shared association, the unnormalized hypothesis weights are

$$ \begin{aligned} W_0&=1,\\ W_1&=p_1\sum_i A_i,\\ W_2&=p_2\sum_i B_i,\\ W_3&=p_1p_2\sum_{i\ne j}A_iB_j,\\ W_4&=p_{12}\sum_i A_iB_i. \end{aligned} $$

The condition \(i\ne j\) in \(W_3\) means that the two traits’ causal variants are different. In \(W_4\), each product uses the same variant index. Normalizing the weights gives posterior probabilities for the five hypotheses under the specified priors, ABFs, and model.

Worked Example: Compute the Colocalization Posterior

Worked Example: Compute the Colocalization Posterior

Use the ABFs in the table and the illustrative priors \(p_1=p_2=10^{-4}\) and \(p_{12}=10^{-5}\). These priors satisfy \(p_{12}<p_1\) and \(p_{12}<p_2\); they are assumptions for this calculation, not universal defaults.

The sums of the separate ABFs are \(\sum_i A_i=1039.579\) and \(\sum_i B_i=1735.251\). The shared-variant sum is

$$ \sum_i A_iB_i =(1037)(1733)+(1.670)(1.334)+(0.909)(0.917) =1{,}797{,}121+2.22778+0.833553 =1{,}797{,}124.061333. $$

The sum over distinct-variant products can be calculated as the product of the two total sums minus the same-variant products:

$$ \begin{aligned} \sum_{i\ne j}A_iB_j &=(1039.579)(1735.251)-1{,}797{,}124.061333\\ &=1{,}803{,}930.499329-1{,}797{,}124.061333\\ &=6{,}806.437996. \end{aligned} $$

The five unnormalized weights are therefore

$$ \begin{aligned} W_0&=1,\\ W_1&=(10^{-4})(1039.579)=0.1039579,\\ W_2&=(10^{-4})(1735.251)=0.1735251,\\ W_3&=(10^{-8})(6806.437996)=0.0000680644,\\ W_4&=(10^{-5})(1{,}797{,}124.061333)=17.9712406. \end{aligned} $$

Their sum is \(19.2487917\). Dividing each weight by this sum gives, approximately, \(P(H_0\mid\text{data})=0.05195\), \(P(H_1\mid\text{data})=0.005401\), \(P(H_2\mid\text{data})=0.009015\), \(P(H_3\mid\text{data})=0.00000354\), and \(P(H_4\mid\text{data})=0.9336\). Under these priors and the single-causal-variant model, the data favor a shared variant over distinct variants, with posterior probability about 0.934 for \(H_4\).

The result is not a guarantee that the same causal variant has been identified, and it does not show that the gene’s expression causes the trait. It is posterior evidence conditional on the chosen priors, the ABFs, the region, and the model assumptions. In particular, the small \(H_3\) posterior is meaningful only if the region and signal structure have been handled appropriately.

Worked Example: Check Prior Sensitivity

Worked Example: Check Prior Sensitivity

Keep the ABFs and \(p_1=p_2=10^{-4}\) fixed, but reduce the shared-variant prior to \(p_{12}=10^{-6}\). This asks how much the posterior depends on the prior probability of sharing, rather than changing the observed data.

The weights \(W_0\) through \(W_3\) remain \(1\), \(0.1039579\), \(0.1735251\), and \(0.0000680644\). The \(H_4\) weight becomes

$$ W_4=(10^{-6})(1{,}797{,}124.061333)=1.7971241. $$

The new total weight is \(3.0746751\), so

$$ P(H_4\mid\text{data}) =\frac{1.7971241}{3.0746751} \approx 0.5845. $$

The shared-variant hypothesis still has the largest individual posterior probability, but its posterior is now about 0.585 rather than 0.934. This sensitivity check shows why a reported colocalization result should include its prior choices and why strong posterior evidence should not be interpreted without considering plausible alternatives.

Reconciling the Two Results at the Gene Level

In this hypothetical analysis, the TWAS statistic is \(4.401\), with a two-sided p-value of approximately \(1.08\times10^{-5}\), and the single-signal colocalization calculation gives \(P(H_4\mid\text{data})\approx0.934\) under the first set of priors. Together, these results support two carefully limited statements: the genetically predicted expression score is associated with the trait, and the regional GWAS and eQTL evidence is strongly compatible with a shared causal variant under the specified model and priors.

The combination is more informative than either result alone, but it does not establish a causal chain from variant to expression to trait. A shared variant can affect both traits through distinct mechanisms, and TWAS association can reflect correlated variants or pleiotropic effects. The interpretation should also reflect whether the region has multiple independent signals, whether the LD reference is suitable, and whether the prior sensitivity is acceptable. Those considerations determine how much weight to place on a gene-level summary.

Common Mistakes

  • Treating a TWAS p-value as a mediation test. The statistic tests association with predicted expression; it does not test whether expression mediates the genetic effect.
  • Calling overlapping signals colocalization. Similar regional association patterns can arise from distinct correlated variants. The hypotheses explicitly compare shared and distinct causal variants.
  • Ignoring variant alignment or LD. Allele-direction errors and an unsuitable LD matrix can invalidate the score or the interpretation of the regional evidence.
  • Reading a posterior as prior-free certainty. The reported posterior depends on the priors, ABFs, region, and causal-variant model. It is not the probability that a gene is biologically causal.
  • Applying the single-signal model automatically. If multiple causal signals are plausible, a single-signal result may misrepresent the evidence; use an approach that accommodates multiple signals.
Key takeaway: Calculate TWAS association and colocalization as distinct analyses, verify their inputs and assumptions, and reconcile them only at the level their evidence supports. A strong shared-signal result can strengthen a gene-level interpretation without establishing a causal mechanism.

Check Your Understanding

Use the definitions and calculations above to answer these questions.

  1. Why does the TWAS denominator include the LD matrix rather than only the squared prediction weights?
  2. In the colocalization calculation, which hypothesis is represented by the sum over \(i\ne j\), and why are same-variant products excluded?
  3. What does the posterior probability of about 0.934 for \(H_4\) mean in this example, and what does it not establish?
  4. How did reducing \(p_{12}\) from \(10^{-5}\) to \(10^{-6}\) change the \(H_4\) posterior, and why?
  5. Name two assumptions or data checks that should be examined before interpreting the regional results.
Clinical Biostats