biology2u
Tier
⌕ Search ⌘K
Concept

Clustering gene expression

T-110Home BU-401Threads information · systems
Statement

Finding structure in transcriptomic data.

Why it matters

sequence-alignment and blast-database-search both work on sequence data, finding relationships by comparing strings of nucleotides or amino acids directly. Expression clustering works on a different kind of data entirely — a matrix of quantitative expression levels across many genes and many conditions, samples, or timepoints — where there is no sequence to align at all. It provides a way to generate hypotheses about which genes are functionally related, purely from how their expression rises and falls together, complementing rather than replacing sequence-based homology evidence.

Clustering results are hypotheses to be tested, not conclusions: two genes clustering together indicates correlated expression, which is consistent with (but does not itself prove) co-regulation or shared function, a distinction that matters throughout the Common errors below.

Hypotheses
Genes with similar expression profiles across many conditions are more likely to be co-regulated or functionally related ("guilt by association").This is the core working assumption motivating the whole approach: if two genes are consistently turned up and down together across many different conditions, a shared regulatory mechanism or shared pathway membership is a reasonable, testable hypothesis, though not a certainty. A chosen distance or similarity metric meaningfully captures biological similarity, once the data has been properly normalised.Raw read counts or intensities are affected by technical factors (sequencing depth, array scaling, batch) unrelated to biology; without normalising these out first, a distance metric risks measuring technical variation rather than the biological pattern of interest.
Proof
1
\text{Represent each gene as a vector of expression values across } n \text{ conditions, samples, or timepoints.}
This converts the biological question ("which genes behave similarly?") into a geometric one (which vectors lie close together in \(n\)-dimensional space), making the standard machinery of distance and clustering directly applicable. A
2
d(x,y) = \sqrt{\textstyle\sum_i (x_i-y_i)^2} \qquad \text{or} \qquad d(x,y) = 1-\rho(x,y)
Euclidean distance treats absolute magnitude of expression difference as the similarity measure; correlation distance instead measures similarity of shape (whether two genes rise and fall together across conditions) regardless of their absolute expression level, and is often preferred specifically because it is insensitive to overall scale differences between genes. A
3
\text{Hierarchical clustering repeatedly merges the two closest clusters (by a chosen linkage rule) into one, building a dendrogram.}
Starting from every gene as its own singleton cluster, the algorithm merges the closest pair at each step, using a linkage rule (single, complete, or average distance between cluster members) to define cluster-to-cluster distance once clusters contain more than one gene; the resulting dendrogram encodes a full nested hierarchy of similarity without requiring the number of clusters to be fixed in advance. B
4
\text{k-means clustering minimises } \textstyle\sum_{k}\sum_{x\in C_k}\|x-\mu_k\|^2 \text{ by iterating cluster assignment and centroid update.}
Given a chosen number of clusters \(k\), each gene is assigned to its nearest of \(k\) centroids, the centroids are then recomputed as the mean of their assigned genes, and the two steps repeat until assignments stabilise; unlike hierarchical clustering, \(k\) must be specified in advance rather than emerging from the data itself. B
5
\text{Dimensionality reduction (e.g. PCA) is commonly applied before or alongside clustering to reduce noise and enable visualisation.}
Because expression datasets typically have far more genes than conditions (high dimensionality relative to sample size), projecting onto a small number of dominant axes of variation both reduces the influence of noisy, low-signal dimensions on the distance calculation of Step 2 and makes the resulting cluster structure visualisable in two or three dimensions. A
Result
\text{Distance metric} + \text{clustering algorithm (hierarchical or } k\text{-means)} \Rightarrow \text{groups of co-expressed genes}

Reading. Choosing a distance metric that captures the relevant notion of biological similarity, then applying a clustering algorithm, converts a large expression matrix into a smaller number of groups of genes whose shared expression pattern is a candidate signal of shared regulation or function.

Scope. A hypothesis-generating, exploratory method; cluster membership must be validated by independent evidence (known pathway membership, sequence homology, direct experimental follow-up) before being treated as established biological fact.

Corollaries & converses
  • phylogenetic-tree-construction reuses essentially the same distance-plus-linkage machinery as Step 3 here, but applied to sequence divergence between species rather than expression distance between genes — a direct methodological parallel across two otherwise unrelated biological questions.
  • sequence-alignment and blast-database-search find relatedness by direct sequence comparison; expression clustering finds a complementary, expression-based notion of "functional neighbourhood" that need not correspond to sequence similarity at all (unrelated genes can be co-regulated; homologous genes can be expressed very differently).
  • Hierarchical clustering's dendrogram gives a full nested structure without committing to a single cluster count in advance, whereas k-means forces exactly \(k\) clusters regardless of the data's true structure — the two methods can, and often do, disagree on cluster boundaries for the same dataset.
Fails without
  • Skip normalisation for sequencing depth or batch effects (Hypotheses): two genes' expression vectors could appear more (or less) similar simply because their samples were sequenced to different depths or processed in different batches, so the resulting clusters could reflect a technical artefact of the experiment rather than a genuine biological co-expression pattern.
  • Choose k arbitrarily in k-means without justification (Step 4): the algorithm will always output exactly \(k\) clusters, whether or not that many genuine groups actually exist in the data, potentially fragmenting one true biological cluster into several, or merging two genuinely distinct ones into one, purely as an artefact of the chosen \(k\).
