How to Read a Clustered Gene Expression Heatmap
11 min read · Updated September 11, 2026
A clustered heatmap combines three operations that are easy to mistake for one result: values are transformed into colors, rows and columns are compared with a distance metric, and hierarchical clustering arranges those comparisons into dendrograms. A red cell, a nearby leaf and a short branch therefore answer different questions.
This guide explains row z-scores, correlation and Euclidean distance, average, complete and single linkage, and the limits of dendrogram interpretation. A synthetic eight-gene example shows why a clean red–blue block can demonstrate the arithmetic perfectly without establishing differential expression, biological subtypes or statistical significance.
A clustered heatmap has three layers
The matrix is the evidence. Each row is a gene, each column is a sample and each cell is one supplied numeric value. The color scale turns those values—or a transformation of them—into fill colors. Clustering then computes similarities between row vectors and between column vectors and reorders both axes along two trees.
Changing the color transformation can change what red and blue mean. Changing the distance metric can change which profiles count as similar. Changing linkage can change how already formed groups merge. None of those operations changes the raw numbers, but each changes the question the picture appears to answer.
Read the legend and method before reading the pattern. “These genes are red together” is not interpretable until you know whether the cells show counts, log expression, centered values or row z-scores and which samples defined the row mean.
Prepare an analysis-ready matrix before plotting
A heatmap is not an RNA-seq normalization pipeline. Raw library counts are dominated by sequencing depth and mean–variance dependence, so they normally need an appropriate size-factor normalization and variance-stabilizing, regularized-log or log-count transformation before sample distances are interpreted. The exact method belongs to the upstream experiment and design.
SeqBench accepts a finite rectangular matrix and clusters exactly those values. It does not normalize libraries, transform counts, correct batch effects, impute missing cells, collapse transcript IDs, select variable genes or run differential-expression statistics. Blank, infinite and nonnumeric cells are rejected rather than silently turned into zero.
Gene selection is part of the figure. Plotting only significant genes makes treatment separation easier to see because treatment was already used to select the rows. That can be a useful display of a differential-expression result, but it is not an independent test that the samples separate. For unsupervised sample QC, choose genes without using the group contrast being evaluated, commonly by overall variability after filtering.
Row z-scoring changes the question from level to pattern
For each gene, a row z-score subtracts that row's mean across samples and divides by its sample standard deviation: z = (x − row mean) / row SD. SeqBench uses the sample SD with n − 1 in the denominator, matching common pheatmap and seaborn row-scaling conventions.
After this transformation, every nonconstant row has mean 0 and sample SD 1. A positive cell means that sample is above this gene's own mean; a negative cell means below it. It does not compare the gene's absolute abundance with another gene. A low-expression cytokine and a highly expressed housekeeping gene can both be equally red if each is similarly high relative to itself.
Row scaling removes between-gene magnitude by design. Use it to compare profiles across samples, not to claim that two genes have similar expression levels. SeqBench retains the raw value for the hover tooltip while using the z-score for color and, when enabled, for both row and column clustering.
A constant row has zero standard deviation. SeqBench maps that row to zeros instead of producing NaN; it carries no within-row color contrast. Under correlation distance, any flat row or column has undefined Pearson correlation, which the tool treats as uncorrelated, at distance 1.
Red and blue have no universal biological meaning
With row z-scoring on, SeqBench centers the diverging scale at 0: blue is below the row mean, white is near it and red is above it. Red does not inherently mean induced, significant, activated or good. Its biological direction depends on which samples occupy that column and how the input values were produced.
With row z-scoring off, the page colors raw supplied values on a global scale centered at zero. That is sensible for signed values such as log fold changes, but an all-positive abundance matrix can appear almost entirely white-to-red. It does not automatically recenter each raw row. Read raw mode as one shared numerical scale, not as relative expression per gene.
Color saturation is also dataset-dependent: the page uses a symmetric range of at least −1 to +1 and expands it to the largest absolute displayed value. Adding one extreme row can compress every other cell toward white without changing their data. Compare values in the tooltip and include a labeled legend when exporting a figure.
Correlation and Euclidean distance define different similarities
Correlation distance is 1 − Pearson r. Two profiles with the same shape have r near 1 and distance near 0 even if one has a larger magnitude. Uncorrelated profiles sit near distance 1, and opposite profiles can approach distance 2. This makes correlation useful when the rise-and-fall pattern matters more than absolute separation.
Euclidean distance is the straight-line distance between vectors. It grows with differences in both shape and magnitude and with the number and scale of dimensions. On unscaled expression, high-abundance or high-variance genes can dominate it. Row z-scoring puts genes on a common row scale before Euclidean clustering, but it still asks a different question from correlation.
For row clustering, positive recentering and rescaling of each row do not change its Pearson correlations, so row z-scoring generally leaves row correlation distances unchanged. It does change Euclidean row distances and the column vectors used for either sample-distance calculation. State both the scaling and metric; naming only one is incomplete.
Linkage decides how clusters measure each other
Agglomerative clustering begins with every gene or sample as its own cluster, merges the closest pair, updates distances to the new cluster and repeats until one tree remains. The linkage rule defines that update after clusters contain several members.
Single linkage uses the closest pair across two clusters. It can connect a chain of intermediate profiles even when the endpoints are dissimilar. Complete linkage uses the farthest pair and tends to require tighter, more compact groups, but one outlying member can hold clusters apart. Average linkage uses the size-weighted mean distance across the two groups; SeqBench labels this UPGMA and uses it by default.
None is universally correct. If a biological conclusion exists only under one linkage setting, inspect the underlying distances and outliers rather than declaring that setting the winner. Robust groups should remain recognizable across defensible choices.
A dendrogram records merge order and dissimilarity
Leaves are genes or samples. Each fork joins two leaves or previously formed clusters, and its height is the dissimilarity at which that merge occurred under the selected metric and linkage. Lower merges indicate more similar profiles by that definition.
Height is not time, fold change, variance explained, a p-value or confidence. The current tool performs no bootstrap resampling and places no statistical support on a branch. A tall split can be visually strong while resting on one outlier or on rows selected to maximize the same contrast.
The left-to-right or top-to-bottom leaf order is not unique. Either child of any fork can be rotated without changing the tree, and several equally valid orders can display the same hierarchy. SeqBench uses a deterministic no-crossing traversal; do not assign meaning to IL6 appearing before TNF within an otherwise unchanged branch.
Cutting a dendrogram into two, three or five clusters is an analyst decision unless a separately justified procedure chooses the cut. The page returns and draws the tree but does not calculate an optimal cluster count.
The row tree and sample tree answer different questions
A row distance compares each pair of genes across all sample columns. A column distance compares each pair of samples across all displayed genes. The axes use the same metric name and linkage rule in SeqBench, but the vectors and scientific questions differ.
Gene clusters can suggest co-varying modules, yet co-variation does not establish co-regulation, direct interaction or shared pathway. Sample clusters can reveal treatment, tissue, donor, batch, sex, library quality or one extreme specimen. Match the branches to metadata before naming them.
The displayed gene set controls the sample tree. Removing one large module or selecting a different variable-gene set can change sample relationships. A sample dendrogram is a property of this matrix and preprocessing, not a permanent taxonomy of the samples.
Worked example: two deliberately opposing blocks
The built-in matrix has eight synthetic rows and four columns. IL6, TNF, NFKB1 and CXCL8 are low in ctrl_1/ctrl_2 and high in treated_1/treated_2. COL1A1, ACTA2, FN1 and TAGLN are assigned the opposite pattern. The gene names are familiar, but the numbers are invented solely to make the clustering auditable.
With row z-scoring, correlation distance and average linkage, the current run separates the first four and last four genes into two branches. Its displayed row order is FN1, ACTA2, COL1A1, TAGLN, then NFKB1, CXCL8, IL6, TNF; reversing either branch would represent the same clusters. For IL6, the raw values 2.1, 2.4, 9.8 and 10.2 become z-scores −0.899, −0.832, 0.820 and 0.910.
The two control columns merge at correlation distance 0.0039 and the two treated columns at 0.0066. Those two column clusters merge at 1.9974, close to the maximum distance 2 because the two sample-group profiles are nearly exact opposites across this hand-built row set. Within each gene block, average-linkage merges occur below 0.006; the final two gene branches merge at 1.9972.
That is a successful demonstration of z-scoring, 1 − r and hierarchical clustering. It is not evidence that treatment caused any of these genes to change, that the labels represent real samples, or that two biological subtypes were discovered. The example was constructed to produce the answer.
Distinguish biology, batch and outliers
Join sample metadata before interpreting a branch. If all controls were prepared on Monday and all treated samples on Tuesday, treatment and batch are perfectly confounded and the heatmap cannot separate them. Library size, RNA quality, donor, sex, tissue composition and processing site can each dominate a sample tree.
Inspect principal-component plots, per-sample QC and the raw or transformed matrix alongside the heatmap. Replot after excluding one questionable sample and after changing a defensible gene-selection threshold. A branch that disappears when one row or sample is removed is not the same evidence as a broad replicated pattern.
Replicates clustering together is reassuring but not a statistical test of treatment effect. Conversely, a replicate outside its expected branch may expose a real biological continuum rather than a technical failure. Resolve the discrepancy from metadata and QC instead of relabeling the branch after seeing it.
What a clustered heatmap cannot establish
The figure has no differential-expression model, replicate variance estimate, multiple-testing correction or pathway test. It cannot label a gene significant, a cluster enriched or a treatment causal. Use the appropriate statistical result for those claims and use the heatmap to display or explore the matrix.
Hierarchical clustering always produces a full tree, even for random data with no stable groups. The existence of branches is guaranteed by the algorithm; their stability and biological interpretation are not. Reproducibility across resampling, cohorts or independent experiments supplies evidence the drawing itself lacks.
Eisen et al. popularized clustered displays for genome-wide expression patterns (Proc Natl Acad Sci USA 1998;95:14863–14868, doi:10.1073/pnas.95.25.14863). The enduring value is compact pattern visualization, not automatic discovery of validated gene programs.
Heatmap interpretation checklist
- Record what every cell contains and which normalization or transformation happened upstream.
- State whether rows were z-scored and remember that row scaling removes absolute between-gene magnitude.
- Name the distance metric, linkage rule and whether rows, columns or both were clustered.
- Read dendrogram height as method-specific dissimilarity, never as significance or confidence.
- Inspect the raw values and sample metadata behind any visually striking block.
- Check whether gene selection reused the same group labels the sample clustering appears to recover.
- Test plausible preprocessing, metric and linkage choices and investigate outlier-driven branches.
- Use differential expression, enrichment and independent validation for biological claims beyond visualization.
Know the page's input and output boundaries
SeqBench accepts a tab- or comma-delimited genes × samples matrix with a header row and gene-name first column. The server supports up to 500 genes by 100 samples, requires every cell to be finite and rectangular, and offers row/column clustering, optional row z-scoring, correlation or Euclidean distance, and average, complete or single linkage.
The returned transformed matrix stays in the original input order while separate rowOrder and colOrder arrays drive the display. Raw values are retained for tooltips. Dendrogram merges use SciPy-style node encoding, and regression tests compare both merge heights and tree structure with SciPy across every supported metric and linkage.
The page draws and exports the result; it does not preprocess expression data or attach confidence to clusters. Preserve the original matrix and all settings with any exported figure so the visual can be reproduced.
Frequently asked questions
What do red and blue mean on a gene expression heatmap?
With row z-scoring in SeqBench, red means above that gene's mean across the displayed samples, blue means below it and white is near the row mean. It does not mean significant up- or downregulation and does not compare absolute abundance between genes.
What does row z-score mean on a heatmap?
For each gene, subtract its mean across samples and divide by its sample standard deviation. The row then has mean 0 and sample SD 1, so color shows each gene's relative pattern. Absolute differences between genes are intentionally removed.
Should I use correlation or Euclidean distance?
Use correlation when profile shape matters more than magnitude; identical shapes approach distance 0 even at different scales. Euclidean distance measures straight-line numerical separation and is more sensitive to magnitude and scaling. Choose from the scientific question and report the choice.
What is the difference between average, complete and single linkage?
Single uses the nearest pair between clusters and can create chains; complete uses the farthest pair and favors compact groups; average uses the size-weighted mean distance and is SeqBench's default. A group supported only by one linkage needs closer inspection.
Does dendrogram height show statistical confidence?
No. It is the dissimilarity at which clusters merge under the selected distance and linkage. SeqBench does not bootstrap branches or report p-values. Hierarchical clustering produces a tree for every valid matrix, including random data.
Can I paste raw RNA-seq counts into the heatmap?
The page will cluster finite numbers, but raw counts are usually not analysis-ready because library size and mean–variance dependence dominate distances. Normalize and transform them with a method appropriate to the experiment before interpreting sample relationships.
If treatment and control samples form separate branches, is that proof of an effect?
No. The split may reflect rows selected using that contrast, batch, donor, tissue composition, quality or an outlier. Check unsupervised gene selection, metadata, QC, replicate behavior and a formal differential-expression model.
Can the heatmap handle missing values or very large matrices?
No missing-value imputation is performed; blank, nonnumeric and infinite cells are rejected. The current limit is 500 genes by 100 samples. Subset using a prespecified criterion, commonly variable genes after appropriate filtering, and report that selection.
Related tools
Cluster and visualize a gene x sample expression matrix with row/column dendrograms.
Plot log2 fold-change vs. significance from a DESeq2/edgeR/limma table, with draggable thresholds.
Test a gene list for enriched GO terms and Reactome pathways with hypergeometric p-values and BH-FDR correction.
Convert gene symbols, Ensembl, Entrez GeneID, RefSeq and UniProt accessions in batch, and find cross-species orthologs.