ComplexHeatmap v1.10.2

by Zuguang Gu

Making Complex Heatmaps

Complex heatmaps are efficient to visualize associations between different sources of data sets and reveal potential structures. Here the ComplexHeatmap package provides a highly flexible way to arrange multiple heatmaps and supports self-defined annotation graphics.

Readme

Build Status codecov bioc bioc

Make Complex Heatmaps

Complex heatmaps are efficient to visualize associations between different sources of data sets and reveal potential structures. Here the ComplexHeatmap package provides a highly flexible way to arrange multiple heatmaps and supports self-defined annotation graphics.

General design

Generally, a heatmap list contains several heatmaps and row annotations.

default

Surrounding the heatmap list, there are legends for heatmaps and annotations, also there are titles which are placed on the four sides of the heatmap list. And for each heatmap, there are also different components surrounding the heatmap body.

The ComplexHeatmap package is implemented in an object-oriented way. To describe a heatmap list, there are following classes:

  • Heatmap class: a single heatmap containing heatmap body, row/column names, titles, dendrograms and column annotations.
  • HeatmapList class: a list of heatmaps and row annotations.
  • HeatmapAnnotation class: defines a list of row annotations and column annotations.

There are also several internal classes:

  • SingleAnnotation class: defines a single row annotation or column annotation.
  • ColorMapping class: mapping from values to colors.

ComplexHeatmap is implemented under grid system, so users should know basic grid functionality to get full use of the package.

Install

ComplexHeatmap is available on Bioconductor, you can intall it by:

source("http://bioconductor.org/biocLite.R")
biocLite("ComplexHeatmap")

If you want the latest version, install it directly from GitHub:

library(devtools)
install_github("jokergoo/ComplexHeatmap")

Usage

Make a single heatmap:

Heatmap(mat, ...)

A single Heatmap with column annotations:

ha = HeatmapAnnotation(df = anno1, anno_fun = anno2, ...)
Heatmap(mat, ..., top_annotation = ha)

Make a list of heatmaps:

Heatmap(mat1, ...) + Heatmap(mat2, ...)

Make a list of heatmaps and row annotations:

ha = HeatmapAnnotation(df = anno1, anno_fun = anno2, ..., which = "row")
Heatmap(mat1, ...) + Heatmap(mat2, ...) + ha

As a base package

ComplexHeatmap can be used as a base package to build other packages which focus On specific applications. E.g. EnrichedHeatmap package uses ComplexHeatmap as base to make heatmaps which visualize the enrichment of genomic signals to specific target regions.

Vignettes

There are several vignettes in the package. Each vignette focuses on a specific topic. Following lists the general topics discussed in these vignettes:

  1. Making a Single Heatmap

    This vignette introduces the basic configuration for making a single heatmap. Similar as other R functions/packages, the basic usage is quite similar, but there are several unique features for ComplexHeamtap package.

    • Works both for numeric matrix and character matrix
    • For numeric matrix which contains continuous values, the package allows a color mapping function which can give more accurate colors and be robust to outliers.
    • Highly flexible for clustering. You can define the distance method for clustering by:

      • a pre-defined distance such as "euclidean" or "pearson"
      • a self-defined function which calculates distance from a matrix.
      • a self-defined function which calculates distance from two vectors

        You can define the clustering method by:

      • a clustering function such as diana() from cluster package
      • a hclust or dendrogram object.
    • NA is allowed for clustering and heatmap visualization.
    • Dendrogram and dimension names can be put on any side of the heatmap.
    • Rows on the heatmap can be split by cutree, by kmeans or by a data frame which contains different levels that split the heatmap.
    • The heatmap body itself can be completely self-defined.
  2. Making a List of Heatmaps

    This vignette introduces how to concatenate a list of heatmaps and how adjustment is applied to keep the correspondence of the heatmaps.

  3. Heatmap Annotations

    This vignette introduces the concept of the heatmap annotation and demonstrate how to make simple annotations as well as complex annotations. Also, the vignette explains the difference between column annotations and row annotations.

  4. Heatmap and Annotation Legends

    This vignette introduces how to configurate the heatmap legend and annotation legend, also how to add self-defined legends.

  5. Heatmap Decoration

    This vignette introduces methods to add more self-defined graphics to the heatmaps after the heatmaps are generated.

  6. Interactive with Heatmaps

    How to select a region in the heatmap to retrieve the sub-matrix.

  7. OncoPrint

    How to make an oncoPrint.

  8. Examples

    More simulated and real-world examples are shown in this vignette.

