Zubair Khalid

Virologist/Molecular Biologist | Veterinarian | Bioinformatician

Conventional & Molecular Virology • Vaccine Development • Computational Biology

Dr. Zubair Khalid is a veterinarian and virologist specializing in conventional and molecular virology, vaccine development, and computational biology. Dedicated to advancing animal health through innovative research and multi-omics approaches.

Dr. Zubair Khalid - Veterinarian, Virologist, and Vaccine Development Researcher specializing in Computational Biology, Multi-omics, Animal Health, and Infectious Disease Research

Category: Guides

Single Cell Rna Seq Heatmap

A single cell RNA seq heatmap is a color coded matrix that visualizes expression levels of selected genes across thousands of individual cells, typically organized by cluster or trajectory. This guide is for bench scientists, computational biologists, and bioinformatics trainees who need to generate interpretable single cell heatmaps without relying on black box tools. You will learn the conceptual decisions, step by step workflow, quality checks, and common pitfalls that define a reliable heatmap for single cell transcriptomics.

At a Glance

Aspect Summary
Purpose Visualize gene expression patterns across cell clusters or pseudotime
Input data Normalized count matrix (e.g., logCPM, scran, Seurat) with cluster labels
Key decisions Gene selection method, color scale, row scaling, clustering metric
Typical tools pheatmap, ComplexHeatmap, Seurat DoHeatmap, ClusterGVis [11]
Output Publication grade figure showing marker gene enrichment per cluster
Quality signal Clear block structure, consistent color range, no saturated extremes
Warning signs Overclustering artifacts, batch effects visible, arbitrary gene lists

Core Concepts

A single cell RNA seq heatmap is fundamentally different from a bulk RNA seq heatmap. In bulk data, each column averages millions of cells. In single cell data, each column is one cell, and the expression values are often sparse due to dropout. The goal is to reveal whether a set of genes is coordinately expressed in a subset of cells, thereby defining clusters or transitional states. As noted in the EMBL-EBI Training materials, correct normalization and feature selection are prerequisites for any meaningful heatmap.

The most common heatmap displays the top marker genes for each cluster (e.g., from Seurat's FindAllMarkers or Scran's findMarkers). Rows are genes, columns are cells sorted by cluster assignment. The color intensity shows expression level. This visual quickly confirms that marker genes are enriched in their respective clusters and absent elsewhere. It also reveals co expression modules that may indicate shared biological programs. Another variant is the pseudotime heatmap, where columns are ordered by a continuous trajectory inferred from tools like Monocle or Slingshot. That format shows how genes turn on or off along a developmental path. The Galaxy Training Network provides excellent tutorials for generating these heatmaps within accessible workflows.

Clustering the rows (genes) by their expression pattern is standard practice. This groups co expressed genes together and helps the eye perceive modules. Similarly, cells are usually clustered within each annotated cluster to separate subtypes if they exist. Without row clustering, a marker heatmap is still readable but less informative about gene gene relationships.

Decision Points

Every heatmap begins with a set of choices that shape its interpretability.

Gene selection is the single most important decision. A heatmap built from the top 5 to 10 markers per cluster is crisp. A heatmap built from 2000 variable genes becomes a noisy blur. The goal is to show the signature that discriminates clusters, not the entire transcriptome. Use a statistical test (e.g., Wilcoxon rank sum, MAST) to rank markers by fold change and adjusted p value. The Bioconductor framework offers robust marker detection functions.

Color scale must be perceptually uniform and have a meaningful zero. A diverging palette (blue white red) placed at log fold change breaks is common for average expression heatmaps. For single cell, a sequential palette from white/light gray to a saturated color often works better because many genes are expressed at low levels. Avoid rainbow palettes. Check that the color limits do not clip high expression values.

Row scaling (z score normalization) is advisable when genes have very different expression magnitudes. Without scaling, a highly expressed housekeeping gene will dominate the visual field, masking subtle marker expression. However, scaling can amplify dropout noise. A compromise is to scale after log normalization.

Clustering metric choices (Euclidean distance, Pearson correlation, Spearman correlation) affect the grouping of genes and cells. Correlation based distances are generally preferred for single cell data because they focus on pattern shape rather than absolute magnitude. The NCBI Bookshelf references caution that Euclidean distance can be misleading when expression values are near zero for most cells.

Annotation columns such as cluster ID, sample origin, cell cycle phase can be added above the heatmap. These help confirm that the heatmap pattern aligns with known cell groups. Without annotations, the viewer cannot map colors to clusters.

Workflow or Implementation Steps

The following steps provide a reproducible pipeline using R/Bioconductor with Seurat. Adjust for your own toolchain.

  1. Obtain a normalized count matrix and cluster labels. Common inputs are a Seurat object or a SingleCellExperiment object. Ensure that you have applied log normalization and found highly variable genes. Use the NCBI Sequence Read Archive to download raw data if starting from public studies.

  2. Identify marker genes. For each cluster, run differential expression against all other cells. Filter by adjusted p value < 0.05 and log fold change > 0.25. Select the top N markers per cluster (N = 5 to 10 works well). Save the gene list.

  3. Subset the normalized expression matrix to these marker genes. Extract the matrix using Seurat's GetAssayData or SingleCellExperiment's logcounts.

  4. Order the cells by cluster assignment. Within each cluster, you can further order cells by the expression of the top marker to create a smooth transition. Many tools (e.g., DoHeatmap in Seurat) do this automatically.

  5. Create the heatmap with row clustering. Use pheatmap or ComplexHeatmap. Disable column clustering to preserve the cluster order. Add cluster color annotations using annotation_col in pheatmap. Choose a sequential color palette like viridis or Reds.

  6. Check the output. Verify that the top markers are indeed bright in their own cluster and dim elsewhere. If a marker appears bright in multiple clusters, you may have chosen a low specificity gene. Consider increasing the fold change threshold.

