Why Plot Phenotype and Genotype Against Ancestry?
Ancestry principal components (PCs) summarize major axes of genetic variation in a study sample. If phenotype or candidate-variant genotype varies along one of those axes, a plot can make that pattern visible before or alongside an association analysis. This matters because ancestry-related differences in phenotype and allele frequency can create an apparent association even when the variant has no direct effect on the phenotype.
A plot is an exploratory diagnostic, not a test of association and not proof that ancestry caused a pattern. Its purpose is to reveal features worth examining: a shift in phenotype across PC scores, different genotype distributions between ancestry groups, an imbalance in where cases and controls lie, or a pattern that a single straight trend would not summarize well. The plot should be read in the context of how the phenotype, genotype, and PCs were measured.
Choosing Axes, Marks, and Groupings
For a continuous phenotype, plot the phenotype value on the vertical axis and a PC score on the horizontal axis. Each mark represents one participant. A scatterplot can show a linear trend, curvature, clusters, outliers, or changing variability. If the phenotype is binary, placing values at zero and one often causes overplotting. Use slight vertical jitter solely to separate marks, or show the fraction of participants with the phenotype in PC-score bins. Jitter does not alter the recorded data and must not be interpreted as extra measurement precision.
For a candidate variant, plot genotype dosage on the vertical axis against a PC score. Dosage usually counts copies of the specified alternate allele, so values range from zero to two for a diploid biallelic genotype; imputed dosages can take fractional values in that range. Observed genotypes therefore form horizontal bands at zero, one, and two, while imputed dosages can fill in between. A difference in the frequency of those bands across PC scores can be more informative than a fitted line alone.
Color adds a second variable. It can represent case-control status, a previously defined ancestry group, or another relevant sampling category. For example, coloring phenotype-versus-PC points by case status can reveal whether cases occupy a different part of PC space than controls. Coloring genotype-versus-PC points by ancestry group can show group-specific dosage distributions. A legend should identify the colors clearly; avoid using many similar colors that are difficult to distinguish.
When there are multiple PCs, start with separate plots of each important PC rather than putting many dimensions into one crowded graph. A scatterplot of PC1 against PC2 can show the sample's broad structure; coloring it by phenotype or case status can show whether those labels are distributed unevenly across that space. Faceting or stratifying by a defined group can make patterns easier to compare, but small strata can be noisy and binning can hide within-bin structure. Keep axis labels, units where applicable, and the identity of the variant or phenotype explicit.
Worked Example: A Phenotype Trend Along PC1
Suppose a hypothetical study records a continuous biomarker and PC1 for four participants. The biomarker is measured in millimoles per liter. The points are \((-2,4)\), \((-1,5)\), \((1,7)\), and \((2,8)\), where each ordered pair is (PC1 score, biomarker). Assume the displayed PC scores and phenotype values refer to the same participants, with no missing values among these four. A scatterplot places PC1 horizontally and biomarker vertically.
To summarize the visible direction with a straight line, calculate the descriptive least-squares slope. The sample means are \(\bar{x}=0\) PC1 units and \(\bar{y}=6\) millimoles per liter. The slope is
The intercept is \(a=\bar{y}-b\bar{x}=6-(1)(0)=6\), so the fitted line is \(\hat{y}=6+1x\). In this small hypothetical set, the fitted biomarker value increases by 1 millimole per liter per PC1 score unit. The four points lie exactly on that line. This is a descriptive summary of these observations; it does not establish that ancestry changes the biomarker, and it does not show that a candidate variant is associated with it.
Using Color to Show Case-Control Imbalance
A useful case-control display can put participants' PC scores on the axes and color points by case status. If cases and controls occupy different regions, the sample has ancestry-PC imbalance by case status. Another option is to plot a binary phenotype against PC1 using binned case fractions, with the number of participants in each bin reported. The fraction makes the pattern easier to see than a stack of points at zero and one, but bin boundaries and bin sizes affect the display.
Worked Example: Comparing Case Fractions Across PC1 Bins
In a hypothetical sample, investigators divide PC1 into two prespecified display bins. In the lower-PC1 bin there are 40 participants, of whom 8 are cases; in the higher-PC1 bin there are 40 participants, of whom 20 are cases. The plot shows one case-fraction point per bin, with the bin counts included in the labels.
The observed case fractions are
Thus, in this hypothetical sample, the higher-PC1 bin has a case fraction 0.30, or 30 percentage points, greater than the lower-PC1 bin. The display indicates case-control imbalance along PC1 in these data. It does not show that PC1 causes case status: differences in recruitment, phenotype, or other features could contribute. Nor does the plot alone determine whether an association estimate is biased; that requires analysis under an appropriate model and assumptions.
A PC1-versus-PC2 plot colored by case status is complementary. It shows the joint distribution of cases and controls in two dimensions, which separate one-dimensional plots can miss. If cases cluster in a region with relatively few controls, the comparison may rely heavily on extrapolation or sparse overlap. That is a warning to inspect the data and analysis carefully, not a stand-alone rule for whether an analysis is valid.
Plotting Candidate-Variant Genotype
The genotype plot asks whether the candidate variant's dosage distribution changes across ancestry-PC values. A systematic shift can reflect differing allele frequencies across ancestry-related groups. If case status is also associated with PC scores, the joint patterns are relevant to confounding: phenotype and genotype may both vary with ancestry. The plot does not separate that explanation from a genuine genetic effect.
A fitted straight line can provide a compact description of the average dosage pattern. For observed points \((x_i,y_i)\), where \(x_i\) is a PC score and \(y_i\) is genotype dosage, the least-squares line \(\hat{y}=a+bx\) minimizes the sum of squared vertical residuals. It is a visual summary, not necessarily a probability model for genotype. In particular, dosage is bounded, and a straight line may conceal discrete genotype bands, nonlinear changes, or different patterns in distinct groups.
Worked Example: A Dosage Trend Across PC1
Consider a hypothetical candidate variant in five participants with PC1 scores \(-2,-1,0,1,2\) and alternate-allele dosages \(0,0,1,2,2\), respectively. Assume these are complete observations from the same five participants and the dosage uses the same alternate-allele definition throughout. The mean PC1 score is 0 and the mean dosage is 1.
The descriptive least-squares slope is
Since \(\bar{x}=0\) and \(\bar{y}=1\), the intercept is \(a=1-(0.600)(0)=1\). The fitted line is \(\hat{y}=1+0.600x\). In this illustrative set, fitted dosage increases by 0.600 alternate-allele copies per PC1 score unit. The observed dosages are discrete, so the line summarizes their average direction rather than predicting a possible genotype for every participant. A real plot should also show the points, since the line alone would hide the three dosage levels.
A Short Justification for the Fitted Line
The least-squares line is obtained by minimizing \(Q(a,b)=\sum_i(y_i-a-bx_i)^2\). Setting the derivative with respect to \(a\) to zero gives \(\sum_i(y_i-a-bx_i)=0\), and therefore \(a=\bar{y}-b\bar{x}\). Substituting this expression into the derivative with respect to \(b\), and setting that derivative to zero, gives
This derivation explains what the displayed line summarizes: the direction and scale of the linear relationship in the plotted observations. It does not require treating the line as an inferential regression model. To attach uncertainty or a causal interpretation to a slope would require additional modeling assumptions and an analysis suited to the scientific question.
Compare Groups Without Hiding Their Distributions
Coloring points by ancestry group or case status helps distinguish a pooled pattern from group-specific patterns. If a trend appears only because groups occupy different PC ranges, a pooled line may be misleading as a summary of within-group relationships. Plotting group-specific trends, or showing separate panels, can make that distinction visible. These displays should be interpreted as descriptions of the observed groups, not as a substitute for a justified adjustment strategy.
The same principle applies when examining genotype and phenotype together. For example, a PC1-versus-PC2 sample plot colored by case status can be paired with phenotype-versus-PC1 and dosage-versus-PC1 plots. If the case distribution and dosage distribution both shift across PC1, the visual evidence motivates careful confounding control. It does not establish that the candidate variant explains the phenotype pattern.
Worked Example: Reading Group-Specific Dosage Patterns
Suppose a hypothetical cohort contains two ancestry groups, A and B. In a low-PC1 bin, the mean dosages are 0.40 for 20 group-A participants and 1.20 for 5 group-B participants. In a high-PC1 bin, the mean dosages are 0.60 for 5 group-A participants and 1.60 for 20 group-B participants. A plot colored by group would show that group B has higher mean dosage within both bins, while group composition also changes sharply between bins.
The pooled mean dosage in the low-PC1 bin is
In the high-PC1 bin, it is
The pooled difference is \(1.40-0.56=0.84\) dosage copies, but the group-specific differences between bins are only \(0.60-0.40=0.20\) in group A and \(1.60-1.20=0.40\) in group B. The pooled contrast combines within-group changes with the changing proportions of groups. A color-coded plot makes that composition shift visible. These summary values are illustrative and do not establish the cause of either within-group or pooled differences.
Practical Plotting Sequence
Use matched participant records for the phenotype, genotype, and PC scores. Label the candidate allele and phenotype units precisely.
Plot PC1 against PC2 and color by case-control status or a relevant group to look for uneven representation and poor overlap.
Choose a scatterplot for continuous values, and use jitter or binned fractions for a binary phenotype. Show genotype points even when adding a trend.
Use consistent colors and, where useful, separate panels or group-specific trends. Report group sizes so sparse patterns are apparent.
State which variable appears to differ across PC scores or groups. Treat the observation as a prompt for analysis, not a causal conclusion.
Common Pitfalls and Why the Plots Matter
- Reading a PC as a named ancestry label. A PC is a coordinate of genetic variation, not automatically a direct measure of a particular population. Its sign can be reversed without changing the PCA structure, so describe the direction as higher or lower PC score unless the orientation has a justified interpretation.
- Treating a fitted trend as proof of confounding. A visible association with PC may be consistent with ancestry-related structure, but it does not identify the mechanism or establish bias in a particular association estimate.
- Hiding points behind each other. Genotype dosages often repeat at zero, one, and two, and binary phenotypes overlap at zero and one. Use transparency, jitter for display, or summaries with sample sizes; do not mistake overplotting for low variability.
- Using only a pooled trend. Groups can differ in both PC distribution and mean dosage. Color or stratification can reveal that the pooled pattern combines group composition with within-group differences.
- Overinterpreting a small or sparse region. A handful of participants can create an apparent cluster or steep trend. Show counts, inspect the individual observations, and avoid claiming a stable pattern where support is limited.
- Assuming the plot replaces analysis. Visual inspection can reveal imbalance and suggest questions, but association inference requires an appropriate method and its assumptions.
These plots are valuable because they make a potential source of association distortion concrete. A phenotype pattern, genotype-frequency pattern, and case-control imbalance may each look modest alone, while their joint distribution clarifies why ancestry adjustment deserves attention. Their role is to inform interpretation and analysis, not to decide the answer from appearance alone.
Check Your Understanding
Answer each question using the plotting principles in this tutorial.
- For a continuous phenotype, which variable belongs on each axis in a phenotype-versus-PC1 scatterplot, and what does a fitted slope summarize?
- Why might a binary phenotype need jitter or binned case fractions rather than an ordinary scatterplot alone?
- A dosage plot shows higher values at higher PC1 scores. What does this observation suggest, and what does it not establish?
- Why can coloring genotype-versus-PC plots by ancestry group change the interpretation of a pooled trend?
- What information should accompany a plot based on PC bins so that a visually striking fraction is not interpreted without context?