Generate ChIP-seq heatmaps, profile plots, genome-browser tracks, and sample-correlation visualizations. Covers deepTools (production), pyGenomeTracks (modern config-driven tracks), Gviz / EnrichedHeatmap / ChIPseeker (R), and IGV batch scripts. Embeds bigWig normalization decisions (CPM, BPM, RPGC, spike-in scaled), bamCompare operation choice (log2/subtract) with SES scaling, and k-means clustering of heatmaps for biological subgrouping. The most consequential choice is bigWig normalization; it determines whether visual comparison reflects biology.
conda install -c bioconda deeptools samtools bedtools pygenometracks
BiocManager::install(c('Gviz', 'EnrichedHeatmap', 'ChIPseeker',
'TxDb.Hsapiens.UCSC.hg38.knownGene', 'rtracklayer'))
# IGV (for batch screenshots)
# Download from https://software.broadinstitute.org/software/igv/download
Tell the agent what to do: - "Generate spike-in-scaled bigWigs from a BAM list and Drosophila spike-in counts" - "Create a TSS-centered heatmap with k-means clustering across 4 ChIP samples" - "Compare ChIP signal between treatment and control with log2 bamCompare bigWig" - "Build a pyGenomeTracks INI for chr1:1M-2M with H3K27ac, H3K4me3, MACS peaks, gene annotation" - "Make an IGV batch script for 10 published loci to generate consistent screenshots" - "Compute Spearman correlation between 6 replicates with multiBamSummary and plotCorrelation" - "Why does my heatmap look identical across samples when I expect treatment-specific signal?"
"Convert chip.bam and input.bam to bigWigs with CPM normalization. Compute matrix centered on TSS (±3 kb). Generate heatmap with
--zMin -3 --zMax 3 --colorMap RdBu_rand profile plot."
"I have H3K27ac signal at 5000 promoters. Use plotHeatmap with
--kmeans 3to identify clusters of promoters by signal pattern. Output the cluster assignment BED."
"Generate a log2 ratio bigWig: bamCompare ChIP vs input with
--operation log2 --pseudocount 1 --skipZeroOverZero. Use bin size 50."
"I have 120k Drosophila reads in ctrl_1 and 85k in treat_1. Compute scale factors (smallest / each) and generate spike-in-scaled bigWigs. Do NOT also pass
--normalizeUsing."
"Build heatmaps showing H3K27ac signal at union SE regions for DMSO vs BETi. Use RPGC normalization for cross-sample comparability OR spike-in scaled if I have spike-in data."
"Generate pyGenomeTracks figure for chr1:1500000-1700000 showing H3K27ac, H3K4me3, MACS narrowPeak, SE BED, and gene annotation."
"Create an IGV batch script to screenshot 5 specific loci with my BAM, BW, and peak files. End with
exit."
"My heatmap looks pancake-flat. Diagnose: is it normalization (
--zMin --zMaxnot set), data quality, or wrong matrix mode?"
--scaleFactor alone; do not combine with --normalizeUsing)bamCoverage or bamCompare; extend single-end reads to fragment length; bin size 10-50 bp-b 3000 -a 3000, or scale-regions for gene bodies--zMin/--zMax set; --kmeans N for biological subgrouping--perGroup for sample comparisonmultiBamSummary bins -> plotCorrelation --corMethod spearman--scaleFactor alone in bamCoverage for spike-in. deepTools multiplies it by any --normalizeUsing factor, so combining them reintroduces depth normalization.--pseudocount 1 --skipZeroOverZero to avoid -Inf in plots.--zMin/--zMax explicitly. Default ranges are outlier-driven and produce uninformative heatmaps.-S sample only. Order samples so the most-discriminating one is first.effectiveGenomeSize table for accurate RPGC.exit or IGV hangs.--zMin/--zMax not set; outliers dominate the color scale -> set explicit range-b -a parameters--normalizeUsing and --scaleFactor both passed; deepTools multiplies the two, reintroducing depth normalization. Use --scaleFactor alone for spike-in.
samtools view -H bam | headfile =Missing exit at end; IGV waits indefinitely for next command.
Missing --pseudocount 1 or --skipZeroOverZero. Either fix produces plottable values.
k-means clusters by FIRST sample only. If the first sample has weak signal, clustering becomes noise-driven. Reorder samples so the most-discriminating one is first; or compute matrix per-sample and combine externally for joint clustering.