Chapter 17: scRNA-Seq Differential Expression, Marker Prioritization & Label Assignment
Tested Stacks:
GATK 4.6.1
Samtools 1.21
Nextflow 24.10
Seurat v5.1
Python 3.12
Prerequisites: Basic Linux CLI & Sequencing Formats
📚 Chapter 17 of 18
0% Course Completed
1. Marker Discovery in Single-Cell Transcriptomics
Once single cells are clustered into discrete UMAP communities, researchers must identify the key genetic markers distinguishing each cluster from all other cells. Because single-cell count matrices contain excessive zero counts (structural zeros and technical dropouts), statistical marker discovery requires specialized tests:
- Wilcoxon Rank-Sum Test: Default non-parametric test. Extremely fast, robust, and highly recommended for general cluster marker prioritization.
- MAST (Model-based Analysis of Single-cell Transcriptomics): Hurdle GLM model adjusting for cellular detection rate (proportion of genes detected per cell).
- LR (Logistic Regression): Models cell cluster membership as a function of gene expression.
2. Multi-Feature Visualization Strategies
| Visualization Method | Information Encoded | Primary Research Value |
|---|---|---|
| DotPlot | Dot size = % of cells expressing marker; Dot color = Mean expression intensity | Compact multi-cluster marker panel validation in publications |
| FeaturePlot | Color gradient projected directly onto 2D UMAP coordinates | Spatial confirmation of marker restriction to distinct UMAP islands |
| VlnPlot (Violin Plot) | Kernel density estimate of expression distribution across clusters | Assessing expression homogeneity and detecting bimodal distributions |
3. Comprehensive Single-Cell Marker Prioritization Script
library(Seurat)
library(dplyr)
library(ggplot2)
# 1. Identify Marker Genes for Every Cluster Against All Other Cells
# Pre-filtering: minimum 25% cells expressing gene in either group, logfc >= 0.25
pbmc.markers <- FindAllMarkers(
pbmc,
only.pos = TRUE,
min.pct = 0.25,
logfc.threshold = 0.25,
test.use = "wilcox"
)
# 2. Extract Top 3 Diagnostic Markers Per Cluster
top3_markers <- pbmc.markers %>%
group_by(cluster) %>%
slice_max(n = 3, order_by = avg_log2FC)
cat("=== Top 3 Marker Genes Per Single-Cell Cluster ===\n")
print(top3_markers[, c("cluster", "gene", "avg_log2FC", "p_val_adj")])
# 3. Multi-Cluster Diagnostic DotPlot
canonical_markers <- c("CD3D", "CD4", "CD8A", "MS4A1", "CD14", "FCGR3A", "NKG7", "PPBP")
DotPlot(pbmc, features = canonical_markers) +
RotatedAxis() +
scale_color_gradient2(low = "#2563eb", mid = "#ffffff", high = "#dc2626") +
labs(title = "Expression of Canonical Lineage Markers Across Single-Cell Clusters")
# 4. FeaturePlot Projection of Key Biomarkers
FeaturePlot(pbmc, features = c("CD3D", "MS4A1", "CD14", "NKG7"), ncol = 2)
⚠️
Common Pitfalls & Troubleshooting Checklist
- Java Heap Exhaustion (GATK / Picard): If processes terminate with
java.lang.OutOfMemoryError, set your environment variable explicitly:export _JAVA_OPTIONS="-Xmx16g -Djava.io.tmpdir=/tmp". - Index Timestamp Mismatch: If tools complain that a BAM index is missing or out of date, regenerate with
samtools index -@ 4 sample.bam. - Conda Channel Conflicts: Avoid ABI incompatibilities between bioconda and conda-forge by setting strict priority:
conda config --set channel_priority strict. - Chromosome Naming Contamination: Always verify whether reference FASTA headers use
chr1or1; divergent naming causes silent alignment drops.
Was this guide helpful to your research?
Help us maintain 100% accurate, peer-reviewed bioinformatics standards.