The ClusterGVis tool (described in a 2024 Genomics Proteomics Bioinformatics paper) offers an advanced visualization that integrates clustering stability metrics directly with the heatmap, which can improve the interpretability of your results.

Quality Checks

After generating the heatmap, perform these checks.

Block structure. A good heatmap shows clear, rectangular blocks of high expression that align with the cluster annotation colors. If blocks are streaky or cells of the same cluster have mixed expression, consider that the cluster may not be homogeneous.

Color saturation. No more than a few cells should hit the highest color value. If many cells are at the max, your color scale is too narrow. Widen the limits.

Marker specificity. Each marker row should be high only in its own cluster. If a gene is high across all clusters, it is not a useful marker. Remove it and regenerate.

Batch effects. If cells from different samples cluster together in the heatmap but are separated by sample of origin in the annotation, you may have a batch effect. Check whether markers look consistent across batches. If not, apply batch correction methods like harmony or mutual nearest neighbors before marker detection.

Missingness. Single cell data is sparse. The heatmap will have many white cells (zeros). That is expected. However, if a marker is zero in most cells of its own cluster, the gene may be a false positive due to dropout. Consider filtering genes with low detection rates per cluster. The integrative transcriptomic profiling study (2024) highlights the need to account for dropout when interpreting single cell signatures.

Common Mistakes

  • Using too many genes. A heatmap with hundreds of rows becomes a visual mess. Stick to 20 to 50 genes for readability. If you need to show more, split into multiple heatmaps for different modules.

  • Forgetting to scale rows. Genes with high baseline expression (e.g., ribosomal proteins) will dominate and hide marker patterns. Always scale unless you have a specific reason not to.

  • Not ordering cells. Random column order makes the heatmap look like static. Cells must be sorted by cluster and, within cluster, by expression level to reveal gradients.

  • Ignoring annotation. Without a color key for clusters, the heatmap is meaningless. Always include a legend.

  • Relying on default parameters. Default clustering distances in many R packages are set to Euclidean. For single cell, Pearson or Spearman correlation is usually better. Change the distance argument.

  • Interpreting a heatmap as proof of cell type identity. A heatmap shows expression patterns of selected genes. It does not prove a cell type. It is a visualization tool, not a statistical test. Validation with independent methods (RNA velocity, spatial transcriptomics, protein markers) is required. The single molecule imaging study (2024) cautions that bulk averaged signals from heatmaps can mask dynamic transcriptional behavior at the single cell level.

Limits of Interpretation

A single cell RNA seq heatmap has important constraints.

First, it can only display a small fraction of the transcriptome. You are selecting the most variable or most discriminative genes. This selection bias means you might miss subtle but biologically relevant gene programs.

Second, the visual grouping depends on clustering parameters. If you change the resolution of clustering, the heatmap blocks will shift. A resolution of 0.5 might give distinct clusters, while 1.0 splits them further. The same heatmap with different cluster settings can support different narratives. Always report the clustering parameters.

Third, heatmap colors do not reflect absolute transcript counts. They reflect relative normalized measures. You cannot infer copy numbers per cell from a heatmap. The color range is arbitrary and chosen for contrast.

Fourth, batch effects may not be visible if they are aligned with clusters. For example, if clusters correspond to different sample batches, the heatmap may look clean but actually an artifact of batch. Always examine the distribution of samples across clusters.

Fifth, dropout complicates low expression. A gene that is biologically on in a population may appear off in many cells due to technical dropout. This can create false negative patterns. Methods like imputation can help but introduce their own biases. The review on m6A and autophagy related lncRNAs (2024) notes that single cell heatmaps of lncRNAs must be interpreted with extra caution due to their low average expression.

Finally, a heatmap does not tell you causality. If a set of genes is co expressed in a cluster, that correlation may be due to a shared regulatory mechanism or simply because the cells are in the same tissue environment. Causal inference requires perturbation experiments.

Frequently Asked Questions

1. What is the best number of genes to show in a single cell RNA seq heatmap?

For a typical marker heatmap across 5 to 10 clusters, 25 to 50 genes (5 to 10 per cluster) is ideal. If you have many clusters (over 15), increase the total to 100, but avoid exceeding 150 rows for a single figure.

2. Should I use log transformed or raw counts in the heatmap?

Always use normalized, log transformed values. Raw counts are not comparable across cells due to differences in sequencing depth. Log normalization (log1p of counts per million or similar) stabilizes variance and reduces the impact of highly expressed genes.

3. How do I choose between z score scaling and no scaling for my heatmap?

Use z score scaling (row wise centering and scaling) when your selected genes have very different mean expression levels. If all selected markers have similar baseline expression, scaling may not be needed. Compare both versions and choose the one that reveals clearer block structure.

4. Can I create a heatmap from public single cell data that I downloaded from the Sequence Read Archive?

Yes. Download raw FASTQ or count matrices from the NCBI Sequence Read Archive. Process through a standard pipeline (e.g., STARsolo, Cell Ranger, or Alevin). Then apply the workflow above. Be aware that different preprocessing choices (gene annotation, quality thresholds) can affect the final heatmap.

References and Further Reading

Related Articles