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:
Hi, Thanks. Does V1, V2, and V3 indicates column-1, 2 and 3 respectively in the "GSM3045250_N_ATAC_Kaech_1_peaks.broadPeak.gz" file in the following code? Please let me know. targets <- makeGRangesFromDataFrame( df = fread("GSM3045250_N_ATAC_Kaech_1_peaks.broadPeak.gz", header = FALSE, data.table = FALSE), seqnames.field = "V1", start.field = "V2", end.field = "V3")
These are the default colnames that
data.table::freadgives objects without headers (=colnames). On disk this is a plain text file without colnames. Does that answer your question?
Thank you. Yes. I have one more question. Can I create a file only with first three columns (col-1: Chr1; col-2: Start; col-3: end) and explore a bigwig files using that grange?. The context is, I have a set of 50-100 gene coordinates and I want to explore only those targets in a bigwig file. Just to get a heatmap of those 50-100 genes alone. Please let me know. Thanks in advance.
I guess so. You can subset the targets file to whatever you want. If you have these gene coordinates as GRanges then probably
subsetByOverlapson the target file will do the job.