What gene expression data looks like, and how clustering reveals hidden structure in a matrix of measurements.
A gene expression experiment measures activity across thousands of genes and dozens of samples: tumor vs. healthy, treated vs. untreated, or different patients. After normalization, the result is a matrix: rows of genes, columns of samples, one abundance estimate in each cell.
The matrix is too large to read as a table. A heatmap replaces numbers with colors so patterns become visible. In genomics, the most useful first view is often row-scaled: each gene is centered against its own average, so the color shows that gene's pattern across samples, not its absolute abundance.
Figure 1. An unordered expression matrix. Without a meaningful row or column order, even real structure can look like noise. In the row-scaled view, color means relative expression within a gene, not up- or downregulation by itself.
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. Nearby leaves have similar profiles under the chosen distance and linkage rule.
The same data can look like noise or like clear structure depending on the row and column ordering. Here the clustering uses row-scaled expression and an average-linkage correlation distance, a common choice when the pattern across samples matters more than a gene's absolute abundance.
Figure 2. The same data reordered by similarity. Blocks of co-expressed genes emerge.
The tree on the left of the heatmap is a dendrogram. Each leaf is a gene. The height where two branches merge is the dissimilarity at which those groups were joined. Low merges mean tight groups; high merges mean groups that were kept separate until late in the agglomeration.
Figure 3. Slicing the dendrogram. Lowering the cut height asks for tighter groups, so the same tree breaks into more clusters.
Heatmaps are often paired with metadata: sample conditions, patient ages, gene functions. When clusters align with these annotations, that is evidence that the expression pattern is related to the experimental design or biology. It is a cue for follow-up, not proof by itself.
Figure 4. An annotated heatmap. Colored bars show sample conditions (top) and gene pathways (left).