Common errors
  • Treating cluster co-membership as proof of shared function or direct co-regulation, rather than as a correlational hypothesis requiring independent validation (Result, Scope).
  • Using Euclidean distance on raw, unnormalised expression values, letting very highly expressed genes dominate the distance calculation by absolute magnitude rather than by the shape of their expression pattern across conditions.
  • Assuming hierarchical clustering produces "the" correct tree of gene relationships; different linkage rules (single, complete, average) can produce materially different dendrogram topologies from the identical underlying distance matrix.
  • Forgetting that k-means requires specifying the number of clusters in advance, while hierarchical clustering does not — and then comparing results from the two methods as though they were run under equivalent, method-independent conditions.
Discussion

Hierarchical clustering of gene expression data, together with a dendrogram-ordered heatmap visualisation, became a widely used standard analysis technique once genome-scale expression profiling (microarrays, and later RNA sequencing) made it possible to measure thousands of genes' expression simultaneously across many conditions in a single experiment.

Because the number of genes typically far exceeds the number of samples or conditions in a given expression dataset, clustering results can be sensitive to noise in individual, low-signal genes; combining dimensionality reduction (Step 5) with clustering, and requiring a candidate cluster to be reproducible across independent datasets, are both standard ways of guarding against over-interpreting a pattern that arose from noise alone.

Common misconception: that a gene's cluster assignment is a fixed, objective property of the gene itself. In fact, cluster membership depends on the specific set of conditions profiled, the chosen distance metric, and the clustering algorithm and parameters used; the same gene can plausibly fall into different clusters under a different, equally reasonable set of analysis choices.

Worked examples
1
\text{Gene X: } (2,4,8) \text{ across three conditions; Gene Y: } (1,2,4) \text{; Gene Z: } (8,4,2)
Euclidean distance: \(d(X,Y)=\sqrt{1^2+2^2+4^2}=\sqrt{21}\approx4.58\); \(d(X,Z)=\sqrt{6^2+0^2+6^2}=\sqrt{72}\approx8.49\). By Euclidean distance alone, X and Y are closer than X and Z, even though X and Y both rise consistently across the three conditions while Z falls — X and Y share both shape and (roughly, up to a scale factor) magnitude. A
2
\text{Correlation-distance check: } \rho(X,Y)=+1\ (\text{perfectly correlated, same shape}), \quad \rho(X,Z)=-1\ (\text{perfectly anti-correlated})
Correlation distance \(1-\rho\) gives \(0\) for X,Y (identical shape up to scaling) and \(2\) for X,Z (opposite shape) — a sharper separation than the Euclidean distance of Step 1 alone provided, illustrating why correlation distance is often preferred when the pattern of change, not absolute magnitude, is the biologically relevant signal (Step 2 of the Proof). A
\text{X and Y cluster together (correlated pattern); Z is the outlier (anti-correlated)}

Reading. Even a toy three-gene, three-condition example shows how the choice of distance metric can sharpen (or blur) a clustering decision; correlation distance specifically isolates genes moving together in pattern, independent of their absolute expression scale.

Scope. The same computation, scaled up to thousands of genes and many conditions, is exactly what a real hierarchical or k-means clustering pipeline performs, using the chosen metric as its fundamental unit of comparison.

Problems
  1. Two genes have expression vectors \((1,1,1)\) and \((10,10,10)\) across three conditions. Compute their Euclidean distance and their correlation, and explain the apparent contradiction between the two results.
    SolutionEuclidean distance: \(d=\sqrt{9^2+9^2+9^2}=9\sqrt3\approx15.6\), a large value, suggesting dissimilarity. Correlation: both vectors are constant across conditions, so correlation is technically undefined (zero variance) in the strict sense, but the two genes have an identical, perfectly flat pattern (no relative change across conditions) despite very different absolute expression levels. This illustrates why Euclidean distance can flag genes as "dissimilar" purely due to overall expression magnitude, even when their relative pattern across conditions is identical (Common errors, second bullet).
  2. A researcher runs k-means with \(k=3\) and finds three well-separated clusters. She reruns with \(k=5\) on the identical data and again finds five apparently well-separated clusters. Explain how both results can be internally "valid" outputs of the algorithm.
    Solutionk-means always returns exactly the number of clusters specified as \(k\) (Step 4 of the Proof); it does not test whether that number is actually appropriate for the data's true underlying structure. Both runs are valid in the narrow sense that each converged to a local minimum of the within-cluster sum-of-squares objective for its specified \(k\), but this does not by itself establish which value of \(k\) (if either) reflects genuine biological structure; additional criteria (e.g. comparing against a hierarchical dendrogram, or biological validation) are needed to choose between them.
  3. Explain why finding that two genes cluster together in an expression experiment is not, by itself, sufficient evidence that the two genes are regulated by the same transcription factor.
    SolutionClustering identifies statistical co-expression (correlated expression pattern across the profiled conditions), which is the guilt-by-association hypothesis (Hypotheses) — a candidate for shared regulation, not a proof of it. Two genes could show correlated expression for reasons other than sharing a regulator: coincidental response to the same environmental change via entirely independent regulatory pathways, or an indirect causal chain in which one gene's product regulates the other. Confirming shared regulation requires additional evidence, such as demonstrating both genes bind the same transcription factor directly (e.g. eukaryotic-gene-regulation's promoter/enhancer evidence), beyond the clustering result alone.