Lesson 10 of 20
Heatmaps — the decisions you make before colouring a table
Figs. 3A and 6A · row normalisation and ordering
A heatmap is simple. Colour each cell of a table according to its value. That is all.
But three decisions come first. All three change the picture completely.
The left panel answers which genes are abundant; the right answers which genes respond to the condition. The paper wants the right one.
Python
Runs in your browser
The second decision — ordering — matters more than it looks.
Clustering
groups similar rows together. It can reveal structure you did not know about.
But the picture depends on where you rotate the branches of the dendrogram
By value
largest change first. Honest and reproducible.
But group structure stays invisible
One important fact: a clustered heatmap always looks beautiful. Feed it noise and it still looks beautiful — you sorted like with like, so of course blocks appear. So “there are blocks in the heatmap” is not evidence of anything.
Clustering makes anything look organised. That is why the blocks in a heatmap cannot be the basis of a conclusion.
Python
Runs in your browser
🤔 Check yourself
Genes differ enormously in expression scale. What happens if you skip row z-scoring?
Answer A handful of ribosomal proteins at CPM in the thousands will eat the entire colour range. Every other gene's variation ends up the same colour.
🤔 Check yourself
You cluster a matrix of random numbers and draw it as a heatmap. What do you see?
Answer Clustering groups like with like, so it groups even when there is nothing to group. Blocks in a heatmap are a hypothesis, not evidence.
🤔 Check yourself
Why does the phrase 'normalized expression' in the Fig. 6A legend matter?
Answer Without knowing whether it was normalised, the reader misreads the colours. 'Highly expressed' and 'high for this gene' are completely different claims.