omics.co.in logo omics.co.in

deepTools: BigWig Signal Normalization, TSS Matrix Computation & Heatmaps

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 9 of 10 0% Course Completed
PHASE 4 • DEEPTOOLS & HEATMAPS Track 24 • 10 Modular Chapters Huntington's Disease H3K4me3 Case Study

deepTools: BigWig Signal Normalization, TSS Matrix Computation & Heatmaps

Generating genome-wide coverage tracks in BigWig format with deepTools bamCoverage using 1x genome normalization (RPKM/BPM), calculating coverage matrices around Transcription Start Sites (TSS +/- 3kb), and generating publication-ready composite profile plots and clustered heatmaps with plotHeatmap.

⏱️ Estimated Study: 50–60 mins 🧪 Workflows: FastQC, Bowtie2, SAMtools, MACS3, DiffBind, ChIPseeker, deepTools, IGV 📋 Level: Hands-On Epigenomics • Real HD Post-Mortem Data

1. Generating Normalized BigWig Files with deepTools bamCoverage

To compare signal tracks across samples with varying sequencing depths, raw BAM files must be normalized. We use deepTools bamCoverage to generate BigWig tracks normalized to 1x genome coverage ($1\times \text{depth} = \text{BPM}$ / Reads Per Genomic Content):

for sample in HD_Rep1 HD_Rep2 Control_Rep1 Control_Rep2; do
    echo "Generating normalized BigWig for ${sample}..."
    bamCoverage \
        -b 03_filtered/${sample}.clean.bam \
        -o 07_visualization/${sample}.bw \
        --binSize 20 \
        --normalizeUsing BPM \
        --effectiveGenomeSize 2913022398 \
        --ignoreForNormalization chrX chrY chrM \
        --numberOfProcessors 8
done

2. Computing the TSS Signal Matrix with computeMatrix

We calculate H3K4me3 signal density within $\pm 3\text{kb}$ windows surrounding all human Transcription Start Sites (TSS):

# Compute signal matrix around TSS reference points
computeMatrix reference-point \
    --referencePoint TSS \
    -b 3000 -a 3000 \
    -R gencode.v38.annotation.gtf \
    -S 07_visualization/Control_Rep1.bw 07_visualization/Control_Rep2.bw \
       07_visualization/HD_Rep1.bw 07_visualization/HD_Rep2.bw \
    --skipZeros \
    -o 07_visualization/matrix_tss.gz \
    -p 8

3. Plotting Publication-Grade Heatmaps with plotHeatmap

plotHeatmap \
    -m 07_visualization/matrix_tss.gz \
    -out 07_visualization/h3k4me3_tss_heatmap.pdf \
    --colorMap RdYlBu_r \
    --samplesLabel "Control Rep1" "Control Rep2" "HD Rep1" "HD Rep2" \
    --regionsLabel "All Genes" \
    --kmeans 3

plotProfile \
    -m 07_visualization/matrix_tss.gz \
    -out 07_visualization/h3k4me3_tss_composite_profile.pdf \
    --samplesLabel "Control 1" "Control 2" "HD 1" "HD 2" \
    --plotTitle "H3K4me3 Enrichment at Promoters (HD vs Control)"
⚠️

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 chr1 or 1; divergent naming causes silent alignment drops.
Was this guide helpful to your research?
Help us maintain 100% accurate, peer-reviewed bioinformatics standards.
📝 Propose Edit on GitHub ↗