Clustering gene expression
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
Proof
Result
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
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
- 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.
Solution
Euclidean 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). - 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.
Solution
k-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. - 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.
Solution
Clustering 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.