Visualize high dimensional genomic data

The examples visualizes correlation between methylation and expression, as well as other annotation information (data are randomly generated). In the heatmap, each row corresponds to a differentially methylated regions (DMRs). From left to right, heatmaps are:

  1. methylation for each DMRs in samples.
  2. direction of the methylation (one column heatmap), i.e. is methylation hyper in tumor or hypo?
  3. expression for the genes that are associated with corresponding DMRs (e.g. closest gene).
  4. signiciance for the correlation between methylation and expression (-log10(p-value)).
  5. type of genes, i.e. is the gene a protein coding gene or a lincRNA?
  6. annotation to gene models, i.e. is the DMR located in the intragenic region of the corresponding gene or the DMR is intergenic?
  7. distance from the DMR to the TSS of the corresponding gene.
  8. overlapping between DMRs and enhancers (Color shows how much the DMR is covered by the enhancers).

download

OncoPrint

OncoPrint visualize multiple genomic alteration events through a heatmap. From verion 1.3.0, ComplexHeatmap package provides a new oncoPrint() function. By this function, users can define their own graphics which correspond to differnet alteration events. Also the function additionally add barplots on two sides of the heatmap which tell number of different alterations in patients or samples.

With general functionality of ComplexHeamtap, you can add more heatmaps / row annotations to the oncoPrint, even split the oncoPrint to enphasize sub groups.

oncoprint

Interact with heatmaps

You can use mouse to select a region on the heatmap, it will return row index and column index which correspond to the selected region.

License

GPL (>= 2)

Functions in ComplexHeatmap

