produce_heatmap: Convert coverage to heatmap

View source: R/produce_heatmap.R

produce_heatmapR Documentation

Convert coverage to heatmap

Description

Convert coverage to heatmap

Usage

produce_heatmap(
  cov,
  peaks,
  name,
  partitions = character(0),
  col = NULL,
  col_order = NULL,
  force_seqlevels = FALSE,
  seed = 99841,
  top_anno_ylim = NULL,
  show_row_names = FALSE,
  row_labels = NULL,
  extend = 5000,
  w = max(extend)/100,
  value_column = "score",
  mean_mode = "w0",
  raster_by_magick = TRUE
)

Arguments

cov

A coverage generated with the import_bedgraph function.

peaks

A GRanges object representing the peaks to import. Peaks will be resized to 5000 base pairs to make sure all regions are of the same length.

name

The name of the heatmap that will be shown at the top.

partitions

If you want to split the heatmap based on different group, you must specify the groups (or partitions). The partition must be a vector of character of the same length as the peaks param. If the vector is empty (i.e. character(0), the heatmap won't be splitted. Default: character(0).

col

A circlize::colorRamp2 object. If NULL, default values will be used.

col_order

A numeric object corresponding to the order of the colors in the right annotation. To use when the colors are not matchning with the top_annotation. Default: NULL.

force_seqlevels

If TRUE, remove regions that are not found in the coverage. Corresponds to pruning.mode = "coarse" in ?seqinfo. Default: FALSE.

seed

Set a seed value for the color selection. Only used when partition is not NULL. The value must be the same as the one used for the prepare_heatmap_list function. Default: 99841.

top_anno_ylim

Manually set the ylim value for the top_annotation. If NULL, value is inferred using the data. Default: NULL.

show_row_names

Show matrix rownames on left side. If FALSE, row names are hidden Default: FALSE.

row_labels

Manually set row label on the left side. If NULL, no row label. Default: NULL.

extend

extended base pairs to the upstream and downstream of target. It can be a vector of length one or two. If it is length one, it means extension to the upstream and downstream are the same.

w

window size for splitting upstream and downstream.

value_column

column index in signal that will be mapped to colors. If it is NULL, an internal column which all contains 1 will be used.

mean_mode

when a window is not perfectly overlapped to signal, how to summarize values to this window. See 'Details' section for a detailed explanation.

raster_by_magick

Value for the raster_by_magick parameter for the EnrichedHeatmap function. Setting to FALSE might help to avoid errors when calling the draw function with a large set of peaks. Default: TRUE.

Value

An heatmap object

Examples

bdg <- get_demo_bdg()
bed_file <- get_demo_bed_files()[[1]]
peaks <- import(bed_file)
cov <- import_bedgraph(bdg)
heatmap <- produce_heatmap(cov, peaks, "demo")


CharlesJB/heatmaps documentation built on Nov. 2, 2023, 10:06 a.m.