[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EBW4DY483EMQX7M2KCM02J":3,"skill-same:01M7EBW4DY483EMQX7M2KCM02J":68},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":31,"commitSha":32,"skillDirectory":33,"forksCount":14,"repositoryHtmlUrl":34,"repositoryHomepageUrl":34,"ownerHtmlUrl":35,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":36,"install":37,"resources":49},"01M7EBW4DY483EMQX7M2KCM02J","bio-chipseq-visualization",null,"Visualizes ChIP-seq data using deepTools (computeMatrix, plotHeatmap, plotProfile, bamCoverage, bamCompare), pyGenomeTracks (modern INI-driven track plots), Gviz (R browser-style), EnrichedHeatmap (ComplexHeatmap-based), ChIPseeker tag heatmaps, and IGV batch screenshots. Handles bigWig normalization choices (CPM, BPM, RPGC, spike-in scaled), bamCompare operations (log2 ratio, subtract) with SES scaling, k-means clustering of heatmaps for biological subgrouping, and spike-in-scaled tracks for global-shift experiments. Use when generating publication-quality ChIP-seq signal heatmaps, profile plots, genome-browser tracks, or comparing samples visually.","Mr-Nobody-Anonymous\u002FAll-skills","Mr-Nobody-Anonymous","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184253119?v=4","01M7AEXFJHKTYQW5R0ZCQQTWFV","anonymous","01M7C00M3GQR4QKP9GZA42GFAK",0,"MIT","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-chipseq-visualization\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-chipseq-visualization\ndescription: Visualizes ChIP-seq data using deepTools (computeMatrix, plotHeatmap, plotProfile, bamCoverage, bamCompare), pyGenomeTracks (modern INI-driven track plots), Gviz (R browser-style), EnrichedHeatmap (ComplexHeatmap-based), ChIPseeker tag heatmaps, and IGV batch screenshots. Handles bigWig normalization choices (CPM, BPM, RPGC, spike-in scaled), bamCompare operations (log2 ratio, subtract) with SES scaling, k-means clustering of heatmaps for biological subgrouping, and spike-in-scaled tracks for global-shift experiments. Use when generating publication-quality ChIP-seq signal heatmaps, profile plots, genome-browser tracks, or comparing samples visually.\ntool_type: mixed\nprimary_tool: deepTools\ngoal_approach_exempt: true\nsource: \"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills\"\nsource_repository: \"GPTomics\u002FbioSkills\"\nsource_path: \"chip-seq\u002Fchipseq-visualization\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n\n## Version Compatibility\n\nReference examples tested with: deepTools 3.5+, pyGenomeTracks 3.9+, Gviz 1.46+, EnrichedHeatmap 1.32+, ChIPseeker 1.38+, IGV 2.17+, samtools 1.19+, bedtools 2.31+.\n\n# ChIP-seq Visualization\n\n**\"Visualize ChIP-seq signal around features of interest\"** -> Generate normalized signal tracks (bigWig), heatmaps centered on TSS\u002Fpeaks, average profile plots, and genome-browser views — with normalization that supports the biological claim (within-sample vs cross-sample vs spike-in scaled).\n\n- CLI (production): deepTools `bamCoverage` -> `computeMatrix` -> `plotHeatmap` \u002F `plotProfile`\n- CLI (config-driven tracks): pyGenomeTracks (replaces Gviz for many use cases)\n- R (publication): Gviz, EnrichedHeatmap, ChIPseeker tag heatmaps\n- GUI: IGV with batch scripts for reproducible screenshots\n\nThe single most consequential choice is **bigWig normalization** — it determines whether visual comparison reflects biology. Get this right before generating any heatmap or browser view.\n\n## bigWig Normalization Decision Tree\n\n| Goal | Method | When to use |\n|------|--------|------------|\n| Within-sample profile of a single ChIP | `--normalizeUsing CPM` | Standard; reads per million; comparable within one library |\n| Within-sample, length-aware | `--normalizeUsing BPM` | TPM-analog; useful for variable-width regions; less common for ChIP-seq |\n| Cross-sample with equal effective depth | `--normalizeUsing RPGC --effectiveGenomeSize \u003CN>` | \"1x genome coverage\" — assumes equal sequencing genome-wide; ENCODE convention |\n| Cross-condition with global signal change | `--scaleFactor \u003Cspike_in_derived>` (skip `--normalizeUsing`) | HDACi \u002F BETi \u002F EZH2i; see chip-seq\u002Fspike-in-normalization |\n| ChIP vs input ratio | `bamCompare --operation log2` | Visualize enrichment over input |\n| ChIP vs input control-subtracted | `bamCompare --operation subtract` | Absolute signal above background |\n| ChIP vs input SES-corrected | `bamCompare --scaleFactorsMethod SES --operation log2` | More robust to library size; uses signal-extraction-scaling |\n\n**ENCODE convention:** RPGC with read-length-matched effective genome size. For visual comparison of treatment vs control on a fold-change biology, log2 bamCompare against shared input.\n\n**Spike-in scaled tracks (the right way):**\n\n```bash\n# Compute scale factor from spike-in reads (ChIP-Rx Drosophila or CUT&RUN E. coli)\nSCALE=$(echo \"scale=6; 1.0 \u002F $SPIKE_IN_READS_M\" | bc)  # 1 per million spike reads\nbamCoverage -b chip.bam -o chip.bw --scaleFactor $SCALE --binSize 10\n# DO NOT also pass --normalizeUsing; deepTools multiplies the two factors, reintroducing depth normalization\n```\n\n## deepTools Workflow\n\n### bigWig generation\n\n```bash\n# Standard within-sample (CPM)\nbamCoverage -b chip.bam -o chip.bw \\\n    --normalizeUsing CPM --binSize 10 \\\n    --extendReads 200 --numberOfProcessors 8\n\n# Cross-sample at 1x genome coverage (ENCODE)\nbamCoverage -b chip.bam -o chip.bw \\\n    --normalizeUsing RPGC --effectiveGenomeSize 2701495761 \\\n    --binSize 10 --extendReads 200\n\n# ChIP vs Input log2 ratio (visualization of enrichment)\nbamCompare -b1 chip.bam -b2 input.bam -o chip_vs_input.bw \\\n    --operation log2 --binSize 50 --extendReads 200 \\\n    --pseudocount 1 --skipZeroOverZero\n```\n\n### Signal matrix and heatmap (reference-point: TSS \u002F peak summit)\n\n```bash\n# Compute matrix centered on TSS\ncomputeMatrix reference-point \\\n    --referencePoint TSS \\\n    -b 3000 -a 3000 \\\n    -R genes.bed \\\n    -S chip.bw input.bw \\\n    -o matrix.gz \\\n    --outFileSortedRegions sorted_regions.bed \\\n    --numberOfProcessors 8 \\\n    --skipZeros\n\n# Heatmap with k-means clustering (biology emerges from clusters)\nplotHeatmap -m matrix.gz \\\n    -o heatmap.pdf \\\n    --kmeans 3 \\\n    --colorMap RdBu_r \\\n    --zMin -3 --zMax 3 \\\n    --refPointLabel TSS \\\n    --heatmapHeight 12 \\\n    --whatToShow 'heatmap and colorbar'\n\n# Profile plot (average signal across regions)\nplotProfile -m matrix.gz \\\n    -o profile.pdf \\\n    --perGroup \\\n    --plotTitle 'H3K4me3 around TSS'\n```\n\n### Scale-regions (gene-body scaled to common length)\n\n```bash\ncomputeMatrix scale-regions \\\n    -R genes.bed \\\n    -S chip.bw \\\n    -b 3000 -a 3000 \\\n    -m 5000 \\\n    -o matrix_genebody.gz \\\n    --numberOfProcessors 8\n\nplotProfile -m matrix_genebody.gz -o genebody_profile.pdf --perGroup\n```\n\n### Sample correlation\n\n```bash\nmultiBamSummary bins -b sample1.bam sample2.bam sample3.bam \\\n    --binSize 10000 -o results.npz \\\n    --numberOfProcessors 8\n\nplotCorrelation -in results.npz \\\n    --corMethod spearman \\\n    --whatToPlot heatmap \\\n    --plotNumbers -o correlation.pdf \\\n    --outFileCorMatrix correlation.tab\n# Replicates should correlate > 0.8 (narrow), > 0.6 (broad)\n```\n\n## pyGenomeTracks (Modern Browser-Style Plotting)\n\nINI-driven, config-as-code; better than Gviz for complex layouts or pipeline integration.\n\n```ini\n# tracks.ini\n[x-axis]\n\n[chip-h3k27ac]\nfile = h3k27ac.bw\ncolor = darkblue\nheight = 3\ntitle = H3K27ac\n\n[chip-h3k4me3]\nfile = h3k4me3.bw\ncolor = darkred\nheight = 3\ntitle = H3K4me3\n\n[peaks-narrowpeak]\nfile = peaks.narrowPeak\nfile_type = narrow_peak\ncolor = black\nheight = 0.5\ntitle = MACS peaks\n\n[se-bed]\nfile = super_enhancers.bed\ncolor = orange\nheight = 0.5\ntitle = Super-enhancers\n\n[genes]\nfile = genes.gtf\ncolor = darkgreen\nprefered_name = gene_name\nheight = 4\n```\n\n```bash\npyGenomeTracks --tracks tracks.ini --region chr1:1000000-1500000 -o region.pdf\n```\n\nFor pipeline-driven figure generation across multiple regions, pyGenomeTracks is easier to script than Gviz. For one-off publication figures with complex annotation, Gviz remains useful.\n\n## R: Gviz and EnrichedHeatmap\n\n```r\nlibrary(Gviz)\nlibrary(GenomicRanges)\nlibrary(TxDb.Hsapiens.UCSC.hg38.knownGene)\n\nchr \u003C- 'chr1'; start \u003C- 1e6; end \u003C- 1.1e6\nitrack \u003C- IdeogramTrack(genome = 'hg38', chromosome = chr)\ngtrack \u003C- GenomeAxisTrack()\ndtrack \u003C- DataTrack(range = 'sample.bw', genome = 'hg38',\n                     type = 'histogram', name = 'ChIP', col.histogram = 'darkblue')\ngrtrack \u003C- GeneRegionTrack(TxDb.Hsapiens.UCSC.hg38.knownGene,\n                            genome = 'hg38', chromosome = chr, name = 'Genes')\nplotTracks(list(itrack, gtrack, dtrack, grtrack), from = start, to = end, chromosome = chr)\n```\n\n```r\nlibrary(EnrichedHeatmap)\nlibrary(rtracklayer)\n\n# Normalize bigWig signal to a matrix around target sites\nsignal \u003C- import('sample.bw')\ntss \u003C- promoters(txdb, upstream = 0, downstream = 1)\nmat \u003C- normalizeToMatrix(signal, tss, extend = 3000, mean_mode = 'w0', w = 50)\n\n# Heatmap with customization\nEnrichedHeatmap(mat, name = 'Signal', col = c('white', 'red'),\n                top_annotation = HeatmapAnnotation(lines = anno_enriched()))\n```\n\n## ChIPseeker Tag Heatmap (R)\n\n```r\nlibrary(ChIPseeker)\nlibrary(TxDb.Hsapiens.UCSC.hg38.knownGene)\n\npeaks \u003C- readPeakFile('peaks.narrowPeak')\npromoter \u003C- getPromoters(TxDb = TxDb.Hsapiens.UCSC.hg38.knownGene,\n                          upstream = 3000, downstream = 3000)\ntagMatrix \u003C- getTagMatrix(peaks, windows = promoter)\n\n# Tag heatmap and average profile\n# tagHeatmap in ChIPseeker >= 1.36 takes palette (RColorBrewer name), not xlim\u002Fcolor;\n# xlim is read from the tagMatrix window. plotAvgProf still uses xlim\u002Fconf.\ntagHeatmap(tagMatrix, palette = 'Reds')\nplotAvgProf(tagMatrix, xlim = c(-3000, 3000), conf = 0.95,\n             xlab = 'Distance from TSS (bp)', ylab = 'Peak density')\n```\n\n## IGV Batch Scripts\n\n```bash\n# IGV batch script for reproducible screenshots\ncat > igv.batch \u003C\u003C 'EOF'\nnew\ngenome hg38\nload chip.bw\nload peaks.bed\nload super_enhancers.bed\ngoto chr1:1000000-1100000\nsnapshot region1.png\ngoto chr2:50000000-51000000\nsnapshot region2.png\nexit\nEOF\n\nigv.sh -b igv.batch\n```\n\n## Per-Tool Failure Modes\n\n### bamCoverage -- `--normalizeUsing` and `--scaleFactor` conflict\n\n**Trigger:** Passing both `--normalizeUsing CPM` and `--scaleFactor X`.\n\n**Mechanism:** deepTools multiplies the `--scaleFactor` value by the factor computed from `--normalizeUsing`, so passing both compounds them and reintroduces library-depth normalization on top of the spike-in factor.\n\n**Symptom:** Spike-in scaling appears to have no effect; tracks look like CPM.\n\n**Fix:** Use ONE — `--scaleFactor` alone for spike-in; `--normalizeUsing` alone otherwise. Never both.\n\n### bamCompare -- log2 with zeros produces -Inf\n\n**Trigger:** `bamCompare --operation log2` without pseudocount; many bins have zero reads.\n\n**Mechanism:** log2(0\u002Fx) = -Inf; downstream tools (plotHeatmap) may color these as NaN or fail.\n\n**Fix:** Add `--pseudocount 1` to both samples; or use `--skipZeroOverZero` to skip bins with zero in both samples.\n\n### computeMatrix -- Stranded bigWig vs unstranded reference points\n\n**Trigger:** Using stranded bigWigs (separate plus\u002Fminus) with `reference-point` mode on a BED without strand info.\n\n**Mechanism:** computeMatrix doesn't auto-detect strand; signal is plotted in genomic-strand orientation, breaking TSS-centered plots.\n\n**Fix:** Use unstranded merged bigWig OR ensure BED has strand column 6.\n\n### plotHeatmap `--kmeans` -- Order depends on first sample only\n\n**Trigger:** Using k-means with multiple samples and expecting consistent clustering.\n\n**Mechanism:** k-means clusters by signal in the first `-S` bigWig only; other samples are plotted in the same row order.\n\n**Fix:** Order samples in `-S` so the most-discriminating one is first; for combined clustering across samples, use `--hclust` or run k-means externally on combined matrix.\n\n### Spike-in scaled bigWig -- Wrong scale factor direction\n\n**Trigger:** Computing `scale_factor = spike_reads \u002F 1e6` and passing to `--scaleFactor`.\n\n**Mechanism:** deepTools multiplies signal by scaleFactor; the INVERSE is correct (sample with fewer spike reads gets larger scale factor to compensate).\n\n**Symptom:** Treatment samples appear lower than control even when biology says higher.\n\n**Fix:** `scale_factor = MIN(spike_reads_all_samples) \u002F spike_reads_this_sample`. Always verify against known internal-control regions (blacklist should show no signal change post-scaling).\n\n### Gviz \u002F EnrichedHeatmap -- Memory failure on whole-genome bigWigs\n\n**Trigger:** Loading a 3 GB bigWig into R as a GRanges.\n\n**Mechanism:** Gviz loads the entire bigWig into memory for genome-wide views.\n\n**Fix:** Use `chromosome` parameter to restrict; use `import.bw(con, which = GRanges(...))` to subset; consider pyGenomeTracks for whole-chromosome views.\n\n### pyGenomeTracks -- INI parsing strict\n\n**Trigger:** Custom INI keys not recognized; or section names with spaces.\n\n**Mechanism:** pyGenomeTracks expects exact key names; case-sensitive section labels.\n\n**Fix:** Run `make_tracks_file --trackFiles sample.bw -o tracks.ini` to generate a template; modify from there.\n\n## Reconciliation: When Visualizations Disagree\n\n| Pattern | Likely cause | Action |\n|---------|--------------|--------|\n| Heatmap shows enrichment; profile plot doesn't | Signal concentrated at few regions; profile averages them out | Both correct; heatmap shows distribution, profile shows central tendency |\n| Replicate heatmaps differ at peak edges | Different normalization or stranded vs unstranded bigWigs | Verify bigWig parameters identical; use same `--normalizeUsing` |\n| Spike-in scaled tracks show opposite trend from CPM | Global shift; CPM forces median to control levels | Spike-in is correct; CPM is fooled by composition |\n| ChIPseeker tag heatmap differs from deepTools heatmap | ChIPseeker uses peak density; deepTools uses signal coverage | Different metrics; pick one per analysis |\n| Profile plot loose-replicate band wide | Genuine biological variability OR one replicate failed | Check per-replicate metrics (chipseq-qc); don't average across failing rep |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| bigWig has all zeros | Wrong chromosome naming (chr vs no chr) | `samtools view -H bam | head` to check; convert if needed |\n| computeMatrix \"all regions skipped\" | BED chromosome naming mismatches bigWig | Match seqlevels |\n| plotHeatmap colors compressed | `--zMin\u002F--zMax` not set; outliers dominate | Set `--zMin -3 --zMax 3` or use percentile-based |\n| IGV batch hangs | `exit` command missing; IGV waits for input | Always end batch script with `exit` |\n| pyGenomeTracks region out of range | Region exceeds chromosome length | Verify region from `samtools view -H bam` |\n| Spike-in scaled track has artifact stripes | Scale factor too extreme (>10x) | Verify spike-in reads adequate (>100k); check titration |\n\n## References\n\n- Ramírez F et al 2016 Nucleic Acids Res 44:W160 (deepTools)\n- Lopez-Delisle L et al 2021 Bioinformatics 37:422 (pyGenomeTracks)\n- Hahne F & Ivanek R 2016 Methods Mol Biol 1418:335 (Gviz)\n- Gu Z et al 2018 BMC Genomics 19:234 (EnrichedHeatmap)\n- Yu G et al 2015 Bioinformatics 31:2382 (ChIPseeker)\n- Thorvaldsdóttir H et al 2013 Brief Bioinform 14:178 (IGV)\n- ENCODE 2012 quality metrics (NSC\u002FRSC; for cross-correlation context)\n\n## Related Skills\n\n- chip-seq\u002Fpeak-calling - Peak files for heatmap reference regions\n- chip-seq\u002Fchipseq-qc - QC plots (fingerprint, correlation) complement visualization\n- chip-seq\u002Fspike-in-normalization - Spike-in-scaled bigWig generation\n- chip-seq\u002Fdifferential-binding - Visualize differential peak signal\n- chip-seq\u002Fsuper-enhancers - SE region visualization in tracks\n- data-visualization\u002Fgenome-tracks - General genome track patterns + IGV batch + pyGenomeTracks\n- data-visualization\u002Fheatmaps-clustering - General heatmap conventions\n","## Version Compatibility\n\nReference examples tested with: deepTools 3.5+, pyGenomeTracks 3.9+, Gviz 1.46+, EnrichedHeatmap 1.32+, ChIPseeker 1.38+, IGV 2.17+, samtools 1.19+, bedtools 2.31+.\n\n# ChIP-seq Visualization\n\n**\"Visualize ChIP-seq signal around features of interest\"** -> Generate normalized signal tracks (bigWig), heatmaps centered on TSS\u002Fpeaks, average profile plots, and genome-browser views — with normalization that supports the biological claim (within-sample vs cross-sample vs spike-in scaled).\n\n- CLI (production): deepTools `bamCoverage` -> `computeMatrix` -> `plotHeatmap` \u002F `plotProfile`\n- CLI (config-driven tracks): pyGenomeTracks (replaces Gviz for many use cases)\n- R (publication): Gviz, EnrichedHeatmap, ChIPseeker tag heatmaps\n- GUI: IGV with batch scripts for reproducible screenshots\n\nThe single most consequential choice is **bigWig normalization** — it determines whether visual comparison reflects biology. Get this right before generating any heatmap or browser view.\n\n## bigWig Normalization Decision Tree\n\n| Goal | Method | When to use |\n|------|--------|------------|\n| Within-sample profile of a single ChIP | `--normalizeUsing CPM` | Standard; reads per million; comparable within one library |\n| Within-sample, length-aware | `--normalizeUsing BPM` | TPM-analog; useful for variable-width regions; less common for ChIP-seq |\n| Cross-sample with equal effective depth | `--normalizeUsing RPGC --effectiveGenomeSize \u003CN>` | \"1x genome coverage\" — assumes equal sequencing genome-wide; ENCODE convention |\n| Cross-condition with global signal change | `--scaleFactor \u003Cspike_in_derived>` (skip `--normalizeUsing`) | HDACi \u002F BETi \u002F EZH2i; see chip-seq\u002Fspike-in-normalization |\n| ChIP vs input ratio | `bamCompare --operation log2` | Visualize enrichment over input |\n| ChIP vs input control-subtracted | `bamCompare --operation subtract` | Absolute signal above background |\n| ChIP vs input SES-corrected | `bamCompare --scaleFactorsMethod SES --operation log2` | More robust to library size; uses signal-extraction-scaling |\n\n**ENCODE convention:** RPGC with read-length-matched effective genome size. For visual comparison of treatment vs control on a fold-change biology, log2 bamCompare against shared input.\n\n**Spike-in scaled tracks (the right way):**\n\n```bash\n# Compute scale factor from spike-in reads (ChIP-Rx Drosophila or CUT&RUN E. coli)\nSCALE=$(echo \"scale=6; 1.0 \u002F $SPIKE_IN_READS_M\" | bc)  # 1 per million spike reads\nbamCoverage -b chip.bam -o chip.bw --scaleFactor $SCALE --binSize 10\n# DO NOT also pass --normalizeUsing; deepTools multiplies the two factors, reintroducing depth normalization\n```\n\n## deepTools Workflow\n\n### bigWig generation\n\n```bash\n# Standard within-sample (CPM)\nbamCoverage -b chip.bam -o chip.bw \\\n    --normalizeUsing CPM --binSize 10 \\\n    --extendReads 200 --numberOfProcessors 8\n\n# Cross-sample at 1x genome coverage (ENCODE)\nbamCoverage -b chip.bam -o chip.bw \\\n    --normalizeUsing RPGC --effectiveGenomeSize 2701495761 \\\n    --binSize 10 --extendReads 200\n\n# ChIP vs Input log2 ratio (visualization of enrichment)\nbamCompare -b1 chip.bam -b2 input.bam -o chip_vs_input.bw \\\n    --operation log2 --binSize 50 --extendReads 200 \\\n    --pseudocount 1 --skipZeroOverZero\n```\n\n### Signal matrix and heatmap (reference-point: TSS \u002F peak summit)\n\n```bash\n# Compute matrix centered on TSS\ncomputeMatrix reference-point \\\n    --referencePoint TSS \\\n    -b 3000 -a 3000 \\\n    -R genes.bed \\\n    -S chip.bw input.bw \\\n    -o matrix.gz \\\n    --outFileSortedRegions sorted_regions.bed \\\n    --numberOfProcessors 8 \\\n    --skipZeros\n\n# Heatmap with k-means clustering (biology emerges from clusters)\nplotHeatmap -m matrix.gz \\\n    -o heatmap.pdf \\\n    --kmeans 3 \\\n    --colorMap RdBu_r \\\n    --zMin -3 --zMax 3 \\\n    --refPointLabel TSS \\\n    --heatmapHeight 12 \\\n    --whatToShow 'heatmap and colorbar'\n\n# Profile plot (average signal across regions)\nplotProfile -m matrix.gz \\\n    -o profile.pdf \\\n    --perGroup \\\n    --plotTitle 'H3K4me3 around TSS'\n```\n\n### Scale-regions (gene-body scaled to common length)\n\n```bash\ncomputeMatrix scale-regions \\\n    -R genes.bed \\\n    -S chip.bw \\\n    -b 3000 -a 3000 \\\n    -m 5000 \\\n    -o matrix_genebody.gz \\\n    --numberOfProcessors 8\n\nplotProfile -m matrix_genebody.gz -o genebody_profile.pdf --perGroup\n```\n\n### Sample correlation\n\n```bash\nmultiBamSummary bins -b sample1.bam sample2.bam sample3.bam \\\n    --binSize 10000 -o results.npz \\\n    --numberOfProcessors 8\n\nplotCorrelation -in results.npz \\\n    --corMethod spearman \\\n    --whatToPlot heatmap \\\n    --plotNumbers -o correlation.pdf \\\n    --outFileCorMatrix correlation.tab\n# Replicates should correlate > 0.8 (narrow), > 0.6 (broad)\n```\n\n## pyGenomeTracks (Modern Browser-Style Plotting)\n\nINI-driven, config-as-code; better than Gviz for complex layouts or pipeline integration.\n\n```ini\n# tracks.ini\n[x-axis]\n\n[chip-h3k27ac]\nfile = h3k27ac.bw\ncolor = darkblue\nheight = 3\ntitle = H3K27ac\n\n[chip-h3k4me3]\nfile = h3k4me3.bw\ncolor = darkred\nheight = 3\ntitle = H3K4me3\n\n[peaks-narrowpeak]\nfile = peaks.narrowPeak\nfile_type = narrow_peak\ncolor = black\nheight = 0.5\ntitle = MACS peaks\n\n[se-bed]\nfile = super_enhancers.bed\ncolor = orange\nheight = 0.5\ntitle = Super-enhancers\n\n[genes]\nfile = genes.gtf\ncolor = darkgreen\nprefered_name = gene_name\nheight = 4\n```\n\n```bash\npyGenomeTracks --tracks tracks.ini --region chr1:1000000-1500000 -o region.pdf\n```\n\nFor pipeline-driven figure generation across multiple regions, pyGenomeTracks is easier to script than Gviz. For one-off publication figures with complex annotation, Gviz remains useful.\n\n## R: Gviz and EnrichedHeatmap\n\n```r\nlibrary(Gviz)\nlibrary(GenomicRanges)\nlibrary(TxDb.Hsapiens.UCSC.hg38.knownGene)\n\nchr \u003C- 'chr1'; start \u003C- 1e6; end \u003C- 1.1e6\nitrack \u003C- IdeogramTrack(genome = 'hg38', chromosome = chr)\ngtrack \u003C- GenomeAxisTrack()\ndtrack \u003C- DataTrack(range = 'sample.bw', genome = 'hg38',\n                     type = 'histogram', name = 'ChIP', col.histogram = 'darkblue')\ngrtrack \u003C- GeneRegionTrack(TxDb.Hsapiens.UCSC.hg38.knownGene,\n                            genome = 'hg38', chromosome = chr, name = 'Genes')\nplotTracks(list(itrack, gtrack, dtrack, grtrack), from = start, to = end, chromosome = chr)\n```\n\n```r\nlibrary(EnrichedHeatmap)\nlibrary(rtracklayer)\n\n# Normalize bigWig signal to a matrix around target sites\nsignal \u003C- import('sample.bw')\ntss \u003C- promoters(txdb, upstream = 0, downstream = 1)\nmat \u003C- normalizeToMatrix(signal, tss, extend = 3000, mean_mode = 'w0', w = 50)\n\n# Heatmap with customization\nEnrichedHeatmap(mat, name = 'Signal', col = c('white', 'red'),\n                top_annotation = HeatmapAnnotation(lines = anno_enriched()))\n```\n\n## ChIPseeker Tag Heatmap (R)\n\n```r\nlibrary(ChIPseeker)\nlibrary(TxDb.Hsapiens.UCSC.hg38.knownGene)\n\npeaks \u003C- readPeakFile('peaks.narrowPeak')\npromoter \u003C- getPromoters(TxDb = TxDb.Hsapiens.UCSC.hg38.knownGene,\n                          upstream = 3000, downstream = 3000)\ntagMatrix \u003C- getTagMatrix(peaks, windows = promoter)\n\n# Tag heatmap and average profile\n# tagHeatmap in ChIPseeker >= 1.36 takes palette (RColorBrewer name), not xlim\u002Fcolor;\n# xlim is read from the tagMatrix window. plotAvgProf still uses xlim\u002Fconf.\ntagHeatmap(tagMatrix, palette = 'Reds')\nplotAvgProf(tagMatrix, xlim = c(-3000, 3000), conf = 0.95,\n             xlab = 'Distance from TSS (bp)', ylab = 'Peak density')\n```\n\n## IGV Batch Scripts\n\n```bash\n# IGV batch script for reproducible screenshots\ncat > igv.batch \u003C\u003C 'EOF'\nnew\ngenome hg38\nload chip.bw\nload peaks.bed\nload super_enhancers.bed\ngoto chr1:1000000-1100000\nsnapshot region1.png\ngoto chr2:50000000-51000000\nsnapshot region2.png\nexit\nEOF\n\nigv.sh -b igv.batch\n```\n\n## Per-Tool Failure Modes\n\n### bamCoverage -- `--normalizeUsing` and `--scaleFactor` conflict\n\n**Trigger:** Passing both `--normalizeUsing CPM` and `--scaleFactor X`.\n\n**Mechanism:** deepTools multiplies the `--scaleFactor` value by the factor computed from `--normalizeUsing`, so passing both compounds them and reintroduces library-depth normalization on top of the spike-in factor.\n\n**Symptom:** Spike-in scaling appears to have no effect; tracks look like CPM.\n\n**Fix:** Use ONE — `--scaleFactor` alone for spike-in; `--normalizeUsing` alone otherwise. Never both.\n\n### bamCompare -- log2 with zeros produces -Inf\n\n**Trigger:** `bamCompare --operation log2` without pseudocount; many bins have zero reads.\n\n**Mechanism:** log2(0\u002Fx) = -Inf; downstream tools (plotHeatmap) may color these as NaN or fail.\n\n**Fix:** Add `--pseudocount 1` to both samples; or use `--skipZeroOverZero` to skip bins with zero in both samples.\n\n### computeMatrix -- Stranded bigWig vs unstranded reference points\n\n**Trigger:** Using stranded bigWigs (separate plus\u002Fminus) with `reference-point` mode on a BED without strand info.\n\n**Mechanism:** computeMatrix doesn't auto-detect strand; signal is plotted in genomic-strand orientation, breaking TSS-centered plots.\n\n**Fix:** Use unstranded merged bigWig OR ensure BED has strand column 6.\n\n### plotHeatmap `--kmeans` -- Order depends on first sample only\n\n**Trigger:** Using k-means with multiple samples and expecting consistent clustering.\n\n**Mechanism:** k-means clusters by signal in the first `-S` bigWig only; other samples are plotted in the same row order.\n\n**Fix:** Order samples in `-S` so the most-discriminating one is first; for combined clustering across samples, use `--hclust` or run k-means externally on combined matrix.\n\n### Spike-in scaled bigWig -- Wrong scale factor direction\n\n**Trigger:** Computing `scale_factor = spike_reads \u002F 1e6` and passing to `--scaleFactor`.\n\n**Mechanism:** deepTools multiplies signal by scaleFactor; the INVERSE is correct (sample with fewer spike reads gets larger scale factor to compensate).\n\n**Symptom:** Treatment samples appear lower than control even when biology says higher.\n\n**Fix:** `scale_factor = MIN(spike_reads_all_samples) \u002F spike_reads_this_sample`. Always verify against known internal-control regions (blacklist should show no signal change post-scaling).\n\n### Gviz \u002F EnrichedHeatmap -- Memory failure on whole-genome bigWigs\n\n**Trigger:** Loading a 3 GB bigWig into R as a GRanges.\n\n**Mechanism:** Gviz loads the entire bigWig into memory for genome-wide views.\n\n**Fix:** Use `chromosome` parameter to restrict; use `import.bw(con, which = GRanges(...))` to subset; consider pyGenomeTracks for whole-chromosome views.\n\n### pyGenomeTracks -- INI parsing strict\n\n**Trigger:** Custom INI keys not recognized; or section names with spaces.\n\n**Mechanism:** pyGenomeTracks expects exact key names; case-sensitive section labels.\n\n**Fix:** Run `make_tracks_file --trackFiles sample.bw -o tracks.ini` to generate a template; modify from there.\n\n## Reconciliation: When Visualizations Disagree\n\n| Pattern | Likely cause | Action |\n|---------|--------------|--------|\n| Heatmap shows enrichment; profile plot doesn't | Signal concentrated at few regions; profile averages them out | Both correct; heatmap shows distribution, profile shows central tendency |\n| Replicate heatmaps differ at peak edges | Different normalization or stranded vs unstranded bigWigs | Verify bigWig parameters identical; use same `--normalizeUsing` |\n| Spike-in scaled tracks show opposite trend from CPM | Global shift; CPM forces median to control levels | Spike-in is correct; CPM is fooled by composition |\n| ChIPseeker tag heatmap differs from deepTools heatmap | ChIPseeker uses peak density; deepTools uses signal coverage | Different metrics; pick one per analysis |\n| Profile plot loose-replicate band wide | Genuine biological variability OR one replicate failed | Check per-replicate metrics (chipseq-qc); don't average across failing rep |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| bigWig has all zeros | Wrong chromosome naming (chr vs no chr) | `samtools view -H bam | head` to check; convert if needed |\n| computeMatrix \"all regions skipped\" | BED chromosome naming mismatches bigWig | Match seqlevels |\n| plotHeatmap colors compressed | `--zMin\u002F--zMax` not set; outliers dominate | Set `--zMin -3 --zMax 3` or use percentile-based |\n| IGV batch hangs | `exit` command missing; IGV waits for input | Always end batch script with `exit` |\n| pyGenomeTracks region out of range | Region exceeds chromosome length | Verify region from `samtools view -H bam` |\n| Spike-in scaled track has artifact stripes | Scale factor too extreme (>10x) | Verify spike-in reads adequate (>100k); check titration |\n\n## References\n\n- Ramírez F et al 2016 Nucleic Acids Res 44:W160 (deepTools)\n- Lopez-Delisle L et al 2021 Bioinformatics 37:422 (pyGenomeTracks)\n- Hahne F & Ivanek R 2016 Methods Mol Biol 1418:335 (Gviz)\n- Gu Z et al 2018 BMC Genomics 19:234 (EnrichedHeatmap)\n- Yu G et al 2015 Bioinformatics 31:2382 (ChIPseeker)\n- Thorvaldsdóttir H et al 2013 Brief Bioinform 14:178 (IGV)\n- ENCODE 2012 quality metrics (NSC\u002FRSC; for cross-correlation context)\n\n## Related Skills\n\n- chip-seq\u002Fpeak-calling - Peak files for heatmap reference regions\n- chip-seq\u002Fchipseq-qc - QC plots (fingerprint, correlation) complement visualization\n- chip-seq\u002Fspike-in-normalization - Spike-in-scaled bigWig generation\n- chip-seq\u002Fdifferential-binding - Visualize differential peak signal\n- chip-seq\u002Fsuper-enhancers - SE region visualization in tracks\n- data-visualization\u002Fgenome-tracks - General genome track patterns + IGV batch + pyGenomeTracks\n- data-visualization\u002Fheatmaps-clustering - General heatmap conventions\n",{"name":5,"source":24,"license":15,"tool_type":25,"description":7,"imported_at":26,"source_path":27,"primary_tool":28,"source_repository":29,"goal_approach_exempt":30},"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills","mixed","2026-09-20","chip-seq\u002Fchipseq-visualization\u002FSKILL.md","deepTools","GPTomics\u002FbioSkills",true,"main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fbiology\u002Fbio-chipseq-visualization","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous","2026-11-09 11:45:36",{"source":8,"skillName":5,"commands":38,"prompt":48,"zipAvailable":30},[39,42,45],{"tool":40,"command":41},"npx","npx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-chipseq-visualization",{"tool":43,"command":44},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-chipseq-visualization",{"tool":46,"command":47},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-chipseq-visualization","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-chipseq-visualization\u002FSKILL.md",[50,56,62],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"examples\u002Fchipseeker_profile.R","OTHER","其他",935,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-chipseq-visualization\u002Fexamples\u002Fchipseeker_profile.R",{"path":57,"resourceType":58,"resourceTypeDesc":59,"sizeBytes":60,"sourceHtmlUrl":61},"examples\u002Fdeeptools_heatmap.sh","SCRIPT","脚本",1178,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-chipseq-visualization\u002Fexamples\u002Fdeeptools_heatmap.sh",{"path":63,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":66,"sourceHtmlUrl":67},"usage-guide.md","REFERENCE","参考文档",7707,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-chipseq-visualization\u002Fusage-guide.md",[69,77,84,91,98,105],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":76},"01M7FFFZPC2025JQQHPHDX154J","dei-assessment","Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-assessment\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":76},"01M7FFFWN8H4WA7A6Y398QKB6J","dei-action-plan","Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-action-plan\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":76},"01M7FFFSHTM0QZRVZ2NRJTJ0PY","culture-fit-assessment","Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fculture-fit-assessment\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":76},"01M7FFFMA12RKEQA38KHJSXXPS","cowork-to-code-bridge","Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcowork-to-code-bridge\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":76},"01M7FFFH1F6M8YRGW5V487GH1K","counter-offer-response","Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcounter-offer-response\u002FSKILL.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":76},"01M7FFFDGEHV8Y7J9N40HZXW52","continuous-feedback-system","Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcontinuous-feedback-system\u002FSKILL.md",[],[]]