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
)
A named list of peak files as GRanges object. If list is not named, default names will be assigned.
ChromHMM annotation list.
The human genome reference build used to generate peakfiles. "hg19" or "hg38".
If not cell_line
,
will replace chromHMM_annotation
by importing chromHMM data for a given cell line using
get_chromHMM_annotation.
Default TRUE. By default, the heatmaps are interactive.
IfFALSE
, the function generates a static ChromHMM heatmap.
Return the plot data as in addition to the plot itself.
ChromHMM heatmap, or a named list.
### 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.