Tutorials

PCA for biologists: what the axes mean

How principal components are built, what loadings and variance explained mean, and how scaling and batch effects change a scores plot.

Principal component analysis (PCA) is a way to summarise the main directions of variation in a dataset. In biology it is often used to see whether samples group by condition, batch or something unexpected. The axes are combinations of genes or features, not single variables.

What PCA does

PCA takes a table of samples by features and finds new axes, called principal components, that capture the variation in the data. The first component captures the largest amount of variance, the second captures the next largest in a direction uncorrelated with the first, and so on.

Each sample gets a score on each component. Plotting the scores shows how samples relate in the reduced space. Each feature gets a loading, which describes how strongly it contributes to a component.

PCA is unsupervised: it does not know which samples are cases and which are controls. If the groups separate, that is a property of the data, not a result of the method being told the labels.

What the axes mean

The axes themselves usually have no biological identity. PC1 is a weighted combination of many genes, and its meaning comes from the loadings and from the samples at the extremes.

Do not label an axis "treatment effect" just because the treated samples sit on one side. Check which genes drive the axis. If the top loadings are ribosomal genes or mitochondrial genes, the axis may reflect RNA quality or library composition rather than the treatment.

Scaling and transformation

PCA is sensitive to scale. A feature with a large variance contributes more to the components than a feature with a small variance. For gene expression, this is why the data are usually log-transformed and sometimes centred and scaled before PCA.

Scaling each feature to unit variance gives every feature equal weight. That can be useful when the features are on different scales, but it can also amplify noise in low-variance features. The choice should be stated and should match the question.

For RNA-seq counts, a variance-stabilising transformation is often used before PCA. The transformation reduces the mean-variance relationship so that highly expressed genes do not dominate simply because they are highly expressed.

Variance explained

The percentage of variance explained by each component is a measure of how much of the data the plot summarises. A two-dimensional plot that explains a small fraction of the variance may hide important structure in later components.

Do not treat the first two components as the whole story. Plot the scree plot and inspect several components. A batch effect can dominate PC1 while the biological effect is on PC2, or vice versa.

Interpreting a scores plot

Look at the overall pattern before assigning meaning.

  • Do samples separate by the experimental group?
  • Do they separate by batch, sex, age or sequencing run?
  • Are there outliers far from the rest?
  • Is one group more variable than another?
  • Do the replicates cluster together?

A separation that follows the plate layout is a warning. A separation that follows the condition is encouraging but not proof. A single sample far from its group may be a mislabelled sample, a low-quality library or a real biological outlier.

Loadings

Loadings show which features contribute to a component. A long list of small loadings is hard to interpret; a few dominant features are easier to check.

If the top loadings for a component are genes from one pathway, the component may reflect that pathway. If they are technical features such as mitochondrial fraction or ribosomal content, the component may reflect sample quality. Both are useful to know.

PCA and differential expression

PCA is exploratory. It does not test a hypothesis and does not correct for confounding. A clean separation by group is not a substitute for a differential expression model that accounts for the design.

Conversely, a lack of separation does not prove that there is no difference. A treatment effect may be small relative to other sources of variation, or it may be confined to a few genes that do not dominate the components.

Batch effects and integration

If batch is confounded with condition, PCA may show a strong separation that is impossible to interpret. If batch and condition are partly crossed, the batch effect can be estimated and included in the model.

Some analyses use batch correction or integration before PCA. These methods can help visualisation, but they can also remove biological signal if used carelessly. Always compare the corrected and uncorrected plots and check whether the correction is justified.

Presenting a PCA plot

Label the axes with the component number and the percentage of variance explained. State the transformation, the features used and whether the data were scaled. Use the same colours and shapes consistently across figures.

If you draw ellipses or confidence regions, say what they represent. A cluster of points is not a statistical test. If the plot is used to support a claim, add the analysis that actually tests the claim.

Key points

  • PCA finds directions of variation, not biological causes.
  • Axes are combinations of features and need interpretation.
  • Scaling and transformation change the plot.
  • Check several components, not only the first two.
  • PCA is exploratory, not a hypothesis test.

Common mistakes

  • Calling PC1 the treatment effect without checking loadings.
  • Using raw counts without a variance-stabilising transformation.
  • Ignoring batch or plate effects that drive separation.
  • Treating an outlier as a biological discovery without checking quality.
  • Using a PCA plot as proof of differential expression.

When to ask for help

If a PCA plot is dominated by an unexpected factor, if samples do not cluster by group, or if batch and condition are confounded, ask for a review. You can order an analysis or read the RNA-seq workflow. The RNA-seq Data Analysis course covers PCA and batch effects, and the Biostatistics & Experimental Design course covers the underlying ideas.

Sources and further reading

When to ask for help. If your data or design do not fit a tutorial, order an analysis and we will reply with a fixed price.

Written by the Solagene team for research and education. Found an error? Tell us and we will correct it.