Creates a heatmap using outputs from ChromHMM using ggplot2.The function takes a list of peakfiles, performs ChromHMM and outputs a heatmap. ChromHMM annotation file must be loaded prior to using this function. ChromHMM annotations are aligned to hg19, and will be automatically lifted over to the genome_build to match the build of the peaklist.

plot_chromHMM(
  peaklist,
  chromHMM_annotation,
  genome_build,
  cell_line = NULL,
  interact = FALSE,
  return_data = FALSE
)

Arguments

peaklist

A named list of peak files as GRanges object. If list is not named, default names will be assigned.

chromHMM_annotation

ChromHMM annotation list.

genome_build

The human genome reference build used to generate peakfiles. "hg19" or "hg38".

cell_line

If not cell_line, will replace chromHMM_annotation by importing chromHMM data for a given cell line using get_chromHMM_annotation.

interact

Default TRUE. By default, the heatmaps are interactive. IfFALSE, the function generates a static ChromHMM heatmap.

return_data

Return the plot data as in addition to the plot itself.

Value

ChromHMM heatmap, or a named list.

Examples

### Load Data ###
data("CnT_H3K27ac") # example dataset as GRanges object
data("CnR_H3K27ac") # example dataset as GRanges object 
### Create Named Peaklist ###
peaklist <- list(CnT=CnT_H3K27ac, CnR=CnR_H3K27ac) 
### Run ###
my_plot <- plot_chromHMM(peaklist = peaklist,
                         cell_line = "K562",
                         genome_build = "hg19") 
#> --- Running plot_chromHMM() ---
#> Returning 1 matching cell line(s).
#> Rows: 2 Columns: 9
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: "\t"
#> chr (3): X1, X4, X6
#> dbl (5): X2, X3, X5, X7, X8
#> num (1): X9
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.
#> grlist is already in the output_build format. Skipping liftover.
#> Converting to GRangesList.
#> Preparing peaklist.
#> Annotating with features.
#> Working on: CnT
#> Working on: CnR
#> Obtaining target annotation matrix.
#> Returning chrHMM_plot.