Name Description
HeatmapAnnotation Constructor method for HeatmapAnnotation class
add_heatmap-dispatch Method dispatch page for add_heatmap
anno_link Link annotation with labels
decorate_heatmap_body Decorate the heatmap body
SingleAnnotation Constructor method for SingleAnnotation class
AdditiveUnit-class An internal class
SingleAnnotation-class Class for a single annotation
draw_dend-Heatmap-method Draw dendrogram on row or column
Heatmap Constructor method for Heatmap class
ComplexHeatmap-package Making complex heatmap
AdditiveUnit Constructor method for AdditiveUnit class
Legend Making legend grobs
HeatmapList Constructor method for HeatmapList class
column_anno_boxplot Column annotation which is represented as boxplots
ColorMapping Constructor methods for ColorMapping class
column_order-dispatch Method dispatch page for column_order
columnAnnotation Construct column annotations
anno_boxplot Using boxplot as annotation
anno_barplot Using barplot as annotation
component_height-Heatmap-method Height of each heatmap component
column_anno_points Column annotation which is represented as points
row_anno_text Row annotation which is represented as text
anno_points Using points as annotation
column_anno_density Column annotation which is represented as density plot
get_color_mapping_param_list-HeatmapAnnotation-method Get a list of color mapping parameters
anno_histogram Using histogram as annotation
column_anno_barplot Column annotation which is represented as barplots
draw_heatmap_list-HeatmapList-method Draw the list of heatmaps
draw_title-dispatch Method dispatch page for draw_title
draw_dimnames-Heatmap-method Draw row names or column names
component_height-HeatmapList-method Height of each heatmap list component
component_width-HeatmapList-method Width of each heatmap list component
column_order-HeatmapList-method Get column order from a heatmap list
draw-dispatch Method dispatch page for draw
component_width-Heatmap-method Width of each heatmap component
column_anno_histogram Column annotation which is represented as histogram
column_anno_link Column annotation which is represented as links
max_text_height Maximum height of text
add_heatmap-HeatmapAnnotation-method Add row annotations or heatmaps as a heatmap list
map_to_colors-ColorMapping-method Map values to colors
decorate_dend Decorate the heatmap dendrogram
make_row_cluster-Heatmap-method Make cluster on rows
column_anno_text Column annotation which is represented as text
draw_annotation_legend-HeatmapList-method Draw legends for all column annotations
anno_density Using kernel density as annotation
decorate_column_dend Decorate heatmap dendrogram on columns
draw_heatmap_legend-HeatmapList-method Draw legends for all heatmaps
enhanced_basicplot Enhanced version of basic barplot and boxplot
color_mapping_legend-ColorMapping-method Draw legend based on color mapping
decorate_row_names Decorate heatmap row names
draw_title-Heatmap-method Draw heatmap title
decorate_row_title Decorate heatmap row title
component_height-dispatch Method dispatch page for component_height
grid.dendrogram Draw dendrogram under grid system
decorate_title Decorate the heatmap title
draw_title-HeatmapList-method Draw heatmap list title
component_width-dispatch Method dispatch page for component_width
heatmap_legend_size-HeatmapList-method Size of the heatmap legend viewport
selectArea Select an area in the heatmap
prepare-Heatmap-method Prepare the heatmap
draw_heatmap_body-Heatmap-method Draw the heatmap body
row_order-dispatch Method dispatch page for row_order
decorate_annotation Decorate the heatmap annotation
+.AdditiveUnit Add heatmaps or row annotations to a heatmap list
max_text_width Maximum width of text
row_anno_link Column annotation which is represented as links
draw_annotation-Heatmap-method Draw column annotations
row_order-HeatmapList-method Get row order from a heatmap list
get_color_mapping_list-HeatmapAnnotation-method Get a list of color mapping objects
is_abs_unit Whether the unit object contains absolute unit
show-HeatmapList-method Draw a list of heatmaps with default parameters
unify_mat_list Unify a list of matrix
draw-Heatmap-method Draw a single heatmap
row_dend-dispatch Method dispatch page for row_dend
row_anno_points Row annotation which is represented as points
row_anno_boxplot Row annotation which is represented as boxplots
show-ColorMapping-method Print ColorMapping object
make_layout-Heatmap-method Make the layout of a single heatmap
ht_global_opt Global graphic options for heatmaps
show-dispatch Method dispatch page for show
add_heatmap-HeatmapList-method Add heatmaps and row annotations to the heatmap list
anno_text Using text as annotation
decorate_column_title Decorate heatmap column title
densityHeatmap Use colors to represent density distribution
dist2 Calculate pairwise distance from a matrix
draw-HeatmapList-method Draw a list of heatmaps
make_column_cluster-Heatmap-method Make cluster on columns
row_anno_density Row annotation which is represented as density plot
decorate_row_dend Decorate heatmap dendrogram on rows
plotDataFrame Quickly visualize a data frame
set_component_height-Heatmap-method Set height of each heatmap component
show-SingleAnnotation-method Print the SingleAnnotation object
HeatmapList-class Class for a list of heatmaps
ColorMapping-class Class to map values to colors
HeatmapAnnotation-class Class for heatmap annotations
add_heatmap-Heatmap-method Add heatmaps or row annotations as a heatmap list
annotation_legend_size-HeatmapList-method Size of the annotation legend viewport
column_dend-HeatmapList-method Get column dendrograms from a heatmap list
decorate_dimnames Decorate the heatmap dimension names
decorate_column_names Decorate heatmap column names
Heatmap-class Class for a single heatmap
column_order-Heatmap-method Get column order from a heatmap list
draw-SingleAnnotation-method Draw the single annotation
column_dend-dispatch Method dispatch page for column_dend
column_dend-Heatmap-method Get column dendrograms from a heatmap
row_anno_barplot Row annotation which is represented as barplots
row_dend-HeatmapList-method Get row dendrograms from a heatmap list
row_order-Heatmap-method Get row order from a heatmap
row_dend-Heatmap-method Get row dendrograms from a heatmap
draw-HeatmapAnnotation-method Draw the heatmap annotations
make_layout-HeatmapList-method Make layout for the complete plot
oncoPrint Make oncoPrint
show-Heatmap-method Draw the single heatmap with default parameters
show-HeatmapAnnotation-method Print the Heatmap Annotation object
rowAnnotation Construct row annotations
row_anno_histogram Row annotation which is represented as histogram
make_layout-dispatch Method dispatch page for make_layout
No Results!

Last year downloads

Details

Type Package
Date 2016-4-12
VignetteBuilder knitr
biocViews Software, Visualization, Sequencing
URL https://github.com/jokergoo/ComplexHeatmap
License GPL (>= 2)
Packaged 2016-4-12 00:00:00 UTC; Administrator
Repository Bioconductor
Date/Publication 2016-4-12 00:00:00

Include our badge in your README

[![Rdoc](http://www.rdocumentation.org/badges/version/ComplexHeatmap)](http://www.rdocumentation.org/packages/ComplexHeatmap)