Clustering a matrix of measurements finds genes that move together and patients that look alike. Stacking several kinds of data separates tumors that switch off the same gene by different routes, and a cohort of pure noise shows how much a stable-looking cluster is worth.
After normalization, an expression experiment is a matrix with genes as rows, samples as columns and one abundance estimate in each cell. Differential expression tests the rows one at a time. A heatmap looks at the whole matrix at once, to find genes that move together and samples that look alike. The matrix here is first a small simulated experiment, then a simulated tumor cohort in which three different defects all leave CDKN1A (p21) switched off.
A heatmap replaces the numbers with colors. In genomics the most useful first view is often row-scaled: each gene is centerd on its own average and divided by its own spread, so the color shows that gene's pattern across samples and ignores its absolute abundance.
Hierarchical clustering starts with a distance between expression profiles, then repeatedly joins the closest genes or clusters. The result is a tree called a dendrogram, in which nearby leaves have similar profiles under the chosen distance and linkage rule. Here the distance is one minus the Pearson correlation (1 − r) and the linkage is the average distance between members, the pairing Eisen and colleagues made standard for expression data in 1998.
Figure 1. A simulated 30-gene by 10-sample expression matrix (log2). Ten genes were made higher in the five treated samples, ten lower, and ten were given no pattern. The first strip beside the matrix shows which (up, down, gray for none); the strip over the columns marks the treated samples (teal) and the controls (gray). The original order is a random shuffle, and the names G01 to G30 and S01 to S10 were assigned after shuffling. Clustered reorders rows and columns by average-linkage clustering on 1 − r and draws both trees. The slider cuts the gene tree at a height (the dashed line); the second strip colors the resulting groups in both orders, with single-gene groups left pale. Hover or tap a cell, or focus the matrix and use the arrow keys, for its values.
In the original order the three kinds of gene are interleaved and no block is visible. Clustered, the ten up genes come back as one branch, joined at 1 − r = 0.23, and nine of the ten down genes as another. The ten no-pattern genes form no block of their own. Each one joins whichever branch its noise happens to correlate with, so they sit between and below the two blocks. The column tree's first split separates the five treated samples from the five controls.
The Abundance view shows why heatmaps are row-scaled. Each gene was given its own baseline, from log2 4.2 to 10.5, and those baselines outweigh the treatment, so the blocks fade into horizontal stripes. The trees do not change between the two views, because correlation already ignores a gene's mean and scale.
Each leaf of the tree is a gene, and the height where two branches merge is the dissimilarity at which those groups were joined. Low merges mean tight groups. High merges join groups that stayed apart until late. Cutting the tree at a height keeps every merge below the cut and undoes every merge above it.
Nothing in the tree says where to cut it. Below 1 − r = 0.23, where the up branch closes, the up genes break into smaller groups. At 0.60, the ten up genes share one group and the ten down genes another, but those two groups have picked up one and two no-pattern genes on the way, and the other seven no-pattern genes stay single or in small groups. Every cut height gives a valid set of clusters, and hierarchical clustering would produce a tree even from data with no groups at all. Deciding how many groups the data supports needs a second step, which the cohort below makes concrete.
CDKN1A is switched on by p53, the protein made from TP53. Five Views of a Broken Pathway followed three ways a tumor can lose it: mutate TP53, amplify MDM2 (whose protein marks p53 for destruction), or methylate the CDKN1A promoter so that p53 can no longer switch it on even though p53 itself is intact. The cohort here comes from the same simulated generator as that essay and the clinical evidence essay: 100 patients in four planted subtypes, TP53-mutant (40), MDM2-amplified (12), CDKN1A-methylated (18, all TP53-wildtype without MDM2 amplification) and pathway-intact (30). In 6 of the methylated tumors the promoter is only partly methylated and CDKN1A only partly down. Those are the hard cases planted on purpose.
One measurement lumps the routes together. Of the 50 patients with the lowest CDKN1A, 32 are TP53-mutant, 7 MDM2-amplified and 11 methylated: low CDKN1A says the pathway is off, not why.
Figure 2. All 100 simulated patients. The upper panel is CDKN1A expression alone, one dot per patient, spread vertically only so the dots don't overlap. The lower panel keeps the same horizontal position and adds a second measurement, the mean methylation (β) of four CpGs in the CDKN1A promoter island, with TP53-mutant and MDM2-amplified tumors marked. Hover or tap a dot, or focus the figure and use the arrow keys (patients in CDKN1A order), to follow one patient through both panels.
With the second axis the routes separate. Methylated tumors sit high, TP53-mutant and MDM2-amplified tumors sit low with low CDKN1A, and intact tumors sit low with high CDKN1A. The partly methylated tumors fall in between: β about 0.33 and CDKN1A 6.14 on average, against 0.08 and 7.21 for intact tumors and 0.72 and 4.98 for fully methylated ones.
A multi-omics heatmap stacks every measurement with patients as the shared columns. Expression, methylation and copy number are not comparable in raw units, so each row is drawn on its own scale, and the patterns are read down each column. The column order is itself a claim about which patients belong together.
Figure 3. The simulated cohort, one column per patient. Top tracks: the cluster computed by consensus clustering (Figure 4), the planted subtype, tumor mutation burden (mutations per Mb), stage, and whether the patient died during follow-up. Then relative expression (z-score per gene across patients), methylation β at four CpGs in the CDKN1A promoter island (offsets from the transcription start site), alterations in ten genes, and copy number (log2 ratio) at four loci. The figure at the end of each alteration row is the percentage of patients altered. Mutations are drawn as bars and copy-number calls fill the cell; on a narrow screen every alteration fills the cell. Hover or tap a column, or focus the figure and use the arrow keys, for one patient.
Sorted by TP53 status, as in Five Views, the TP53-mutant tumors gather on one side, and the MDM2 amplifications fall among the wildtype columns together with the methylated and intact tumors. Sorted by CDKN1A, the three routes interleave at the low end. Sorted by the computed clusters, each route gets its own block: the MDM2 amplifications, the methylated promoters and the TP53 mutations line up under their own cluster color, and the planted strip shows where the computed blocks disagree with the truth.
The computed clusters come from consensus clustering (Monti and colleagues, 2003). It draws 80% of the patients at random, splits them into k groups with k-means, and repeats that 50 times. For every pair of patients it records the fraction of the draws containing both in which they landed in the same group, its consensus. A final average-linkage clustering of those fractions gives the k clusters. It runs on 15 features: six expression values, the four CpGs, copy number at four loci, and the TP53 mutation call. The continuous ones are standardized and capped at three standard deviations; the mutation call stays 0 or 1. Stage, survival and the planted labels are not used. The labels enter in one place: each computed cluster is named after the planted subtype it overlaps most, so that the two strips can be compared.
The method needs k, and the usual way to choose it is to try several and see which gives the crispest consensus. One measure of crispness is the proportion of ambiguous clustering (PAC; Șenbabaoğlu, Michailidis and Li, 2014): the share of patient pairs whose consensus is between 0.1 and 0.9, pairs that sometimes cluster together and sometimes not. Fewer ambiguous pairs means a crisper k.
Figure 4. Consensus matrices for k = 2 to 6 on the cohort and on a noise cohort, PAC against k, and the selected matrix drawn large. Each cell is the share of resamples in which two patients landed in the same cluster, from 0 (the figure background) to 1 (the strongest shade). Patients are ordered by their computed cluster. The noise cohort has the same size (100 patients) and the same correlations among the 15 features as the real one, but is drawn from a single multivariate normal blob, so it has no subtypes. The gray lines on the chart are 20 such draws (the one shown is darker); the dotted line is the cohort with each feature shuffled on its own. Choose a thumbnail to draw it large. The large matrix has the computed clusters along its left edge and, for the cohort, the planted subtypes along its top edge. Hover or tap it, or focus it and use the arrow keys, for a pair's value.
On the cohort, PAC is lowest at k = 4 (0.024), and 92 of the 100 patients land in the cluster named after their planted subtype. The MDM2-amplified, fully methylated and intact tumors come back whole. Two blocks are softer than the others: the TP53-mutant block (mean consensus 0.98, lowest pair 0.72) and the intact block (0.97, lowest pair 0.81). Their edges hold patients that some resamples put in the other block, and two TP53-mutant tumors with mid-range CDKN1A (P010, P020) end up in the intact cluster.
So do the planted hard cases. All 6 partly methylated tumors join the intact cluster, with mean consensus 0.93 with the intact tumors and 0.05 with the fully methylated ones. The simulation says these tumors took the methylation route; the data, at this level of methylation, put them with the tumors that took no route. Asking for a fifth cluster does not rescue them: at k = 5 the extra cluster splits 5 TP53-mutant tumors off instead.
The noise cohort is the warning. Its PAC is lowest at k = 2 in 10 of 20 draws, and draw 15 splits into two blocks with a PAC of 0.040: a single blob with correlated features, cut cleanly in two. This is the effect Șenbabaoğlu and colleagues described. Consensus clustering finds stable-looking clusters in data with none, so a low PAC on its own is not evidence of subtypes. What the cohort has and the noise lacks is a dip below the noise at the same k. At k = 4 the cohort's PAC is 0.024 against 0.25 to 0.51 for the 20 noise draws, while at k = 2 the cohort (0.38) sits inside the noise range. The shuffled cohort is a weaker comparison. Shuffling each feature on its own breaks every correlation, its PAC stays above 0.58 at every k, and almost any real cohort would look structured against it.
Stage and survival were kept out of the clustering. If outcome leaks into the features, the subtype labels become a circular explanation of the outcome they are later used to predict. Whether these subtypes differ in outcome is a separate question: Clinical Evidence follows the same simulated patients into survival analysis and splits them by subtype.
The heatmaps here show a few dozen genes or features. Dimensionality Reduction handles single-cell data with around 20,000 genes per cell by placing each cell as a point, so that cells with similar expression land close together.