Package ‘ComplexHeatmap’ May 17, 2019 Type Package Title Make Complex Heatmaps Version 2.0.0 Date 2019-04-28 Author Zuguang Gu Maintainer Zuguang Gu <[email protected]> Depends R (>= 3.1.2), methods, grid, graphics, stats, grDevices Imports circlize (>= 0.4.5), GetoptLong, colorspace, clue, RColorBrewer, GlobalOptions (>= 0.1.0), parallel, png Suggests testthat (>= 1.0.0), knitr, markdown, dendsort, Cairo, jpeg, tiff, fastcluster, dendextend (>= 1.0.1), grImport, grImport2, glue, GenomicRanges VignetteBuilder knitr Description Complex heatmaps are efficient to visualize associations between different sources of data sets and reveal potential patterns. Here the ComplexHeatmap package provides a highly flexible way to arrange multiple heatmaps and supports various annotation graphics. biocViews Software, Visualization, Sequencing URL https://github.com/jokergoo/ComplexHeatmap, https://jokergoo.github.io/ComplexHeatmap-reference/book/ License MIT + file LICENSE git_url https://git.bioconductor.org/packages/ComplexHeatmap git_branch RELEASE_3_9 git_last_commit 97863d8 git_last_commit_date 2019-05-02 Date/Publication 2019-05-16 R topics documented: ComplexHeatmap-package ................................. 6 +.AdditiveUnit ....................................... 7 AdditiveUnit ........................................ 8 AdditiveUnit-class ..................................... 8 1
198
Embed
Package ‘ComplexHeatmap’ - Bioconductor · Package ‘ComplexHeatmap’ May 9, 2019 Type Package Title Make Complex Heatmaps Version 2.0.0 Date 2019-04-28 Author Zuguang Gu Maintainer
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Description Complex heatmaps are efficient to visualize associationsbetween different sources of data sets and reveal potential patterns.Here the ComplexHeatmap package provides a highly flexible way to arrangemultiple heatmaps and supports various annotation graphics.
This package aims to provide a simple and flexible way to arrange multiple heatmaps as well asflexible annotation graphics.
The package is implemented in an object-oriented way. The heatmap lists are abstracted into severalclasses.
• Heatmap-class: a single heatmap containing heatmap body, row/column names, titles, den-drograms and annotations.
• HeatmapList-class: a list of heatmaps and annotations.• HeatmapAnnotation-class: a list of row/column annotations.
There are also several internal classes:
• SingleAnnotation-class: a single row annotation or column annotation.• ColorMapping-class: mapping from values to colors.• AnnotationFunction-class: construct an annotation function which allows subsetting.
Following two high-level functions take use of functionality of complex heatmaps:
• oncoPrint: oncoPrint plot which visualize genomic alterations in a set of genes.• densityHeatmap: use heatmaps to visualize density distributions.
The complete reference of ComplexHeatmap package is available at http://jokergoo.github.io/ComplexHeatmap-reference/book.
+.AdditiveUnit Horizontally Add Heatmaps or Annotations to a Heatmap List
Description
Horizontally Add Heatmaps or Annotations to a Heatmap List
Usage
## S3 method for class 'AdditiveUnit'x + y
Arguments
x A Heatmap-class object, a HeatmapAnnotation-class object or a HeatmapList-classobject.
y A Heatmap-class object, a HeatmapAnnotation-class object or a HeatmapList-classobject.
Details
It is only a helper function. It actually calls add_heatmap,Heatmap-method, add_heatmap,HeatmapList-methodor add_heatmap,HeatmapAnnotation-method depending on the class of the input objects.
The HeatmapAnnotation-class object to be added should only be row annotations. Column an-notations should be added to the heatmap list by %v%.
AdditiveUnit-class Class for Concatenating Heatmaps and Annotations
Description
Class for Concatenating Heatmaps and Annotations
Details
This class is a super class for Heatmap-class, HeatmapList-class and HeatmapAnnotation-classclasses. It is only designed for + generic method and the %v%v method so that above three classescan be appended to each other.
Examples
# There is no exampleNULL
add_heatmap-dispatch 9
add_heatmap-dispatch Method dispatch page for add_heatmap
Description
Method dispatch page for add_heatmap.
Dispatch
add_heatmap can be dispatched on following classes:
• add_heatmap,HeatmapAnnotation-method, HeatmapAnnotation-class class method
• add_heatmap,HeatmapList-method, HeatmapList-class class method
• add_heatmap,Heatmap-method, Heatmap-class class method
Examples
# no exampleNULL
add_heatmap-Heatmap-method
Add Heatmap to the Heatmap List
Description
Add Heatmap to the Heatmap List
Usage
## S4 method for signature 'Heatmap'add_heatmap(object, x, direction = c("horizontal", "vertical"))
Arguments
object A Heatmap-class object.
x a Heatmap-class object, a HeatmapAnnotation-class object or a HeatmapList-classobject.
direction Whether the heatmap is added horizontal or vertically?
Details
Normally we directly use + for horizontal concatenation and %v% for vertical concatenation.
## S4 method for signature 'HeatmapList'adjust_heatmap_list(object)
Arguments
object A HeatmapList-class object.
Details
This function adjusts settings in all other heatmaps according to the main heatmap. It also adjustthe size of heatmap annotations to make them aligned nicely.
fun A function which defines how to draw the annotation. See **Details** section.
fun_name The name of the function. It is only used for printing the object.
which Whether it is drawn as a column annotation or a row annotation?
var_import The names of the variables or the variable themselves that the annotation func-tion depends on. See **Details** section.
n Number of observations in the annotation. It is not mandatory, but it is better toprovide this information so that the higher order HeatmapAnnotation knows itand it can perform check on the consistency of annotations and heatmaps.
data_scale The data scale on the data axis (y-axis for column annotation and x-axis for rowannotation). It is only used when decorate_annotation is used with "native"unit coordinates.
subset_rule The rule of subsetting variables in var_import. It should be set when userswant the final object to be subsetable. See **Details** section.
subsetable Whether the object is subsetable?
show_name It is used to turn off the drawing of annotation names in HeatmapAnnotation.Annotations always have names associated and normally they will be drawnbeside the annotation graphics to tell what the annotation is about. e.g. the an-notation names put beside the points annotation graphics. However, for some ofthe annotations, the names are not necessarily to be drawn, such as text anno-tations drawn by anno_text or an empty annotation drawn by anno_empty. Inthis case, when show_names is set to FALSE, there will be no annotation namesdrawn for the annotation.
width The width of the plotting region (the viewport) that the annotation is drawn. If itis a row annotation, the width must be an absolute unit. Since the AnnotationFunctionobject is always contained by the SingleAnnotation-classobject, you canonly set the width of row annotations or height of column annotations, while e.g.the height of the row annotation is always unit(1,"npc") which means it al-ways fully filled in the parent SingleAnnotation and only in SingleAnnotationor even HeatmapAnnotation can adjust the height of the row annotations.
height The height of the plotting region (the viewport) that the annotation is drawn. Ifit is a column annotation, the width must be an absolute unit.
14 AnnotationFunction-class
Details
In the package, we have implemted quite a lot annotation functions by AnnotationFunction con-structor: anno_empty, anno_image, anno_points, anno_lines, anno_barplot, anno_boxplot,anno_histogram, anno_density, anno_joyplot, anno_horizon, anno_text and anno_mark. Thesebuilt-in annotation functions support as both row annotations and column annotations and they areare all subsettable.
The build-in annotation functions are already enough for most of the analysis, nevertheless, if userswant to know more about how to construct the AnnotationFunction class manually, they can refer tohttps://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.html#implement-new-annotation-functions.
Value
A AnnotationFunction-class object which can be used in HeatmapAnnotation.
The heatmap annotation is basically graphics aligned to the heatmap columns or rows. There isno restriction for the graphic types, e.g. it can be heatmap-like annotation or points. Here theAnnotationFunction class is designed for creating complex and flexible annotation graphics. As themain part of the class, it uses a user-defined function to define the graphics. It also keeps informationof the size of the plotting regions of the annotation. And most importantly, it allows subsetting tothe annotation to draw a subset of the graphics, which is the base for the splitting of the annotations.
x The value vector. The value can be a vector or a matrix. The length of the vectoror the number of rows of the matrix is taken as the number of the observationsof the annotation. If x is a vector, the barplots will be represented as stackedbarplots.
baseline baseline of bars. The value should be "min" or "max", or a numeric value. It isenforced to be zero for stacked barplots.
which Whether it is a column annotation or a row annotation?
border Wether draw borders of the annotation region?
bar_width Relative width of the bars. The value should be smaller than one.
anno_block 19
gp Graphic parameters for points. The length of each graphic parameter can be 1,length of x if x is a vector, or number of columns of x is x is a matrix.
ylim Data ranges. By default it is range(x) if x is a vector, or range(rowSums(x))if x is a matrix.
extend The extension to both side of ylim. The value is a percent value correspondingto ylim[2] -ylim[1].
axis Whether to add axis?
axis_param parameters for controlling axis. See default_axis_param for all possible set-tings and default parameters.
width Width of the annotation. The value should be an absolute unit. Width is notallowed to be set for column annotation.
height Height of the annotation. The value should be an absolute unit. Height is notallowed to be set for row annotation.
... Other arguments.
Value
An annotation function which can be used in HeatmapAnnotation.
x A matrix or a list. If x is a matrix and if which is column, statistics for boxplotsare calculated by columns, if which is row, the calculation is done by rows.
which Whether it is a column annotation or a row annotation?
border Wether draw borders of the annotation region?
gp Graphic parameters for the boxes. The length of the graphic parameters shouldbe one or the number of observations.
ylim Data ranges.
extend The extension to both side of ylim. The value is a percent value correspondingto ylim[2] -ylim[1].
outline Whether draw outline of boxplots?
box_width Relative width of boxes. The value should be smaller than one.
pch Point style.
size Point size.
axis Whether to add axis?
axis_param parameters for controlling axis. See default_axis_param for all possible set-tings and default parameters.
width Width of the annotation. The value should be an absolute unit. Width is notallowed to be set for column annotation.
height Height of the annotation. The value should be an absolute unit. Height is notallowed to be set for row annotation.
... Other arguments.
Value
An annotation function which can be used in HeatmapAnnotation.
x A matrix or a list. If x is a matrix and if which is column, statistics for boxplotsare calculated by columns, if which is row, the calculation is done by rows.
which Whether it is a column annotation or a row annotation?
type Type of graphics to represent density distribution. "lines" for normal densityplot; "violine" for violin plot and "heatmap" for heatmap visualization of densitydistribution.
heatmap_colors A vector of colors for interpolating density values.
joyplot_scale Relative height of density distribution. A value higher than 1 increases the heightof the density distribution and the plot will represented as so-called "joyplot".
border Wether draw borders of the annotation region?
gp Graphic parameters for the boxes. The length of the graphic parameters shouldbe one or the number of observations.
axis Whether to add axis?
axis_param parameters for controlling axis. See default_axis_param for all possible set-tings and default parameters.
width Width of the annotation. The value should be an absolute unit. Width is notallowed to be set for column annotation.
height Height of the annotation. The value should be an absolute unit. Height is notallowed to be set for row annotation.
Value
An annotation function which can be used in HeatmapAnnotation.
m = matrix(rnorm(100), 10)anno = anno_density(m, which = "row")draw(anno, test = "normal density")anno = anno_density(m, which = "row", type = "violin")draw(anno, test = "violin")anno = anno_density(m, which = "row", type = "heatmap")draw(anno, test = "heatmap")anno = anno_density(m, which = "row", type = "heatmap",
heatmap_colors = c("white", "orange"))draw(anno, test = "heatmap, colors")
which Whether it is a column annotation or a row annotation?
border Whether draw borders of the annotation region?
zoom If it is true and when the heatmap is split, the empty annotation slices will haveequal height or width, and you can see the correspondance between the annota-tion slices and the original heatmap slices.
width Width of the annotation. The value should be an absolute unit. Width is notallowed to be set for column annotation.
height Height of the annotation. The value should be an absolute unit. Height is notallowed to be set for row annotation.
Details
It creates an empty annotation and holds space, later users can add graphics by decorate_annotation.This function is useful when users have difficulty to implement AnnotationFunction object.
In following example, an empty annotation is first created and later points are added:
x A matrix or a list. If x is a matrix and if which is column, statistics for boxplotsare calculated by columns, if which is row, the calculation is done by rows.
which Whether it is a column annotation or a row annotation?
n_breaks Number of breaks for calculating histogram.
border Wether draw borders of the annotation region?
gp Graphic parameters for the boxes. The length of the graphic parameters shouldbe one or the number of observations.
axis Whether to add axis?
axis_param parameters for controlling axis. See default_axis_param for all possible set-tings and default parameters.
m = matrix(rnorm(1000), nc = 10)anno = anno_histogram(t(m), which = "row")draw(anno, test = "row histogram")anno = anno_histogram(t(m), which = "row", gp = gpar(fill = 1:10))draw(anno, test = "row histogram with color")anno = anno_histogram(t(m), which = "row", n_breaks = 20)draw(anno, test = "row histogram with color")
x A matrix or a list. If x is a matrix or a data frame, columns correspond toobservations.
which Whether it is a column annotation or a row annotation?
gp Graphic parameters for the boxes. The length of the graphic parameters shouldbe one or the number of observations. There are two unstandard parametersspecificly for horizon chart: pos_fill and neg_fill controls the filled colorfor positive values and negative values.
n_slice Number of slices on y-axis.
slice_size Height of the slice. If the value is not NULL, n_slice will be recalculated.
anno_image(image, which = c("column", "row"), border = TRUE,gp = gpar(fill = NA, col = NA), space = unit(1, "mm"),width = NULL, height = NULL)
Arguments
image A vector of file paths of images. The format of the image is inferred from thesuffix name of the image file. NA values or empty strings in the vector meansno image to drawn.
which Whether it is a column annotation or a row annotation?border Wether draw borders of the annotation region?gp Graphic parameters for annotation grids. If the image has transparent back-
ground, the fill parameter can be used to control the background color in theannotation grids.
space The space around the image to the annotation grid borders. The value should bea unit object.
width Width of the annotation. The value should be an absolute unit. Width is notallowed to be set for column annotation.
height Height of the annotation. The value should be an absolute unit. Height is notallowed to be set for row annotation.
Details
This function supports image formats in png, svg, pdf, eps, jpeg/jpg, tiff. png, jpeg/jpg andtiff images are imported by readPNG, readJPEG and readTIFF, and drawn by grid.raster. svgimages are firstly reformatted by rsvg::rsvg_svg and then imported by readPicture and drawnby grid.picture. pdf and eps images are imported by PostScriptTrace and readPicture, laterdrawn by grid.picture.
Different image formats can be mixed in the image vector.
Value
An annotation function which can be used in HeatmapAnnotation.
# download the free icons from https://github.com/Keyamoon/IcoMoon-Free## Not run:image = sample(dir("~/Downloads/IcoMoon-Free-master/PNG/64px", full.names = TRUE), 10)anno = anno_image(image)draw(anno, test = "png")image[1:5] = ""anno = anno_image(image)draw(anno, test = "some of png")
x The value vector. The value can be a vector or a matrix. The length of the vectoror the number of rows of the matrix is taken as the number of the observationsof the annotation.
which Whether it is a column annotation or a row annotation?
border Wether draw borders of the annotation region?
gp Graphic parameters for lines. The length of each graphic parameter can be 1, ornumber of columns of x is x is a matrix.
add_points Whether to add points on the lines?
smooth If it is TRUE, smoothing by loess is performed. If it is TRUE, add_points is setto TRUE by default.
pch Point type. The length setting is the same as gp.
size Point size, the value should be a unit object. The length setting is the same asgp.
pt_gp Graphic parameters for points. The length setting is the same as gp.
ylim Data ranges. By default it is range(x).
extend The extension to both side of ylim. The value is a percent value correspondingto ylim[2] -ylim[1].
axis Whether to add axis?
axis_param parameters for controlling axis. See default_axis_param for all possible set-tings and default parameters.
width Width of the annotation. The value should be an absolute unit. Width is notallowed to be set for column annotation.
height Height of the annotation. The value should be an absolute unit. Height is notallowed to be set for row annotation.
30 anno_link
Value
An annotation function which can be used in HeatmapAnnotation.
which Whether it is a column annotation or a row annotation?
side Side of the labels. If it is a column annotation, valid values are "top" and "bot-tom"; If it is a row annotation, valid values are "left" and "right".
lines_gp Please use link_gp instead.
link_gp Graphic settings for the segments.
labels_gp Graphic settings for the labels.
padding Padding between neighbouring labels in the plot.
link_width Width of the segments.
link_height Similar as link_width, used for column annotation.
extend By default, the region for the labels has the same width (if it is a column anno-tation) or same height (if it is a row annotation) as the heatmap. The size canbe extended by this options. The value can be a proportion number or a unitobject. The length can be either one or two.
Details
Sometimes there are many rows or columns in the heatmap and we want to mark some of the rows.This annotation function is used to mark these rows and connect labels and corresponding rowswith links.
Value
An annotation function which can be used in HeatmapAnnotation.
x The value vector. The value can be a vector or a matrix. The length of the vectoror the number of rows of the matrix is taken as the number of the observationsof the annotation.
which Whether it is a column annotation or a row annotation?
border Wether draw borders of the annotation region?
gp Graphic parameters for points. The length of each graphic parameter can be 1,length of x if x is a vector, or number of columns of x is x is a matrix.
pch Point type. The length setting is the same as gp.
size Point size, the value should be a unit object. The length setting is the same asgp.
ylim Data ranges. By default it is range(x).
extend The extension to both side of ylim. The value is a percent value correspondingto ylim[2] -ylim[1].
axis Whether to add axis?
axis_param parameters for controlling axis. See default_axis_param for all possible set-tings and default parameters.
width Width of the annotation. The value should be an absolute unit. Width is notallowed to be set for column annotation.
height Height of the annotation. The value should be an absolute unit. Height is notallowed to be set for row annotation.
... Other arguments.
Value
An annotation function which can be used in HeatmapAnnotation.
x The value vector. The value can be a vector or a matrix. The length of thevector or the nrow of the matrix is taken as the number of the observations ofthe annotation. The value can be numeric or character and NA value is allowed.
col Color that maps to x. If x is numeric and needs a continuous mapping, colshould be a color mapping function which accepts a vector of values and returnsa vector of colors. Normally it is generated by colorRamp2. If x is discrete(numeric or character) and needs a discrete color mapping, col should be avector of colors with levels in x as vector names. If col is not specified, thecolor mapping is randomly generated by ComplexHeatmap:::default_col.
na_col Color for NA value.which Whether it is a column annotation or a row annotation?border Wether draw borders of the annotation region?gp Graphic parameters for grid borders. The fill parameter is disabled.pch Points/symbols that are added on top of the annotation grids. The value can be
numeric or single letters. It can be a vector if x is a vector and a matrix if x is amatrix. No points are drawn if the corresponding values are NA.
pt_size Size of the points/symbols. It should be a unit object. If x is a vector, the valueof pt_size can be a vector, while if x is a matrix, pt_size can only be a singlevalue.
pt_gp Graphic parameters for points/symbols. The length setting is same as pt_size.If pch is set as letters, the fontsize should be set as pt_gp = gpar(fontsize =...).
simple_anno_size
size of the simple annotation.width Width of the annotation. The value should be an absolute unit. Width is not
allowed to be set for column annotation.height Height of the annotation. The value should be an absolute unit. Height is not
allowed to be set for row annotation.
anno_summary 35
Details
The "simple annotation" is the most widely used annotation type which is heatmap-like, where thegrid colors correspond to the values. anno_simple also supports to add points/symbols on top ofthe grids where the it can be normal point (when pch is set as numbers) or letters (when pch is setas single letters).
Value
An annotation function which can be used in HeatmapAnnotation.
anno = anno_simple(1:10)draw(anno, test = "a numeric vector")
anno = anno_simple(cbind(1:10, 10:1))draw(anno, test = "a matrix")
anno = anno_simple(1:10, pch = c(1:4, NA, 6:8, NA, 10))draw(anno, test = "pch has NA values")
anno = anno_simple(1:10, pch = c(rep("A", 5), rep(NA, 5)))draw(anno, test = "pch has NA values")
pch = matrix(1:20, nc = 2)pch[sample(length(pch), 10)] = NAanno = anno_simple(cbind(1:10, 10:1), pch = pch)draw(anno, test = "matrix, pch is a matrix with NA values")
which Whether it is a column annotation or a row annotation?
border Wether draw borders of the annotation region?
bar_width Relative width of the bars. The value should be smaller than one.
axis Whether to add axis?
axis_param parameters for controlling axis. See default_axis_param for all possible set-tings and default parameters.
ylim Data ranges. ylim for barplot is enforced to be c(0,1).
extend The extension to both side of ylim. The value is a percent value correspondingto ylim[2] -ylim[1]. This argument is only for boxplot.
outline Whether draw outline of boxplots?
box_width Relative width of boxes. The value should be smaller than one.
pch Point style.
size Point size.
gp Graphic parameters.
width Width of the annotation. The value should be an absolute unit. Width is notallowed to be set for column annotation.
height Height of the annotation. The value should be an absolute unit. Height is notallowed to be set for row annotation.
Details
anno_summary is a special annotation function that it only works for one-column or one-row heatmap.It shows the summary of the values in the heatmap. If the values in the heatmap is discrete, the pro-portion of each level (the sum is normalized to 1) is visualized as stacked barplot. If the heatmap issplit into multiple slices, multiple bars are put in the annotation. If the value is continuous, boxplotis used.
In the barplot, the color schema is used as the same as the heatmap, while for the boxplot, the colorneeds to be controlled by gp.
Value
An annotation function which can be used in HeatmapAnnotation.
anno_text(x, which = c("column", "row"), gp = gpar(),rot = guess_rot(), just = guess_just(),offset = guess_location(), location = guess_location(),width = NULL, height = NULL)
Arguments
x A vector of text.
which Whether it is a column annotation or a row annotation?
gp Graphic parameters.
rot Rotation of the text, pass to grid.text.
just Justification of text, pass to grid.text.
offset Depracated, use location instead.
location Position of the text. By default rot, just and location are automatically in-ferred according to whether it is a row annotation or column annotation. Thevalue of location should be a unit object, normally in npc unit. E.g. unit(0,'npc')means the most left of the annotation region and unit(1,'npc') means themost right of the annotation region.
width Width of the annotation. The value should be an absolute unit. Width is notallowed to be set for column annotation.
height Height of the annotation. The value should be an absolute unit. Height is notallowed to be set for row annotation.
Value
An annotation function which can be used in HeatmapAnnotation.
anno = anno_text(month.name)draw(anno, test = "month names")anno = anno_text(month.name, gp = gpar(fontsize = 16))draw(anno, test = "month names with fontsize")anno = anno_text(month.name, gp = gpar(fontsize = 1:12+4))draw(anno, test = "month names with changing fontsize")anno = anno_text(month.name, which = "row")
align_to It defines how the boxes correspond to the rows or the columns in the heatmap.If the value is a list of indices, each box corresponds to the rows or columnswith indices in one vector in the list. If the value is a categorical variable (e.g.a factor or a character vector) that has the same length as the rows or columnsin the heatmap, each box corresponds to the rows/columns in each level in thecategorical variable.
panel_fun A self-defined function that defines how to draw graphics in the box. The func-tion must have a index argument which is the indices for the rows/columns thatthe box corresponds to. It can have second argument nm which is the "name" ofthe selected part in the heatmap. The corresponding value for nm comes fromalign_to if it is specified as a categorical variable or a list with names.
which Whether it is a column annotation or a row annotation?
side Side of the boxes If it is a column annotation, valid values are "top" and "bot-tom"; If it is a row annotation, valid values are "left" and "right".
size The size of boxes. It can be pure numeric that they are treated as relative frac-tions of the total height/width of the heatmap. The value of size can also beabsolute units.
gap Gaps between boxes.
link_gp Graphic settings for the segments.
link_width Width of the segments.
link_height Similar as link_width, used for column annotation.
extend By default, the region for the labels has the same width (if it is a column anno-tation) or same height (if it is a row annotation) as the heatmap. The size canbe extended by this options. The value can be a proportion number or a unitobject. The length can be either one or two.
c.HeatmapAnnotation 39
width Width of the annotation. The value should be an absolute unit. Width is notallowed to be set for column annotation.
height Height of the annotation. The value should be an absolute unit. Height is notallowed to be set for row annotation.
Details
anno_zoom creates several plotting regions (boxes) which can be corresponded to subsets of rows/columnsin the heatmap.
Value
An annotation function which can be used in HeatmapAnnotation.
cluster_within_group Cluster within and between Groups
Description
Cluster within and between Groups
Usage
cluster_within_group(mat, factor)
Arguments
mat A matrix where clustering is applied on columns.
factor A categorical vector.
Details
The clustering is firstly applied in each group, then clustering is applied to group means. The within-group dendrograms and between-group dendrogram are finally connected by merge_dendrogram.
In the final dendrogram, the within group dendrograms are enforced to be flat lines to emphasizethat the within group dendrograms have no sense to compare to between-group dendrogram.
Value
A dendrogram object. The order of columns can be retrieved by order.dendrogram.
Examples
m = matrix(rnorm(120), nc = 12)colnames(m) = letters[1:12]fa = rep(c("a", "b", "c"), times = c(2, 4, 6))dend = cluster_within_group(m, fa)grid.dendrogram(dend, test = TRUE)
ColorMapping 41
ColorMapping Constructor Method for ColorMapping Class
name Name for this color mapping. The name is automatically generated if it is notspecified.
colors Discrete colors.
levels Levels that correspond to colors. If colors is name indexed, levels can beignored.
col_fun Color mapping function that maps continuous values to colors.
breaks Breaks for the continuous color mapping. If col_fun is generated by colorRamp2,breaks is automatically inferred from the color mapping function.
na_col Colors for NA values.
Details
colors and levels are used for discrete color mapping, col_fun and breaks are used for contin-uous color mapping.
The ColorMapping-class handles color mapping for discrete values and continuous values. Dis-crete values are mapped by setting a vector of colors and continuous values are mapped by settinga color mapping function.
Methods
The ColorMapping-class provides following methods:
• ColorMapping: contructor methods.
• map_to_colors,ColorMapping-method: mapping values to colors.
• color_mapping_legend,ColorMapping-method: draw legend or get legend as an object.
The degree for a combination set is the number of sets that are selected.
Value
A vector of degrees of the combination sets.
Examples
set.seed(123)lt = list(a = sample(letters, 10),
b = sample(letters, 15),c = sample(letters, 20))
m = make_comb_mat(lt)comb_degree(m)
comb_name Names of the Combination sets
Description
Names of the Combination sets
Usage
comb_name(m)
Arguments
m A combination matrix returned by make_comb_mat.
Details
The name of the combination sets are formatted as a string of binary bits. E.g. for three sets of "a","b", "c", the combination set with name "101" corresponds to select set a, not select set b and selectset c. The definition of "select" depends on the value of mode from make_comb_mat.
50 comb_size
Value
A vector of names of the combination sets.
Examples
set.seed(123)lt = list(a = sample(letters, 10),
b = sample(letters, 15),c = sample(letters, 20))
m = make_comb_mat(lt)comb_name(m)
comb_size Sizes of the Combination sets
Description
Sizes of the Combination sets
Usage
comb_size(m, degree = NULL)
Arguments
m A combination matrix returned by make_comb_mat.
degree degree of the intersection. The value can be a vector.
Value
A vector of sizes of the combination sets.
Examples
set.seed(123)lt = list(a = sample(letters, 10),
b = sample(letters, 15),c = sample(letters, 20))
m = make_comb_mat(lt)comb_size(m)
component_height-dispatch 51
component_height-dispatch
Method dispatch page for component_height
Description
Method dispatch page for component_height.
Dispatch
component_height can be dispatched on following classes:
• component_height,HeatmapList-method, HeatmapList-class class method
• component_height,Heatmap-method, Heatmap-class class method
Examples
# no exampleNULL
component_height-Heatmap-method
Heights of Heatmap Components
Description
Heights of Heatmap Components
Usage
## S4 method for signature 'Heatmap'component_height(object, k = HEATMAP_LAYOUT_COLUMN_COMPONENT)
Arguments
object A Heatmap-class object.
k Which components in the heatmap. The value should numeric indices or thenames of the corresponding column component. See **Detials**.
## S4 method for signature 'AnnotationFunction'copy_all(object)
Arguments
object The AnnotationFunction-class object.
Details
In AnnotationFunction-class, there is an environment which stores some external variables forthe annotation function (specified by the var_import argument when constructing the AnnotationFunction-classobject. This copy_all,AnnotationFunction-method hard copies all the variables into a new iso-lated environment.
The environment is at object@var_env.
Examples
# There is no exampleNULL
copy_all-dispatch Method dispatch page for copy_all
Description
Method dispatch page for copy_all.
Dispatch
copy_all can be dispatched on following classes:
• copy_all,AnnotationFunction-method, AnnotationFunction-class class method• copy_all,SingleAnnotation-method, SingleAnnotation-class class method
Examples
# no exampleNULL
56 decorate_annotation
copy_all-SingleAnnotation-method
Copy the SingleAnnotation object
Description
Copy the SingleAnnotation object
Usage
## S4 method for signature 'SingleAnnotation'copy_all(object)
Arguments
object The SingleAnnotation-class object.
Details
Since the SingleAnnotation object always contains an AnnotationFunction-class object, it callscopy_all,AnnotationFunction-method to hard copy the variable environment.
annotation Name of the annotation.code Code that adds graphics in the selected heatmap annotation.slice Index of the row slices or the column slice in the heatmap.envir Where to look for variables inside code.
Details
There is a viewport for every column annotation and row annotation. This function contructs thename of the viewport, goes to the viewport by seekViewport, runs code to that viewport, and finallygoes back to the original viewport.
code Code that adds graphics in the selected heatmap dendrogram.
slice Index of the row slice or column slice in the heatmap.
which Is the dendrogram on rows or on columns?
envir Where to look for variables inside code.
Details
If you know the number of leaves in the dendrogram, it is simple to calculate the position of everyleave in the dendrogram. E.g., for the column dendrogram, the i^th leave is located at:
# assume nc is the number of columns in the column sliceunit((i-0.5)/nc, "npc")
code Code that adds graphics in the selected viewport.
slice Index of the row slice or column slice in the heatmap.
which on rows or on columns?
envir where to look for variables inside code.
Details
If you know the dimensions of the matrix, it is simple to calculate the position of every row nameor column name in the heatmap. E.g., for the column column, the i^th name is located at:
# assume nc is the number of columns in the column sliceunit((i-0.5)/nc, "npc")
heatmap Name of the heatmap which is set as name argument in Heatmap function.
code Code that adds graphics in the selected heatmap body.
slice Index of the row slice in the heatmap.
row_slice Index of the row slice in the heatmap.
column_slice Index of the column slice in the heatmap.
envir Where to look for variables inside code.
Details
There is a viewport for each slice in each heatmap. This function contructs the name of the viewport,goes to the viewport by seekViewport, runs the code to that viewport and finally goes back to theoriginal viewport.
code Code that adds graphics in the selected viewport.
slice Index of the row slice or column slice in the heatmap.
which Is it a row title or a column title?
envir Where to look for variables inside code.
Details
There is a viewport for row titles and column title in the heatmap. This function contructs the nameof the viewport, goes to the viewport by seekViewport , runs code to that viewport and finally goesback to the original viewport.
There are following parameters for the annotation axis:
at The breaks of axis. By default it is automatically inferred.
labels The corresponding axis labels.
labels_rot The rotation of the axis labels.
gp Graphc parameters of axis labels. The value should be a unit object.
side If it is for column annotation, the value should only be one of left and right. If it is for rowannotation, the value should only be one of top and bottom.
facing Whether the axis faces to the outside of the annotation region or inside. Sometimes whenappending more than one heatmaps, the axes of column annotations of one heatmap mightoverlap to the neighbouring heatmap, setting facing to inside may invoild it.
direction The direction of the axis. Value should be "normal" or "reverse".
All the parameters are passed to annotation_axis_grob to construct an axis grob.
order If it is set to reverse, the first leaf is put on the right if the dendrogram ishorizontal and it is put on the top if the dendrogram is vertical.
gp Graphic parameters for the dendrogram segments. If any of col, lwd or ltyis set in the edgePar attribute of a node, the corresponding value defined in gpwill be overwritten for this node, so gp is like global graphic parameters fordendrogram segments.
Details
If dend has not been processed by adjust_dend_by_x, internally adjust_dend_by_x is called toadd x attributes to each node/leaf.
Value
A grob object which is contructed by segmentsGrob.
Examples
# There is no exampleNULL
dend_heights Height of the Dendrograms
Description
Height of the Dendrograms
Usage
dend_heights(x)
68 dend_xy
Arguments
x a dendrogram object or a list of dendrogram objects.
Examples
# There is no exampleNULL
dend_xy Coordinates of the Dendrogram
Description
Coordinates of the Dendrogram
Usage
dend_xy(dend)
Arguments
dend a dendrogram object.
Details
dend will be processed by adjust_dend_by_x if it is processed yet.
Value
A list of leave positions (x) and dendrogram height (y).
Examples
m = matrix(rnorm(100), 10)dend1 = as.dendrogram(hclust(dist(m)))dend_xy(dend1)
There is a specific distance method ks which is the Kolmogorov-Smirnov statis-tic between two distributions. For other methods, the distance is calculated onthe density matrix.
clustering_method_columns
Pass to Heatmap.
mc.cores Multiple cores for calculating ks distance.
... Pass to Heatmap.
Details
To visualize data distribution in a matrix or in a list, we normally use boxplot or violinplot. We canalso use colors to map the density values and visualize distribution of values through a heatmap. Itis useful if you have huge number of columns in data to visualize.
The density matrix is generated with 500 rows ranging between the maximun and minimal valuesin all densities.
Value
A Heatmap-class object. It can oly add other heatmaps/annotations vertically.
x A matrix or a list. If it is a matrix, the distance is calculated by rows.
pairwise_fun A function which calculates distance between two vectors.
... Pass to as.dist.
72 draw-AnnotationFunction-method
Details
You can construct any type of distance measurements by defining a pair-wise distance function. Thefunction is implemented by two nested for loops, so the efficiency may not be so good.
## S4 method for signature 'AnnotationFunction'draw(object, index, k = 1, n = 1, test = FALSE, ...)
Arguments
object The AnnotationFunction-class object.
index Index of observations.
k Current slice index.
n Total number of slices.
test Is it in test mode? The value can be logical or a text which is plotted as the titleof plot.
... Pass to viewport.
Details
Normally it is called internally by the SingleAnnotation-class.
When test is set to TRUE, the annotation graphic is directly drawn, which is generally for testingpurpose.
draw-dispatch 73
Examples
# There is no exampleNULL
draw-dispatch Method dispatch page for draw
Description
Method dispatch page for draw.
Dispatch
draw can be dispatched on following classes:
• draw,AnnotationFunction-method, AnnotationFunction-class class method• draw,Legends-method, Legends-class class method• draw,HeatmapAnnotation-method, HeatmapAnnotation-class class method• draw,SingleAnnotation-method, SingleAnnotation-class class method• draw,HeatmapList-method, HeatmapList-class class method• draw,Heatmap-method, Heatmap-class class method
Examples
# no exampleNULL
draw-Heatmap-method Draw a Single Heatmap
Description
Draw a Single Heatmap
Usage
## S4 method for signature 'Heatmap'draw(object, internal = FALSE, test = FALSE, ...)
Arguments
object A Heatmap-class object.internal If TRUE, it is only used inside the calling of draw,HeatmapList-method. It
only draws the heatmap without legends where the legend will be drawn bydraw,HeatmapList-method.
test Only for testing. If it is TRUE, the heatmap body is directly drawn.... Pass to draw,HeatmapList-method.
74 draw-HeatmapAnnotation-method
Details
The function creates a HeatmapList-class object which only contains a single heatmap and calldraw,HeatmapList-method to make the final heatmap.
There are some arguments which control the some settings of the heatmap such as legends. Pleasego to draw,HeatmapList-method for these arguments.
newpage whether create a new page for the graphics. If you want to arrange multiple plotsin one page, I suggest to use grid.grabExpr.
row_title title on the row.
row_title_side will the title be put on the left or right of the heatmap.
row_title_gp graphic parameters for drawing text.
column_title title on the column.column_title_side
will the title be put on the top or bottom of the heatmap.column_title_gp
graphic parameters for drawing text.heatmap_legend_side
side to put heatmap legend
merge_legends merge heatmap legends and annotation legends to put into one column.show_heatmap_legend
whether show all heatmap legendsheatmap_legend_list
use-defined legends which are put after the heatmap legendsannotation_legend_side
side of the annotation legendsshow_annotation_legend
whether show annotation legendsannotation_legend_list
user-defined legends which are put after the annotation legends
gap gap between heatmaps/annotations
ht_gap same as gap.
main_heatmap index of main heatmap. The value can be a numeric index or the heatmap name
padding padding of the whole plot. The value is a unit vector of length 4, which corre-sponds to bottom, left, top and right.
adjust_annotation_extension
whether take annotation name into account when calculating positions of graphicelements.
auto_adjust whether apply automatic adjustment? The auto-adjustment includes turning offdendrograms, titles and row/columns for non-main heatmaps.
row_dend_side side of the dendrogram from the main heatmaprow_sub_title_side
side of the row title from the main heatmapcolumn_dend_side
side of the dendrogram from the main heatmapcolumn_sub_title_side
side of the column title from the main heatmap
row_gap this modifies row_gap of the main heatmap
cluster_rows this modifies cluster_rows of the main heatmapclustering_distance_rows
this modifies clustering_distance_rows of the main heatmapclustering_method_rows
this modifies clustering_method_rows of the main heatmap
78 draw-HeatmapList-method
row_dend_width this modifies row_dend_width of the main heatmap
show_row_dend this modifies show_row_dend of the main heatmaprow_dend_reorder
this modifies row_dend_reorder of the main heatmap
row_dend_gp this modifies row_dend_gp of the main heatmap
row_order this modifies row_order of the main heatmap
km = this modifies km of the main heatmap
split this modifies split of the main heatmap
row_km this modifies row_km of the main heatmap
row_km_repeats this modifies row_km_repeats of the main heatmap
row_split this modifies row_split of the main heatmap
height this modifies height of the main heatmap
heatmap_height this modifies heatmap_height of the main heatmap
column_gap this modifies column_gap of the main heatmapcluster_columns
this modifies cluster_columns of the main heatmapclustering_distance_columns
this modifies clustering_distance_columns of the main heatmapclustering_method_columns
this modifies clustering_method_columns of the main heatmapcolumn_dend_width
this modifies column_dend_width of the main heatmapshow_column_dend
this modifies show_column_dend of the main heatmapcolumn_dend_reorder
this modifies column_dend_reorder of the main heatmap
column_dend_gp this modifies column_dend_gp of the main heatmap
column_order this modifies column_order of the main heatmap
column_km this modifies column_km of the main heatmapcolumn_km_repeats
this modifies column_km_repeats of the main heatmap
column_split this modifies column_split of the main heatmap
width this modifies width of the main heatmap
heatmap_width this modifies heatmap_width of the main heatmapheatmap_row_names_gp
this set the value in ht_opt and reset back after the plot is doneheatmap_column_names_gp
this set the value in ht_opt and reset back after the plot is doneheatmap_row_title_gp
this set the value in ht_opt and reset back after the plot is doneheatmap_column_title_gp
this set the value in ht_opt and reset back after the plot is donelegend_title_gp
this set the value in ht_opt and reset back after the plot is done
draw-HeatmapList-method 79
legend_title_position
this set the value in ht_opt and reset back after the plot is done
legend_labels_gp
this set the value in ht_opt and reset back after the plot is done
legend_grid_height
this set the value in ht_opt and reset back after the plot is done
legend_grid_width
this set the value in ht_opt and reset back after the plot is done
legend_border this set the value in ht_opt and reset back after the plot is done
heatmap_border this set the value in ht_opt and reset back after the plot is done
annotation_border
this set the value in ht_opt and reset back after the plot is done
fastcluster this set the value in ht_opt and reset back after the plot is done
simple_anno_size
this set the value in ht_opt and reset back after the plot is done
show_parent_dend_line
this set the value in ht_opt and reset back after the plot is done
Details
The function first calls make_layout,HeatmapList-method to calculate the layout of the heatmaplist and the layout of every single heatmap, then makes the plot by re-calling the graphic functionswhich are already recorded in the layout.
Value
This function returns a HeatmapList-class object for which the layout has been created.
## S4 method for signature 'Legends'draw(object, x = unit(0.5, "npc"), y = unit(0.5, "npc"), just = "centre", test = FALSE)
Arguments
object The grob object returned by Legend or packLegend.
x The x position of the legends, measured in current viewport.
y The y position of the legends, measured in current viewport.
just Justification of the legends.
test Only used for testing.
Details
In the legend grob, there should always be a viewport attached which is like a wrapper of all thegraphic elements in a legend. If in the object, there is already a viewport attached, it will modifythe x, y and valid.just of the viewport. If there is not viewport attached, a viewport with specifiedx, y and valid.just is created and attached.
You can also directly use grid.draw to draw the legend object, but you can only control the positionof the legends by first creating a parent viewport and adjusting the position of the parent viewport.
Examples
lgd = Legend(at = 1:4, title = "foo")draw(lgd, x = unit(0, "npc"), y = unit(0, "npc"), just = c("left", "bottom"))
# and a similar version of grid.drawpushViewport(viewport(x = unit(0, "npc"), y = unit(0, "npc"), just = c("left", "bottom")))grid.draw(lgd)popViewport()
draw-SingleAnnotation-method
Draw the Single Annotation
Description
Draw the Single Annotation
draw_annotation-Heatmap-method 81
Usage
## S4 method for signature 'SingleAnnotation'draw(object, index, k = 1, n = 1, test = FALSE,
anno_mark_param = list())
Arguments
object A SingleAnnotation-class object.
index A vector of indices.
k The index of the slice.
n Total number of slices. k and n are used to adjust annotation names. E.g. if k is2 and n is 3, the annotation names are not drawn.
test Is it in test mode? The value can be logical or a text which is plotted as the titleof plot.
anno_mark_param
It contains specific parameters for drawing anno_mark.
## S4 method for signature 'HeatmapList'draw_annotation_legend(object, legend_list = list(), ...)
Arguments
object A HeatmapList-class object.
legend_list A list of self-defined legends, should be wrapped into grob objects. It is nor-mally constructed by Legend.
... Other arguments.
Details
We call the "annotation legends" as the secondary legends. For horizontal heamtap list, the legendsare those from all top/bottom annotations, and for vertical heatmap list, the legends are those fromall left/right annotations.
A viewport is created which contains annotation legends.
## S4 method for signature 'Heatmap'draw_dend(object,
which = c("row", "column"), k = 1, max_height = NULL, ...)
Arguments
object A Heatmap-class object.which Are the dendrograms put on the row or on the column of the heatmap?k Slice index.max_height maximal height of dendrogram.... Pass to viewport which includes the complete heatmap dendrograms.
## S4 method for signature 'HeatmapList'draw_heatmap_legend(object, legend_list = list(), ...)
Arguments
object A HeatmapList-class object.
legend_list A list of self-defined legends, should be wrapped into grob objects. It is nor-mally constructed by Legend.
... Other arguments.
Details
Actually we call the "heatmap legends" as the main legends. For horizontal heatmap list, the legendsare those from heamtap/row annotation/left/right annotation. For vertical heatmap list, the legendsare those from heamtap/column annotation/top/bottom annotation. if merge_legends is true indraw,HeatmapList-method, then it contains all legends shown on the plot.
A viewport is created which contains heatmap legends.
extract_comb Extract Elements in a Combination set
Description
Extract Elements in a Combination set
Usage
extract_comb(m, comb_name)
90 getXY_in_parent_vp
Arguments
m A combination matrix returned by make_comb_mat.comb_name The valid combination set name should be from comb_name.
Details
It returns the combination set.
Examples
set.seed(123)lt = list(a = sample(letters, 10),
b = sample(letters, 15),c = sample(letters, 20))
m = make_comb_mat(lt)extract_comb(m, "110")
getXY_in_parent_vp Convert XY in a Parent Viewport
Description
Convert XY in a Parent Viewport
Usage
getXY_in_parent_vp(u, vp_name = "ROOT")
Arguments
u A list of two units which correspond to x and y.vp_name The name of the parent viewport.
Details
It converts a coordinate measured in current viewport to the coordinate in a parent viewport.In the conversion, all units are recalculated as absolute units, so if you change the size of theinteractive graphic window, you need to rerun the function.
test Is it in test mode? If it is in test mode, a viewport is created by calculating properxlim and ylim.
Details
grid.dendrogram supports drawing dendrograms with self-defind leaf positions. The positionsof leaves can be defined by adjust_dend_by_x. Also the dendrogram can be customized by set-ting the edgePar attribute for each node (basically for controlling the style of segments), e.g. bycolor_branches.
To draw the dendrogram, a viewport should be firstly created. dend_xy can be used to get thepositions of leaves and height of the dendrogram.
matrix A matrix. Either numeric or character. If it is a simple vector, it will be convertedto a one-column matrix.
col A vector of colors if the color mapping is discrete or a color mapping function ifthe matrix is continuous numbers (should be generated by colorRamp2). If thematrix is continuous, the value can also be a vector of colors so that colors canbe interpolated. Pass to ColorMapping. For more details and examples, pleaserefer to https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#colors .
name Name of the heatmap. By default the heatmap name is used as the title of theheatmap legend.
na_col Color for NA values.
rect_gp Graphic parameters for drawing rectangles (for heatmap body). The value shouldbe specified by gpar and fill parameter is ignored.
color_space The color space in which colors are interpolated. Only used if matrix is numericand col is a vector of colors. Pass to colorRamp2.
border Whether draw border. The value can be logical or a string of color.
cell_fun Self-defined function to add graphics on each cell. Seven parameters will bepassed into this function: j, i, x, y, width, height, fill which are columnindex, row index in matrix, coordinate of the cell, the width and height of thecell and the filled color. x, y, width and height are all unit objects.
layer_fun Similar as cell_fun, but is vectorized. Check https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#customize-the-heatmap-body.
row_title_side Will the title be put on the left or right of the heatmap?
row_title_gp Graphic parameters for row title.
row_title_rot Rotation of row title. Only 0, 90, 270 are allowed to set.
column_title Title on the column.column_title_side
Will the title be put on the top or bottom of the heatmap?column_title_gp
Graphic parameters for column title.column_title_rot
Rotation of column titles. Only 0, 90, 270 are allowed to set.
cluster_rows If the value is a logical, it controls whether to make cluster on rows. The valuecan also be a hclust or a dendrogram which already contains clustering. Checkhttps://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#clustering .
cluster_row_slices
If rows are split into slices, whether perform clustering on the slice means?clustering_distance_rows
It can be a pre-defined character which is in ("euclidean", "maximum", "man-hattan", "canberra", "binary", "minkowski", "pearson", "spearman", "kendall").It can also be a function. If the function has one argument, the input argumentshould be a matrix and the returned value should be a dist object. If the func-tion has two arguments, the input arguments are two vectors and the functioncalculates distance between these two vectors.
clustering_method_rows
Method to perform hierarchical clustering, pass to hclust.
row_dend_side Should the row dendrogram be put on the left or right of the heatmap?
row_dend_width Width of the row dendrogram, should be a unit object.
show_row_dend Whether show row dendrogram?
row_dend_gp Graphic parameters for the dendrogram segments. If users already provide adendrogram object with edges rendered, this argument will be ignored.
row_dend_reorder
Apply reordering on row dendrograms. The value can be a logical value or avector which contains weight which is used to reorder rows. The reordering isapplied by reorder.dendrogram.
cluster_columns
Whether make cluster on columns? Same settings as cluster_rows.cluster_column_slices
If columns are split into slices, whether perform clustering on the slice means?clustering_distance_columns
Same setting as clustering_distance_rows.clustering_method_columns
Method to perform hierarchical clustering, pass to hclust.column_dend_side
Should the column dendrogram be put on the top or bottom of the heatmap?column_dend_height
height of the column cluster, should be a unit object.show_column_dend
column_dend_gp Graphic parameters for dendrogram segments. Same settings as row_dend_gp.column_dend_reorder
Apply reordering on column dendrograms. Same settings as row_dend_reorder.
row_order Order of rows. Manually setting row order turns off clustering.
column_order Order of column.
row_labels Optional row labels which are put as row names in the heatmap.
row_names_side Should the row names be put on the left or right of the heatmap?
show_row_names Whether show row names.row_names_max_width
Maximum width of row names viewport.
row_names_gp Graphic parameters for row names.
row_names_rot Rotation of row names.row_names_centered
Should row names put centered?
column_labels Optional column labels which are put as column names in the heatmap.column_names_side
Should the column names be put on the top or bottom of the heatmap?column_names_max_height
Maximum height of column names viewport.show_column_names
Whether show column names.column_names_gp
Graphic parameters for drawing text.column_names_rot
Rotation of column names.column_names_centered
Should column names put centered?
top_annotation A HeatmapAnnotation object.bottom_annotation
A HeatmapAnnotation object.left_annotation
It should be specified by rowAnnotation.right_annotation
it should be specified by rowAnnotation.
km Apply k-means clustering on rows. If the value is larger than 1, the heatmapwill be split by rows according to the k-means clustering. For each row slice,hierarchical clustering is still applied with parameters above.
split A vector or a data frame by which the rows are split. But if cluster_rows is aclustering object, split can be a single number indicating to split the dendro-gram by cutree.
row_km Same as km.
row_km_repeats Number of k-means runs to get a consensus k-means clustering. Note if row_km_repeatsis set to more than one, the final number of groups might be smaller than row_km,but this might means the original row_km is not a good choice.
row_split Same as split.
column_km K-means clustering on columns.
100 Heatmap
column_km_repeats
Number of k-means runs to get a consensus k-means clustering. Similar asrow_km_repeats.
column_split Split on columns. For heatmap splitting, please refer to https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#heatmap-split.
gap Gap between row slices if the heatmap is split by rows. The value should be aunit object.
row_gap Same as gap.
column_gap Gap between column slices.show_parent_dend_line
When heatmap is split, whether to add a dashed line to mark parent dendrogramand children dendrograms?
width Width of the heatmap body.
height Height of the heatmap body.
heatmap_width Width of the whole heatmap (including heatmap components)
heatmap_height Height of the whole heatmap (including heatmap components). Check https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#size-of-the-heatmap .
show_heatmap_legend
Whether show heatmap legend?heatmap_legend_param
A list contains parameters for the heatmap legends. See color_mapping_legend,ColorMapping-methodfor all available parameters.
use_raster Whether render the heatmap body as a raster image. It helps to reduce file sizewhen the matrix is huge. Note if cell_fun is set, use_raster is enforced to beFALSE.
raster_device Graphic device which is used to generate the raster image.
raster_quality A value set to larger than 1 will improve the quality of the raster image.raster_device_param
A list of further parameters for the selected graphic device. For raster image sup-port, please check https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#heatmap-as-raster-image .
raster_resize Whether resize the matrix to let the dimension of the matrix the same as thedimension of the raster image?
post_fun A function which will be executed after the heatmap list is drawn.
Details
The initialization function only applies parameter checking and fill values to the slots with somevalidation.
Following methods can be applied to the Heatmap-class object:
• show,Heatmap-method: draw a single heatmap with default parameters
• draw,Heatmap-method: draw a single heatmap.
• + or %v% append heatmaps and annotations to a list of heatmaps.
The constructor function pretends to be a high-level graphic function because the show method ofthe Heatmap-class object actually plots the graphics.
The Heatmap-class is not responsible for heatmap legend and annotation legends. The draw,Heatmap-methodmethod constructs a HeatmapList-class object which only contains one single heatmap and calldraw,HeatmapList-method to make the complete heatmap.
Methods
The Heatmap-class provides following methods:
• Heatmap: constructor method.
• draw,Heatmap-method: draw a single heatmap.
• add_heatmap,Heatmap-method append heatmaps and annotations to a list of heatmaps.
• row_order,HeatmapList-method: get order of rows
• column_order,HeatmapList-method: get order of columns
• row_dend,HeatmapList-method: get row dendrograms
• column_dend,HeatmapList-method: get column dendrograms
... Name-value pairs where the names correspond to annotation names and val-ues can be a vector, a matrix and an annotation function. Each pair is sent toSingleAnnotation to contruct a single annotation.
df A data frame. Each column will be treated as a simple annotation. The dataframe must have column names.
name Name of the heatmap annotation, optional.
col A list of colors which contain color mapping to df or simple annotations definedin .... See SingleAnnotation for how to set colors.
na_col Color for NA values in simple annotations.annotation_legend_param
A list which contains parameters for annotation legends. See color_mapping_legend,ColorMapping-methodfor all possible options.
show_legend Whether show annotation legends. The value can be one single value or a vector.
which Are these row annotations or column annotations?
gp Graphic parameters for simple annotations (with fill parameter ignored).
HeatmapAnnotation 103
border border of single annotations.
gap Gap between annotations. It can be a single value or a vector of unit objects.show_annotation_name
Whether show annotation names? For column annotation, annotation names aredrawn either on the left or the right, and for row annotations, names are draweither on top or at the bottom. The value can be a vector.
annotation_name_gp
Graphic parameters for anntation names. Graphic paramters can be vectors.annotation_name_offset
Offset to the annotation names, a unit object. The value can be a vector.annotation_name_side
Side of the annotation names.annotation_name_rot
Rotation of the annotation names, it can only take values in c(00,90,180,270).The value can be a vector.
annotation_height
Height of each annotation if annotations are column annotations.annotation_width
Width of each annotation if annotations are row annotations.
height Height of the whole column annotations.
width Width of the whole heatmap annotations.simple_anno_size
Size of the simple annotation.simple_anno_size_adjust
Whether also adjust the size of simple annotations when adjusting the wholeheatmap annotation.
Details
For arguments show_legend, border, annotation_name_offset, annotation_name_side, annotation_name_rot,show_annotation_name, they can be set as named vectors to modify values for some of the anno-tations, e.g. assuming you have an annotation with name foo, you can specify border = c(foo =TRUE) in HeatmapAnnotation.
There are three ways to specify heatmap annotations:
1. If the annotation is simply a vector or a matrix, it can be specified like HeatmapAnnotation(foo= 1:10). 2. If the annotations are already stored as a data frame, it can be specified like HeatmapAnnotation(df= df). 3. For complex annotations, users can use the pre-defined annotation functions such asanno_points: HeatmapAnnotation(foo = anno_points(1:10)).
For more details and examples, please check https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.html.
There are two helper functions: rowAnnotation and columnAnnotation.
Examples
# There is no exampleNULL
HeatmapAnnotation-class
Class for Heatmap Annotations
Description
Class for Heatmap Annotations
Details
A complex heatmap contains a list of annotations which are represented as graphics placed onrows and columns. The HeatmapAnnotation-class contains a list of single annotations which arerepresented as a list of SingleAnnotation-class objects.
Methods
The HeatmapAnnotation-class provides following methods:
• HeatmapAnnotation: constructor method.
• draw,HeatmapAnnotation-method: draw the annotations.
You can set some parameters for all heatmaps/annotations simultaneously by this global function.Pleast note you should put it before your heatmap code and reset all option values after drawing theheatmaps to get rid of affecting next heatmap.
There are following parameters to control all heatmaps:
heatmap_row_names_gp set row_names_gp in all Heatmap.
heatmap_column_names_gp set column_names_gp in all Heatmap.
heatmap_row_title_gp set row_title_gp in all Heatmap.
heatmap_column_title_gp set column_title_gp in all Heatmap.
heatmap_border set border in all Heatmap.
Following parameters control the legends:
legend_title_gp set title_gp in all heatmap legends and annotation legends.
legend_title_position set title_position in all heatmap legends and annotation legends.
legend_labels_gp set labels_gp in all heatmap legends and annotation legends.
legend_grid_width set grid_width in all heatmap legends and annotation legends.
legend_grid_height set grid_height in all heatmap legends and annotation legends.
legend_border set border in all heatmap legends and annotation legends.
Following parameters control heatmap annotations:
116 is_abs_unit
annotation_border border in all HeatmapAnnotation.
simple_anno_size size for the simple annotation.
Following parameters control the space between heatmap components:
DENDROGRAM_PADDING space bewteen dendrograms and heatmap body.
DIMNAME_PADDING space between row/column names and heatmap body.
TITLE_PADDING space between row/column titles and heatmap body.
COLUMN_ANNO_PADDING space between column annotations and heatmap body.
ROW_ANNO_PADDING space between row annotations and heatmap body.
Other parameters:
fast_hclust whether use hclust to speed up clustering?
show_parent_dend_line when heatmap is split, whether to add a dashed line to mark parent den-drogram and children dendrograms?
You can get or set option values by the traditional way (like options) or by $ operator:
# to get option valuesht_opt("heatmap_row_names_gp")ht_opt$heatmap_row_names_gp
# to set option valuesht_opt("heatmap_row_names_gp" = gpar(fontsize = 8))ht_opt$heatmap_row_names_gp = gpar(fontsize = 8)
Reset to the default values by ht_opt(RESET = TRUE).
at Breaks of the legend. The values can be either numeric or character. If it is notspecified, the values of labels are taken as labels.
labels Labels corresponding to at. If it is not specified, the values of at are taken aslabels.
col_fun A color mapping function which is used to make a continuous legend. UsecolorRamp2 to generate the color mapping function. If at is missing, the breaksrecorded in the color mapping function are used for at.
118 Legend
nrow For legend which is represented as grids, nrow controls number of rows of thegrids if the grids are arranged into multiple rows.
ncol Similar as nrow, ncol controls number of columns of the grids if the grids arearranged into multiple columns. Note at a same time only one of nrow and ncolcan be specified.
by_row Are the legend grids arranged by rows or by columns?
grid_height The height of legend grid. It can also control the height of the continuous legendif it is horizontal.
grid_width The width of legend grid. It can also control the width of the continuous legendif it is vertical.
gap If legend grids are put into multiple rows or columns, this controls the gap be-tween neighbouring rows or columns, measured as a unit object.
labels_gp Graphic parameters for labels.
labels_rot Text rotation for labels. It should only be used for horizontal continuous legend.
border Color of legend grid borders. It also works for the ticks in the continuous legend.
background Background colors for the grids. It is used when points and lines are the legendgraphics.
type Type of legends. The value can be one of grid, points, lines and boxplot.
legend_gp Graphic parameters for the legend grids. You should control the filled color ofthe legend grids by gpar(fill = ...).
pch Type of points if points are used as legend. Note you can use single-letter aspch, e.g. pch = 'A'. There are three additional integers that are valid for pch: 26and 27 for single diagonal lines and 28 for double diagonal lines.
size Size of points.
legend_height Height of the whole legend body. It is only used for vertical continous legend.
legend_width Width of the whole legend body. It is only used for horizontal continous legend.
direction Direction of the legend, vertical or horizontal?
title Title of the legend.
title_gp Graphic parameters of the title.
title_position Position of title relative to the legend. topleft, topcenter, leftcenter-rotand lefttop-rot are only for vertical legend and leftcenter, lefttop areonly for horizontal legend.
title_gap Gap between title and the legend body.
Details
Most of the argument can also be set in heatmap_legend_param argument in Heatmap or annotation_legend_paramargument in HeatmapAnnotation to configure legend styles for heatmap and annotations.
Value
A Legends-class object.
See Also
packLegend packs multiple legends into one Legends-class object.
See examples of configuring legends: https://jokergoo.github.io/ComplexHeatmap-reference/book/legends.html
... The input sets. If it is represented as a single variable, it should be a matrix/dataframe or a list. If it is multiple variables, it should be name-value pairs, see Inputsection for explanation.
mode The mode for forming the combination set, see Mode section.
top_n_sets Number of sets with largest size.
min_set_size Ths minimal set size that is used for generating the combination matrix.remove_empty_comb_set
Whether remove the complement set which has no intersection to any of the set.
universal_set The universal set. If it is set, the size of the complement set of all sets is alsocalculated. It if is specified, complement_size is ignored.
124 make_comb_mat
complement_size
The size for the complement of all sets. If it is specified, the combination setname will be like "00...".
value_fun For each combination set, how to calculate the size? If it is a scalar set, thelength of the vector is the size of the set, while if it is a region-based set, (i.e.GRanges or IRanges object), the sum of widths of regions in the set is calculatedas the size of the set.
Value
A matrix also in a class of comb_mat.
Following functions can be applied to it: set_name, comb_name, set_size, comb_size, comb_degree,extract_comb and t.comb_mat.
Input
To represent multiple sets, the variable can be represented as:
1. A list of sets where each set is a vector, e.g.:
2. A binary matrix/data frame where rows are elements and columns are sets, e.g.:
a b ch 1 1 1t 1 0 1j 1 0 0u 1 0 1w 1 0 0...
If the variable is a data frame, the binary columns (only contain 0 and 1) and the logical columnsare only kept.
The set can be genomic regions, then it can only be represented as a list of GRanges objects.
Mode
E.g. for three sets (A, B, C), the UpSet approach splits the combination of selecting elements inthe set or not in the set and calculates the sizes of the combination sets. For three sets, all possiblecombinations are:
A B C1 1 11 1 01 0 10 1 11 0 00 1 00 0 1
make_layout-dispatch 125
A value of 1 means to select that set and 0 means not to select that set. E.g., "1 1 0" means to selectset A, B while not set C. Note there is no "0 0 0", because the background size is not of interesthere. With the code of selecting and not selecting the sets, next we need to define how to calculatethe size of that combination set. There are three modes:
1. distinct mode: 1 means in that set and 0 means not in that set, then "1 1 0" means a setof elements also in set A and B, while not in C (i.e. setdiff(intersect(A,B),C)). Under thismode, the seven combination sets are the seven partitions in the Venn diagram and they are mutuallyexclusive.
2. intersect mode: 1 means in that set and 0 is not taken into account, then, "1 1 0" means a setof elements in set A and B, and they can also in C or not in C (i.e. intersect(A,B)). Under thismode, the seven combination sets can overlap.
3. union mode: 1 means in that set and 0 is not taken into account. When there are multiple 1, therelationship is OR. Then, "1 1 0" means a set of elements in set A or B, and they can also in C ornot in C (i.e. union(A,B)). Under this mode, the seven combination sets can overlap.
make_layout-dispatch Method dispatch page for make_layout
Description
Method dispatch page for make_layout.
Dispatch
make_layout can be dispatched on following classes:
• make_layout,HeatmapList-method, HeatmapList-class class method
• make_layout,Heatmap-method, Heatmap-class class method
126 make_layout-Heatmap-method
Examples
# no exampleNULL
make_layout-Heatmap-method
Make the Layout of a Single Heatmap
Description
Make the Layout of a Single Heatmap
Usage
## S4 method for signature 'Heatmap'make_layout(object)
Arguments
object A Heatmap-class object.
Details
The layout of the single heatmap will be established by setting the size of each heatmap component.Also how to make graphics for heatmap components will be recorded by saving as functions.
Whether to apply row clustering or column clustering affects the layout, so clustering should beapplied first by prepare,Heatmap-method before making the layout.
row_title_side Will the title be put on the left or right of the heatmap list?
row_title_gp Graphic parameters for the row title.
column_title Title on the column.column_title_side
Will the title be put on the top or bottom of the heatmap?column_title_gp
Graphic parameters for the column title.heatmap_legend_side
Side of the heatmap legends.
merge_legends Whether to put heatmap legends and annotation legends together. By defaultthey are put in different viewports.
show_heatmap_legend
Whether show heatmap legends.heatmap_legend_list
A list of self-defined legends, should be wrapped into a list of grob objects.Normally they are constructed by Legend.
annotation_legend_side
Side of annotation legends.show_annotation_legend
Whether show annotation legends.annotation_legend_list
A list of self-defined legends, should be wrapped into a list of grob objects.Normally they are constructed by Legend.
ht_gap Gap between heatmaps, should be a unit object. It can be a vector of length 1or the number of heamtaps/annotations.
main_heatmap Name or index for the main heatmap.
make_layout-HeatmapList-method 129
padding Padding of the whole plot. The four values correspond to the bottom, left, topand right paddings.
auto_adjust whether apply automatic adjustment? The auto-adjustment includes turning offdendrograms, titles and row/columns for non-main heatmaps.
row_dend_side If auto-adjustment is on, to put the row dendrograms of the main heatmap to themost left side of the heatmap list or the most right side?
row_sub_title_side
There can be sub titles generated by the splitting of heatmaps. Similar setting asrow_dend_side.
column_dend_side
Similar setting as row_dend_side.column_sub_title_side
Similar setting as row_sub_title_side.
row_gap Overwrite the corresponding setting in the main heatmap.
cluster_rows Overwrite the corresponding setting in the main heatmap.clustering_distance_rows
Overwrite the corresponding setting in the main heatmap.clustering_method_rows
Overwrite the corresponding setting in the main heatmap.same setting as inHeatmap, if it is specified, clustering_method_rows in main heatmap is ig-nored.
row_dend_width Overwrite the corresponding setting in the main heatmap.
show_row_dend same Overwrite the corresponding setting in the main heatmap.row_dend_reorder
Overwrite the corresponding setting in the main heatmap.
row_dend_gp Overwrite the corresponding setting in the main heatmap.
row_order Overwrite the corresponding setting in the main heatmap.
row_km Overwrite the corresponding setting in the main heatmap.
row_km_repeats Overwrite the corresponding setting in the main heatmap.
row_split Overwrite the corresponding setting in the main heatmap.
height Overwrite the corresponding setting in the main heatmap.
heatmap_height Overwrite the corresponding setting in the main heatmap.
column_gap Overwrite the corresponding setting in the main heatmap.cluster_columns
Overwrite the corresponding setting in the main heatmap.clustering_distance_columns
Overwrite the corresponding setting in the main heatmap.clustering_method_columns
Overwrite the corresponding setting in the main heatmap.column_dend_width
column Overwrite the corresponding setting in the main heatmap.show_column_dend
Overwrite the corresponding setting in the main heatmap.column_dend_reorder
Overwrite the corresponding setting in the main heatmap.
130 make_row_cluster-Heatmap-method
column_dend_gp Overwrite the corresponding setting in the main heatmap.column_order Overwrite the corresponding setting in the main heatmap.column_km Overwrite the corresponding setting in the main heatmap.column_km_repeats
Overwrite the corresponding setting in the main heatmap.column_split Overwrite the corresponding setting in the main heatmap.width Overwrite the corresponding setting in the main heatmap.heatmap_width Overwrite the corresponding setting in the main heatmap.
Details
It sets the size of each component of the heatmap list and adjusts graphic parameters for eachheatmap if necessary.
This function is only for internal use.
Value
A HeatmapList-class object in which settings for all heatmap are adjusted.
max_text_height calculates the maximum height of a text vector.
Examples
x = c("a", "bb", "ccc")max_text_width(x, gp = gpar(fontsize = 10))
merge_dendrogram Merge Dendrograms
Description
Merge Dendrograms
Usage
merge_dendrogram(x, y, only_parent = FALSE, ...)
Arguments
x The parent dendrogram.
y The children dendrograms. They are connected to the leaves of the parent den-drogram. So the length of y should be as same as the number of leaves of theparent dendrogram.
only_parent Whether only returns the parent dendrogram where the height and node posi-tions have been adjusted by children dendrograms.
... Other arguments.
Details
Do not retrieve the order of the merged dendrogram. It is not reliable.
134 names.HeatmapAnnotation
Examples
m1 = matrix(rnorm(100), nr = 10)m2 = matrix(rnorm(80), nr = 8)m3 = matrix(rnorm(50), nr = 5)dend1 = as.dendrogram(hclust(dist(m1)))dend2 = as.dendrogram(hclust(dist(m2)))dend3 = as.dendrogram(hclust(dist(m3)))dend_p = as.dendrogram(hclust(dist(rbind(colMeans(m1), colMeans(m2), colMeans(m3)))))dend_m = merge_dendrogram(dend_p, list(dend1, dend2, dend3))grid.dendrogram(dend_m, test = TRUE)
require(dendextend)dend1 = color_branches(dend1, k = 1, col = "red")dend2 = color_branches(dend2, k = 1, col = "blue")dend3 = color_branches(dend3, k = 1, col = "green")dend_p = color_branches(dend_p, k = 1, col = "orange")dend_m = merge_dendrogram(dend_p, list(dend1, dend2, dend3))grid.dendrogram(dend_m, test = TRUE)
names.HeatmapAnnotation
Annotation Names
Description
Annotation Names
Usage
## S3 method for class 'HeatmapAnnotation'names(x)
Arguments
x A HeatmapAnnotation-class object.
Examples
ha = HeatmapAnnotation(foo = 1:10, bar = anno_points(10:1))names(ha)
names.HeatmapList 135
names.HeatmapList Names of the heatmaps/annotations
Description
Names of the heatmaps/annotations
Usage
## S3 method for class 'HeatmapList'names(x)
Arguments
x A HeatmapList-class object
Examples
# There is no exampleNULL
names<-.HeatmapAnnotation
Assign Annotation Names
Description
Assign Annotation Names
Usage
## S3 replacement method for class 'HeatmapAnnotation'names(x) <- value
Arguments
x A HeatmapAnnotation-class object.
value A vector of new names.
Examples
ha = HeatmapAnnotation(foo = 1:10, bar = anno_points(10:1))names(ha) = c("A", "B")names(ha)
136 nobs.AnnotationFunction
ncol.Heatmap Number of Columns in the Heatmap
Description
Number of Columns in the Heatmap
Usage
## S3 method for class 'Heatmap'ncol(x)
Arguments
x A Heatmap-class object.
Examples
# There is no exampleNULL
nobs.AnnotationFunction
Number of Observations
Description
Number of Observations
Usage
## S3 method for class 'AnnotationFunction'nobs(object, ...)
Arguments
object The AnnotationFunction-class object.
... Other arguments.
Details
returns NA.
Examples
anno = anno_points(1:10)nobs(anno)
nobs.HeatmapAnnotation 137
nobs.HeatmapAnnotation
Number of Observations
Description
Number of Observations
Usage
## S3 method for class 'HeatmapAnnotation'nobs(object, ...)
Arguments
object The HeatmapAnnotation-class object.
... other arguments.
Value
If there is no nobs information for any of its SingleAnnotation-class object, it returns NA.
Examples
# There is no exampleNULL
nobs.SingleAnnotation Number of Observations
Description
Number of Observations
Usage
## S3 method for class 'SingleAnnotation'nobs(object, ...)
Arguments
object The SingleAnnotation-class object.
... Other arguments.
Details
It returns the n slot of the annotaton function. If it does not exist, it returns NA.
138 nrow.Heatmap
Examples
# There is no exampleNULL
normalize_comb_mat Normalize a list of combination matrice
Description
Normalize a list of combination matrice
Usage
normalize_comb_mat(...)
Arguments
... If it is a single argument, the value should be a list of combination matrices.
Details
It normalizes a list of combination matrice to make them have same number and order of sets andcombination sets.
The sets (by set_name) from all combination matrice should be the same.
mat The value should be a character matrix which encodes mulitple alterations ora list of matrices for which every matrix contains binary value representingwhether the alteration is present or absent. When the value is a list, the namesof the list represent alteration types. You can use unify_mat_list to make allmatrix having same row names and column names.
140 oncoPrint
get_type If different alterations are encoded in the matrix as complex strings, this self-defined function determines how to extract them. It only works when mat is amatrix. The default value is default_get_type.
alter_fun A single function or a list of functions which defines how to add graphics fordifferent alterations.
alter_fun_is_vectorized
Whether alter_fun is implemented vectorized. Internally the function willguess.
col A vector of color for which names correspond to alteration types.
top_annotation Annotation put on top of the oncoPrint. By default it is barplot which shows thenumber of genes with a certain alteration in each sample.
right_annotation
Annotation put on the right of the oncoPrint. By default it is barplot whichshows the number of samples with a certain alteration in each gene.
left_annotation
Annotation put on the left of the oncoPrint.bottom_annotation
Annotation put at the bottom of the oncoPrint.
show_pct whether show percent values on the left of the oncoprint?
pct_gp Graphic paramters for percent values
pct_digits Digits for the percent values.
pct_side Side of the percent values to the oncoPrint. This argument is currently disabled.
row_labels Labels as the row names of the oncoPrint.
show_row_names Whether show row names?
row_names_side Side of the row names to the oncoPrint. This argument is currently disabled.
row_names_gp Graphic parameters for the row names.
row_split Pass to Heatmap.
column_labels Pass to Heatmap.column_names_gp
Pass to Heatmap.
column_split Pass to Heatmap.
row_order Order of rows. By default rows are sorted by the number of occurence of thealterations.
column_order Order of columns. By default the columns are sorted to show the mutual exclu-sivity of alterations.
remove_empty_columns
If there is no alteration in some samples, whether remove them on the oncoPrint?remove_empty_rows
If there is no alteration in some samples, whether remove them on the oncoPrint?show_column_names
Whether show column names?heatmap_legend_param
pass to Heatmap.
... Pass to Heatmap.
order.comb_mat 141
Details
The ’memo sort’ method is from https://gist.github.com/armish/564a65ab874a770e2c26 .Thanks to B. Arman Aksoy for contributing the code.
https://jokergoo.github.io/ComplexHeatmap-reference/book/oncoprint.html gives de-tails for configuring a oncoPrint.
Value
A Heatmap-class object which means you can add other heatmaps or annotations to it.
gap Gap between two neighbouring legends. The value is a unit object with lengthof one. It is the same as row_gap if the direction if vertial and the same ascolumn_gap if the direction is horizontal.
row_gap Horizontal gaps between legends.
column_gap Vertical gaps between legends.
direction The direction to arrange legends.
max_width The maximal width of the total packed legends. It only works for horizontalarrangement. If the total width of the legends exceeds it, the legends will bearranged into multiple rows.
max_height Similar as max_width, but for the vertical arrangment of legends.
list The list of legends can be specified as a list.
restore_matrix Restore the index vector to index matrix in layer_fun
Description
Restore the index vector to index matrix in layer_fun
Usage
restore_matrix(j, i, x, y)
Arguments
j Column indices directly from layer_fun.i Row indices directly from layer_fun.x Position on x-direction directly from layer_fun.y Position on y-direction directly from layer_fun.
Details
The values that are sent to layer_fun are all vectors (for the vectorization of the grid graphicfunctions), however, the heatmap slice where layer_fun is applied to, is still represented by amatrix, thus, it would be very convinient if all the arguments in layer_fun can be converted tothe sub-matrix for the current slice. Here, as shown in above example, restore_matrix does thejob. restore_matrix directly accepts the first four argument in layer_fun and returns an indexmatrix, where rows and columns correspond to the rows and columns in the current slice, from topto bottom and from left to right. The values in the matrix are the natural order of e.g. vector j incurrent slice.For following code:
Heatmap(small_mat, name = "mat", col = col_fun,row_km = 2, column_km = 2,layer_fun = function(j, i, x, y, w, h, fill) {
ind_mat = restore_matrix(j, i, x, y)print(ind_mat)
As you see, this is a three-row and five-column index matrix where the first row corresponds to thetop row in the slice. The values in the matrix correspond to the natural index (i.e. 1, 2, ...) in j, i,x, y, ... in layer_fun. Now, if we want to add values on the second column in the top-left slice, thecode which is put inside layer_fun would look like:
for(ind in ind_mat[, 2]) {grid.text(small_mat[i[ind], j[ind]], x[ind], y[ind], ...)
object A HeatmapAnnotation-class object.annotation_height
A vector of of annotation heights in unit class.annotation_width
A vector of of annotation widths in unit class.
height The height of the complete heatmap annotation.
width The width of the complete heatmap annotation.simple_anno_size
The size of one line of the simple annotation.simple_anno_size_adjust
Whether adjust the size of the simple annotation?
rowAnnotation 147
Details
The function only adjust height for column annotations and width for row annotations.
The basic rules are (take height and annotation_height for example:
1. If annotation_height is set and all annotation_height are absolute units, height is ignored.2. If annotation_height contains non-absolute units, height also need to be set and the non-absolute units should be set in a simple form such as 1:10 or unit(1,"null"). 3. simple_anno_sizeis only used when annotation_height is NULL. 4. If only height is set, non-simple annotationis adjusted while keeps simple anntation unchanged. 5. If only height is set and all annota-tions are simple annotations, all anntations are adjusted, and simple_anno_size is disabled. 6. Ifsimple_anno_size_adjust is FALSE, the size of the simple annotations will not change.
• show,ColorMapping-method, ColorMapping-class class method
• show,AnnotationFunction-method, AnnotationFunction-class class method
• show,HeatmapAnnotation-method, HeatmapAnnotation-class class method
• show,SingleAnnotation-method, SingleAnnotation-class class method
• show,HeatmapList-method, HeatmapList-class class method
• show,Heatmap-method, Heatmap-class class method
Examples
# no exampleNULL
show-Heatmap-method Draw the Single Heatmap with Defaults
Description
Draw the Single Heatmap with Defaults
Usage
## S4 method for signature 'Heatmap'show(object)
Arguments
object A Heatmap-class object.
show-HeatmapAnnotation-method 161
Details
It actually calls draw,Heatmap-method, but only with default parameters. If users want to cus-tomize the heatmap, they can pass parameters directly to draw,Heatmap-method.
## S4 method for signature 'HeatmapList'show(object)
Arguments
object a HeatmapList-class object.
Details
Actually it calls draw,HeatmapList-method, but only with default parameters. If users want tocustomize the heatmap, they can pass parameters directly to draw,HeatmapList-method.
Value
This function returns no value.
Examples
# There is no exampleNULL
show-SingleAnnotation-method
Print the SingleAnnotation object
Description
Print the SingleAnnotation object
Usage
## S4 method for signature 'SingleAnnotation'show(object)
name Name for the annotation. If it is not specified, an internal name is assigned.
value A vector or a matrix of discrete or continuous values.
col Colors corresponding to value. If the mapping is discrete, the value of colshould be a named vector; If the mapping is continuous, the value of col shouldbe a color mapping function.
fun A user-defined function to add annotation graphics. The argument of this func-tion should be at least a vector of index that corresponds to rows or columns.Normally the function should be constructed by AnnotationFunction if youwant the annotation supports splitting. See **Details** for more explanation.
na_col Color for NA values in the simple annotations.
which Whether the annotation is a row annotation or a column annotation?
164 SingleAnnotation
show_legend If it is a simple annotation, whether show legend in the final heatmap?gp Since simple annotation is represented as rows of grids. This argument controls
graphic parameters for the simple annotation. The fill parameter is ignoredhere.
border border, only work for simple annotationlegend_param Parameters for the legend. See color_mapping_legend,ColorMapping-method
for all possible options.show_name Whether show annotation name?name_gp Graphic parameters for annotation name.name_offset Offset to the annotation, a unit object.name_side ’right’ and ’left’ for column annotations and ’top’ and ’bottom’ for row annota-
tionsname_rot Rotation of the annotation name, it can only take values in c(0,90,180,270).simple_anno_size
size of the simple annotation.width The width of the plotting region (the viewport) that the annotation is drawn. If
it is a row annotation, the width must be an absolute unit.height The height of the plotting region (the viewport) that the annotation is drawn. If
it is a column annotation, the width must be an absolute unit.
Details
A single annotation is a basic unit of complex heatmap annotations where the heamtap annota-tions are always a list of single annotations. An annotation can be simply heatmap-like (here wecall it simple annotation) or more complex like points, lines, boxes (for which we call it complexannotation).
In the SingleAnnotation constructor, value, col, na_col are used to construct a anno_simpleannotation funciton which is generated internally by AnnotationFunction. The legend of thesimple annotation can be automatcally generated,
For construcing a complex annotation, users need to use fun which is a user-defind function. Nor-mally it is constucted by AnnotationFunction. One big advantage for using AnnotationFunctionis the annotation function or the graphics drawn by the annotation function can be split accordingto row splitting or column splitting of the heatmap. Users can also provide a "pure" function whichis a normal R function for the fun argument. The function only needs one argument which is avector of index for rows or columns depending whether it is a row annotation or column annota-tion. The other two optional arguments are the current slice index and total number of slices. See**Examples** section for an example. If it is a normal R function, it will be constructed into theAnnotationFunction-class object internally.
The SingleAnnotation-class is a simple wrapper on top of AnnotationFunction-class onlywith annotation name added.
The class also stored the "extended area" relative to the area for the annotation graphics. Theextended areas are those created by annotation names and axes.
There are following built-in annotation functions that can be directly used to generate complex an-notations: anno_simple, anno_points, anno_lines, anno_barplot, anno_histogram, anno_boxplot,anno_density, anno_text, anno_joyplot, anno_horizon, anno_image, anno_block, anno_summaryand anno_mark.
Examples
ha = SingleAnnotation(value = 1:10)draw(ha, test = "single column annotation")
m = cbind(1:10, 10:1)colnames(m) = c("a", "b")ha = SingleAnnotation(value = m)draw(ha, test = "matrix as column annotation")
anno = anno_barplot(matrix(nc = 2, c(1:10, 10:1)))ha = SingleAnnotation(fun = anno)draw(ha, test = "anno_barplot as input")
fun = local({# because there variables outside the function for use, we put it a local environmentvalue = 1:10function(index, k = 1, n = 1) {
The SingleAnnotation-class is always used internally. The public HeatmapAnnotation-classcontains a list of SingleAnnotation-class objects and is used to add annotation graphics onheatmaps.
Examples
# There is no exampleNULL
size.AnnotationFunction
Size of the AnnotationFunction Object
Description
Size of the AnnotationFunction Object
Usage
## S3 method for class 'AnnotationFunction'size(x, ...)
Arguments
x The AnnotationFunction-class object.
... Other arguments.
Details
It returns the width if it is a row annotation and the height if it is a column annotation.
Internally used.
Examples
anno = anno_points(1:10)ComplexHeatmap:::size(anno)anno = anno_points(1:10, which = "row")ComplexHeatmap:::size(anno)
size.HeatmapAnnotation 167
size.HeatmapAnnotation
Size of the HeatmapAnnotation Object
Description
Size of the HeatmapAnnotation Object
Usage
## S3 method for class 'HeatmapAnnotation'size(x, ...)
Arguments
x The HeatmapAnnotation-class object.
... Other arguments.
Details
It returns the width if it is a row annotation and the height if it is a column annotation.
Internally used.
Examples
# There is no exampleNULL
size.SingleAnnotation Size of the SingleAnnotation Object
Description
Size of the SingleAnnotation Object
Usage
## S3 method for class 'SingleAnnotation'size(x, ...)
Arguments
x The SingleAnnotation-class object.
... Other arguments.
Details
It returns the width if it is a row annotation and the height if it is a column annotation.
Internally used.
168 size<-.HeatmapAnnotation
Examples
# There is no exampleNULL
size<-.AnnotationFunction
Assign the Size to the AnnotationFunction Object
Description
Assign the Size to the AnnotationFunction Object
Usage
## S3 replacement method for class 'AnnotationFunction'size(x, ...) <- value
Arguments
x The AnnotationFunction-class object.
value A unit object.
... Other arguments.
Details
It assigns to the width if it is a row annotation and the height if it is a column annotation.
Internally used.
Examples
anno = anno_points(1:10)ComplexHeatmap:::size(anno) = unit(4, "cm")ComplexHeatmap:::size(anno)
size<-.HeatmapAnnotation
Assign the Size to the HeatmapAnnotation Object
Description
Assign the Size to the HeatmapAnnotation Object
Usage
## S3 replacement method for class 'HeatmapAnnotation'size(x, ...) <- value
size<-.SingleAnnotation 169
Arguments
x The HeatmapAnnotation-class object.
value A unit object.
... Other arguments.
Details
It assigns the width if it is a row annotation and the height if it is a column annotation.
Internally used.
Examples
# There is no exampleNULL
size<-.SingleAnnotation
Assign the Size to the SingleAnnotation Object
Description
Assign the Size to the SingleAnnotation Object
Usage
## S3 replacement method for class 'SingleAnnotation'size(x, ...) <- value
Arguments
x The SingleAnnotation-class object.
value A unit object.
... Other arguments.
Details
It assigns to the width if it is a row annotation and the height if it is a column annotation.
pos1 = rbind(c(1, 8), c(3, 10))make_plot(pos1, smartAlign2(pos1, range = range), range)make_plot(pos1, smartAlign2(pos1, range = range, range_fixed = FALSE), range)
str.comb_mat str method
Description
str method
Usage
## S3 method for class 'comb_mat'str(object, ...)
Arguments
object A combination matrix returned by make_comb_mat.
... Other arguments.
Examples
# There is no exampleNULL
subset_gp Subset a gpar Object
Description
Subset a gpar Object
Usage
subset_gp(gp, i)
Arguments
gp A gpar object.
i A vector of indices.
172 subset_vector
Value
A gpar object.
Examples
gp = gpar(col = 1:10, fill = 1)subset_gp(gp, 1:5)
subset_matrix_by_row Subset the Matrix by Rows
Description
Subset the Matrix by Rows
Usage
subset_matrix_by_row(x, i)
Arguments
x A matrix.
i The row indices.
Details
Mainly used for constructing the AnnotationFunction-class object.
Examples
# There is no exampleNULL
subset_vector Subset the vector
Description
Subset the vector
Usage
subset_vector(x, i)
Arguments
x A vector.
i The indices.
summary.Heatmap 173
Details
Mainly used for constructing the AnnotationFunction-class object.
Examples
# There is no exampleNULL
summary.Heatmap Print the Summary of a Heatmap
Description
Print the Summary of a Heatmap
Usage
## S3 method for class 'Heatmap'summary(object, ...)
Arguments
object A Heatmap-class object.
... Other arguments.
Examples
# There is no exampleNULL
summary.HeatmapList Summary of a Heatmap List
Description
Summary of a Heatmap List
Usage
## S3 method for class 'HeatmapList'summary(object, ...)
Arguments
object A HeatmapList-class object.
... Other arguments.
174 test_alter_fun
Examples
# There is no exampleNULL
t.comb_mat Transpost the Combination Matrix
Description
Transpost the Combination Matrix
Usage
## S3 method for class 'comb_mat't(x)
Arguments
x A combination matrix returned by make_comb_mat.
Examples
set.seed(123)lt = list(a = sample(letters, 10),
b = sample(letters, 15),c = sample(letters, 20))
m = make_comb_mat(lt)t(m)
test_alter_fun Test alter_fun for oncoPrint()
Description
Test alter_fun for oncoPrint()
Usage
test_alter_fun(fun, type, asp_ratio = 1)
Arguments
fun The alter_fun for oncoPrint. The value can be a list of functions or a singlefunction. See https://jokergoo.github.io/ComplexHeatmap-reference/book/oncoprint.html#define-the-alter-fun
type A vector of alteration types. It is only used when fun is a single function.
asp_ratio The aspect ratio (width/height) for the small rectangles.
This function helps you to have a quick view of how the graphics for each alteration type andcombinations look like.
Examples
alter_fun = list(mut1 = function(x, y, w, h) grid.rect(x, y, w, h, gp = gpar(fill = "red", col = NA)),mut2 = function(x, y, w, h) grid.rect(x, y, w, h, gp = gpar(fill = "blue", col = NA)),mut3 = function(x, y, w, h) grid.rect(x, y, w, h, gp = gpar(fill = "yellow", col = NA)),mut4 = function(x, y, w, h) grid.rect(x, y, w, h, gp = gpar(fill = "purple", col = NA)),mut5 = function(x, y, w, h) grid.rect(x, y, w, h, gp = gpar(lwd = 2)),mut6 = function(x, y, w, h) grid.points(x, y, pch = 16),mut7 = function(x, y, w, h) grid.segments(x - w*0.5, y - h*0.5, x + w*0.5, y + h*0.5, gp = gpar(lwd = 2)))test_alter_fun(alter_fun)
unify_mat_list Unify a List of Matrix
Description
Unify a List of Matrix
Usage
unify_mat_list(mat_list, default = 0)
Arguments
mat_list A list of matrix. All of them should have dimension names.
default Default values for the newly added rows and columns.
Details
All matrix will be unified to have same row names and column names.
m A combination matrix returned by make_comb_mat. The matrix can be trans-posed to switch the position of sets and combination sets.
comb_col The color for the dots representing combination sets.
pt_size The point size for the dots representing combination sets.
lwd The line width for the combination sets.
bg_col Color for the background rectangles.
bg_pt_col Color for the dots representing the set is not selected.
set_order The order of sets.
comb_order The order of combination sets.
top_annotation A HeatmapAnnotation object on top of the combination matrix.right_annotation
A HeatmapAnnotation object on the right of the combination matrix.
row_names_side The side of row names.
... Other arguments passed to Heatmap.
Details
By default, the sets are on rows and combination sets are on columns. The positions of the twotypes of sets can be switched by transposing the matrix.
When sets are on rows, the default top annotation is the barplot showing the size of each combina-tion sets and the default right annotation is the barplot showing the size of the sets. The annotations
UpSet 177
are simply constructed by HeatmapAnnotation and anno_barplot with some parameters pre-set.Users can check the source code of upset_top_annotation and upset_right_annotation tofind out how the annotations are defined.
To change or to add annotations, users just need to define a new HeatmapAnnotation object. E.g.if we want to change the side of the axis and name on top annotation:
m A combination matrix which is as same as the one for UpSet.
gp Graphic parameters for bars.
width Width of the right annotation.show_annotation_name
Whether show annotation names?annotation_name_gp
Graphic parameters for anntation names.
upset_top_annotation 179
annotation_name_offset
Offset to the annotation name, a unit object.annotation_name_side
Side of the annotation name.annotation_name_rot
Rotation of the annotation name, it can only take values in c(00,90,180,270).
... Passed to anno_barplot.
Details
The default right annotation is actually barplot implemented by anno_barplot. For how to set theright annotation or left annotation in UpSet, please refer to UpSet.
m A combination matrix which is as same as the one for UpSet.
gp Graphic parameters for bars.
height The height of the top annotation.show_annotation_name
Whether show annotation names?annotation_name_gp
Graphic parameters for anntation names.annotation_name_offset
Offset to the annotation name, a unit object.
180 width.AnnotationFunction
annotation_name_side
Side of the annotation name.annotation_name_rot
Rotation of the annotation name, it can only take values in c(00,90,180,270).
... Passed to anno_barplot.
Details
The default top annotation is actually barplot implemented by anno_barplot. For how to set thetop annotation or bottom annotation in UpSet, please refer to UpSet.
Examples
# There is no exampleNULL
width.AnnotationFunction
Width of the AnnotationFunction Object
Description
Width of the AnnotationFunction Object
Usage
## S3 method for class 'AnnotationFunction'width(x, ...)
Arguments
x A AnnotationFunction-class object.
... Other arguments.
Details
Internally used.
Examples
anno = anno_points(1:10)ComplexHeatmap:::width(anno)anno = anno_points(1:10, which = "row")ComplexHeatmap:::width(anno)
width.Heatmap 181
width.Heatmap Width of the Heatmap
Description
Width of the Heatmap
Usage
## S3 method for class 'Heatmap'width(x, ...)
Arguments
x The HeatmapList-class object returned by draw,Heatmap-method.
... Other arguments.
Examples
# There is no exampleNULL
width.HeatmapAnnotation
Width of the HeatmapAnnotation Object
Description
Width of the HeatmapAnnotation Object
Usage
## S3 method for class 'HeatmapAnnotation'width(x, ...)
Arguments
x The HeatmapAnnotation-class object.
... Other arguments.
Details
Internally used.
Examples
# There is no exampleNULL
182 width.Legends
width.HeatmapList Width of the Heatmap List
Description
Width of the Heatmap List
Usage
## S3 method for class 'HeatmapList'width(x, ...)
Arguments
x The HeatmapList-class object returned by draw,HeatmapList-method.
... Other arguments.
Examples
# There is no exampleNULL
width.Legends Width of the Legends
Description
Width of the Legends
Usage
## S3 method for class 'Legends'width(x, ...)
Arguments
x The grob object returned by Legend or packLegend.
## S3 method for class 'SingleAnnotation'width(x, ...)
Arguments
x The SingleAnnotation-class object.
... Other arguments.
Details
Internally used.
Examples
# There is no exampleNULL
width<-.AnnotationFunction
Assign the Width to the AnnotationFunction Object
Description
Assign the Width to the AnnotationFunction Object
Usage
## S3 replacement method for class 'AnnotationFunction'width(x, ...) <- value
Arguments
x The AnnotationFunction-class object.
... Other arguments.
value A unit object.
Details
Internally used.
184 width<-.SingleAnnotation
Examples
# There is no exampleNULL
width<-.HeatmapAnnotation
Assign the Width to the HeatmapAnnotation Object
Description
Assign the Width to the HeatmapAnnotation Object
Usage
## S3 replacement method for class 'HeatmapAnnotation'width(x, ...) <- value
Arguments
x The HeatmapAnnotation-class object.
value A unit object.
... Other arguments.
Details
Internally used.
Examples
# There is no exampleNULL
width<-.SingleAnnotation
Assign the Width to the SingleAnnotation Object
Description
Assign the Width to the SingleAnnotation Object
Usage
## S3 replacement method for class 'SingleAnnotation'width(x, ...) <- value
widthDetails.annotation_axis 185
Arguments
x The SingleAnnotation-class object.
value A unit object.
... Other arguments.
Details
Internally used.
Examples
# There is no exampleNULL
widthDetails.annotation_axis
Width for annotation_axis Grob
Description
Width for annotation_axis Grob
Usage
## S3 method for class 'annotation_axis'widthDetails(x)
Arguments
x The annotation_axis grob returned by annotation_axis_grob.
Details
The physical width of the grob can be get by convertWidth(grobWidth(axis_grob),"mm").
Examples
# There is no exampleNULL
186 widthDetails.legend_body
widthDetails.legend Grob width for packed_legends
Description
Grob width for packed_legends
Usage
## S3 method for class 'legend'widthDetails(x)
Arguments
x A legend object.
Examples
# There is no exampleNULL
widthDetails.legend_body
Grob width for legend_body
Description
Grob width for legend_body
Usage
## S3 method for class 'legend_body'widthDetails(x)
Arguments
x A legend_body object.
Examples
# There is no exampleNULL
widthDetails.packed_legends 187
widthDetails.packed_legends
Grob width for packed_legends
Description
Grob width for packed_legends
Usage
## S3 method for class 'packed_legends'widthDetails(x)
Arguments
x A packed_legends object.
Examples
# There is no exampleNULL
[.AnnotationFunction Subset an AnnotationFunction Object
Description
Subset an AnnotationFunction Object
Usage
## S3 method for class 'AnnotationFunction'x[i]
Arguments
x An AnnotationFunction-class object.
i A vector of indices.
Details
One good thing for designing the AnnotationFunction-class is it can be subsetted, and this isthe base for the splitting of the annotations.
Examples
anno = anno_simple(1:10)anno[1:5]draw(anno[1:5], test = "subset of column annotation")
188 [.comb_mat
[.comb_mat Subset the Combination Matrix
Description
Subset the Combination Matrix
Usage
## S3 method for class 'comb_mat'x[i, j, drop = FALSE]
Arguments
x A combination matrix returned by make_comb_mat.
i Indices on rows.
j Indices on columns.
drop It is always reset to FALSE internally.
Details
If sets are on rows of the combination matrix, the row indices correspond to sets and column in-dices correspond to combination sets, and if sets are on columns of the combination matrix, rowscorrespond to the combination sets.
If the index is one-dimension, e.g. x[i], the index always corresponds to the combination sets.
You should not subset by the sets. It will give you wrong combination set size. The subsetting onsets are only used internally.
This subsetting method is mainly for subsetting combination sets, i.e., users can first use comb_sizeto get the size of each combination set, and filter them by the size.
Examples
set.seed(123)lt = list(a = sample(letters, 10),
b = sample(letters, 15),c = sample(letters, 20))
m = make_comb_mat(lt)m2 = m[, comb_size(m) >= 3]comb_size(m2)m[comb_size(m) >= 3]
[.Heatmap 189
[.Heatmap Subset a Heatmap
Description
Subset a Heatmap
Usage
## S3 method for class 'Heatmap'x[i, j]
Arguments
x A Heatmap-class object.
i Row indices.
j Column indices.
Details
This functionality is quite experimental. It should be applied before the layout is initialized.
[.HeatmapAnnotation Subset the HeatmapAnnotation object
Description
Subset the HeatmapAnnotation object
Usage
## S3 method for class 'HeatmapAnnotation'x[i, j]
Arguments
x A HeatmapAnnotation-class object.
i Index of observations.
j Index of annotations.
190 [.HeatmapList
Examples
ha = HeatmapAnnotation(foo = 1:10, bar = anno_points(10:1),sth = cbind(1:10, 10:1))ha[1:5, ]ha[, c("foo", "bar")]ha[, 1:2]ha[1:5, c("foo", "sth")]
[.HeatmapList Subset a HeatmapList object
Description
Subset a HeatmapList object
Usage
## S3 method for class 'HeatmapList'x[i, j]
Arguments
x A HeatmapList-class object
i row indices
j column indices
Details
If the heatmap list is horizontal, i is the row indices and j corresponds to heatmap names and singleannotation names. and if the heatlist is vertical, i corresponds to heatmap/annotation names and jis the column indices.
Examples
ht_list = Heatmap(matrix(rnorm(100), 10), name = "rnorm") +rowAnnotation(foo = 1:10, bar = anno_points(10:1)) +Heatmap(matrix(runif(100), 10), name = "runif")
[.SingleAnnotation Subset an SingleAnnotation Object
Description
Subset an SingleAnnotation Object
Usage
## S3 method for class 'SingleAnnotation'x[i]
Arguments
x An SingleAnnotation-class object.
i A vector of indices.
Details
The SingleAnnotation class object is subsetable only if the containing AnnotationFunction-classobject is subsetable. All the anno_* functions are subsetable, so if the SingleAnnotation object isconstructed by one of these functions, it is also subsetable.
Examples
ha = SingleAnnotation(value = 1:10)ha[1:5]draw(ha[1:5], test = "ha[1:5]")
%v% Vertically Add Heatmaps or Annotations to a Heatmap List
Description
Vertically Add Heatmaps or Annotations to a Heatmap List
Usage
x %v% y
Arguments
x A Heatmap-class object, a HeatmapAnnotation-class object or a HeatmapList-classobject.
y A Heatmap-class object, a HeatmapAnnotation-class object or a HeatmapList-classobject.
192 %v%
Details
It is only a helper function. It actually calls add_heatmap,Heatmap-method, add_heatmap,HeatmapList-methodor add_heatmap,HeatmapAnnotation-method depending on the class of the input objects.
The HeatmapAnnotation-class object to be added should only be column annotations.