This tutorial contains some example code to produce visually-appealing enrichment heatmaps using the R/Bioconductor package
EnrichedHeatmap. (BioC, Publication). The package depends on its "parent"
ComplexHeatmap from the same developer. It is therefore advisable to read the documentation (which is extensive) from both packages to get started with the underlying logic and concepts. The tutorial is in no way comprehensive towards the full functionality of the package, nor will it ever be. It is intended to provide some basic code to get started with, hoping to encourage users to dig deeper themselves. It may indeed require a bit of effort to get your head around the package(s) as they offer a large amount of options to customize your heatmaps, at least it did for me. Please go into the documentation and use google in case you need information. Most of the time the same question has already been asked before somewhere, be it on communities or via a Github issue.
Below is the heatmap we want to produce, starting from a BED file that contains peak regions (which are called
EnrichedHeatmap language) and a bigwig file that contains the read counts (called
signals in EH language).
The required data for the example code can be downloaded from GSE111902. Go to the bottom of the page, click
custom next to
GSE111902_RAW.tar and then select the first two files which is
GSM3045250_N_ATAC_Kaech_1.bw (a bigwig file with read counts) and
GSM3045250_N_ATAC_Kaech_1_peaks.broadPeak.gz (a set of genomic regions / peaks from that experiment, here ATAC-seq).
R code for the heatmap: