Back to Multiple platform build/check report for BioC 3.11
AB[C]DEFGHIJKLMNOPQRSTUVWXYZ

CHECK report for ComplexHeatmap on malbec2

This page was generated on 2020-10-17 11:54:36 -0400 (Sat, 17 Oct 2020).

TO THE DEVELOPERS/MAINTAINERS OF THE ComplexHeatmap PACKAGE: Please make sure to use the following settings in order to reproduce any error or warning you see on this page.
Package 359/1905HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
ComplexHeatmap 2.4.3
Zuguang Gu
Snapshot Date: 2020-10-16 14:40:19 -0400 (Fri, 16 Oct 2020)
URL: https://git.bioconductor.org/packages/ComplexHeatmap
Branch: RELEASE_3_11
Last Commit: 08b4129
Last Changed Date: 2020-07-25 04:08:09 -0400 (Sat, 25 Jul 2020)
malbec2 Linux (Ubuntu 18.04.4 LTS) / x86_64  OK  OK [ OK ]UNNEEDED, same version exists in internal repository
tokay2 Windows Server 2012 R2 Standard / x64  OK  OK  OK  OK UNNEEDED, same version exists in internal repository
machv2 macOS 10.14.6 Mojave / x86_64  OK  OK  OK  OK UNNEEDED, same version exists in internal repository

Summary

Package: ComplexHeatmap
Version: 2.4.3
Command: /home/biocbuild/bbs-3.11-bioc/R/bin/R CMD check --install=check:ComplexHeatmap.install-out.txt --library=/home/biocbuild/bbs-3.11-bioc/R/library --no-vignettes --timings ComplexHeatmap_2.4.3.tar.gz
StartedAt: 2020-10-17 00:10:34 -0400 (Sat, 17 Oct 2020)
EndedAt: 2020-10-17 00:14:41 -0400 (Sat, 17 Oct 2020)
EllapsedTime: 246.3 seconds
RetCode: 0
Status:  OK 
CheckDir: ComplexHeatmap.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/bbs-3.11-bioc/R/bin/R CMD check --install=check:ComplexHeatmap.install-out.txt --library=/home/biocbuild/bbs-3.11-bioc/R/library --no-vignettes --timings ComplexHeatmap_2.4.3.tar.gz
###
##############################################################################
##############################################################################


* using log directory ‘/home/biocbuild/bbs-3.11-bioc/meat/ComplexHeatmap.Rcheck’
* using R version 4.0.3 (2020-10-10)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* using option ‘--no-vignettes’
* checking for file ‘ComplexHeatmap/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘ComplexHeatmap’ version ‘2.4.3’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘ComplexHeatmap’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... OK
Examples with CPU (user + system) or elapsed time > 5s
              user system elapsed
anno_horizon 5.188  0.048   5.246
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘test-AnnotationFunction.R’
  Running ‘test-ColorMapping-class.R’
  Running ‘test-Heatmap-class.R’
  Running ‘test-Heatmap-cluster.R’
  Running ‘test-HeatmapAnnotation.R’
  Running ‘test-HeatmapList-class.R’
  Running ‘test-Legend.R’
  Running ‘test-SingleAnnotation.R’
  Running ‘test-annotation_axis.R’
  Running ‘test-dendrogram.R’
  Running ‘test-gridtext.R’
  Running ‘test-multiple-page.R’
  Running ‘test-oncoPrint.R’
  Running ‘test-upset.R’
  Running ‘test-utils.R’
  Running ‘testthat-all.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

Status: OK


Installation output

ComplexHeatmap.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   /home/biocbuild/bbs-3.11-bioc/R/bin/R CMD INSTALL ComplexHeatmap
###
##############################################################################
##############################################################################


* installing to library ‘/home/biocbuild/bbs-3.11-bioc/R/library’
* installing *source* package ‘ComplexHeatmap’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (ComplexHeatmap)

Tests output

ComplexHeatmap.Rcheck/tests/test-annotation_axis.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> 
> 
> gb = annotation_axis_grob(at = 1:5, labels = month.name[1:5], labels_rot = 0, 
+     side = "left", facing = "outside")
> grid.newpage()
> pushViewport(viewport(xscale = c(0, 4), yscale = c(0, 6), width = 0.6, height = 0.6))
> grid.rect()
> grid.text('side = "left", facing = "outside"')
> grid.draw(gb)
> popViewport()
> 
> gb = annotation_axis_grob(at = 1:5, labels = month.name[1:5], labels_rot = 0, 
+     side = "left", facing = "inside")
> grid.newpage()
> pushViewport(viewport(xscale = c(0, 4), yscale = c(0, 6), width = 0.6, height = 0.6))
> grid.rect()
> grid.text('side = "left", facing = "inside"')
> grid.draw(gb)
> popViewport()
> 
> gb = annotation_axis_grob(at = 1:5, labels = month.name[1:5], labels_rot = 0, 
+     side = "right", facing = "outside")
> grid.newpage()
> pushViewport(viewport(xscale = c(0, 4), yscale = c(0, 6), width = 0.6, height = 0.6))
> grid.rect()
> grid.text('side = "right", facing = "outside"')
> grid.draw(gb)
> popViewport()
> 
> gb = annotation_axis_grob(at = 1:5, labels = month.name[1:5], labels_rot = 0, 
+     side = "right", facing = "inside")
> grid.newpage()
> pushViewport(viewport(xscale = c(0, 4), yscale = c(0, 6), width = 0.6, height = 0.6))
> grid.rect()
> grid.text('side = "right", facing = "inside"')
> grid.draw(gb)
> popViewport()
> 
> gb = annotation_axis_grob(at = 1:3, labels = month.name[1:3], labels_rot = 0, 
+     side = "top", facing = "outside")
> grid.newpage()
> pushViewport(viewport(xscale = c(0, 4), yscale = c(0, 6), width = 0.6, height = 0.6))
> grid.rect()
> grid.text('side = "top", facing = "outside"')
> grid.draw(gb)
> popViewport()
> 
> gb = annotation_axis_grob(at = 1:3, labels = month.name[1:3], labels_rot = 90, 
+     side = "top", facing = "outside")
> grid.newpage()
> pushViewport(viewport(xscale = c(0, 4), yscale = c(0, 6), width = 0.6, height = 0.6))
> grid.rect()
> grid.text('side = "top", facing = "outside"')
> grid.draw(gb)
> popViewport()
> 
> gb = annotation_axis_grob(at = 1:3, labels = month.name[1:3], labels_rot = 45, 
+     side = "top", facing = "outside")
> grid.newpage()
> pushViewport(viewport(xscale = c(0, 4), yscale = c(0, 6), width = 0.6, height = 0.6))
> grid.rect()
> grid.text('side = "top", facing = "outside"')
> grid.draw(gb)
> popViewport()
> 
> gb = annotation_axis_grob(at = 1:3, labels = month.name[1:3], labels_rot = 0, 
+     side = "top", facing = "inside")
> grid.newpage()
> pushViewport(viewport(xscale = c(0, 4), yscale = c(0, 6), width = 0.6, height = 0.6))
> grid.rect()
> grid.text('side = "top", facing = "inside"')
> grid.draw(gb)
> popViewport()
> 
> gb = annotation_axis_grob(at = 1:3, labels = month.name[1:3], labels_rot = 0, 
+     side = "bottom", facing = "outside")
> grid.newpage()
> pushViewport(viewport(xscale = c(0, 4), yscale = c(0, 6), width = 0.6, height = 0.6))
> grid.rect()
> grid.text('side = "bottom", facing = "outside"')
> grid.draw(gb)
> popViewport()
> 
> gb = annotation_axis_grob(at = 1:3, labels = month.name[1:3], labels_rot = 0, 
+     side = "bottom", facing = "inside")
> grid.newpage()
> pushViewport(viewport(xscale = c(0, 4), yscale = c(0, 6), width = 0.6, height = 0.6))
> grid.rect()
> grid.text('side = "bottom", facing = "inside"')
> grid.draw(gb)
> popViewport()
> 
> grid.newpage()
> pushViewport(viewport(xscale = c(0, 4), yscale = c(0, 6), width = 0.6, height = 0.6))
> gb = annotation_axis_grob(labels_rot = 0, side = "left", facing = "outside")
> grid.rect()
> grid.text('side = "left", facing = "outside"')
> grid.draw(gb)
> popViewport()
> 
> grid.newpage()
> pushViewport(viewport(xscale = c(0, 4), yscale = c(0, 6), width = 0.6, height = 0.6))
> gb = annotation_axis_grob(side = "left", direction = "reverse")
> grid.rect()
> grid.text('side = "left", direction = "reverse')
> grid.draw(gb)
> popViewport()
> 
> grid.newpage()
> pushViewport(viewport(xscale = c(0, 4), yscale = c(0, 6), width = 0.6, height = 0.6))
> gb = annotation_axis_grob(side = "bottom", direction = "reverse")
> grid.rect()
> grid.text('side = "bottom", direction = "reverse"')
> grid.draw(gb)
> popViewport()
> 
> 
> 
> proc.time()
   user  system elapsed 
  1.026   0.047   1.059 

ComplexHeatmap.Rcheck/tests/test-AnnotationFunction.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(circlize)
========================================
circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> library(GetoptLong)
> 
> if(!exists("normalize_graphic_param_to_mat")) {
+ 	normalize_graphic_param_to_mat = ComplexHeatmap:::normalize_graphic_param_to_mat
+ }
> 
> if(!exists("height")) {
+ 	height = ComplexHeatmap:::height
+ }
> 
> if(!exists("width")) {
+ 	width = ComplexHeatmap:::width
+ }
> 
> normalize_graphic_param_to_mat(1, nc = 2, nr = 4, "foo")
     [,1] [,2]
[1,]    1    1
[2,]    1    1
[3,]    1    1
[4,]    1    1
> normalize_graphic_param_to_mat(1:2, nc = 2, nr = 4, "foo")
     [,1] [,2]
[1,]    1    2
[2,]    1    2
[3,]    1    2
[4,]    1    2
> normalize_graphic_param_to_mat(1:4, nc = 2, nr = 4, "foo")
     [,1] [,2]
[1,]    1    1
[2,]    2    2
[3,]    3    3
[4,]    4    4
> 
> ### AnnotationFunction constructor #####
> fun = function(index) {
+ 	x = runif(10)
+ 	pushViewport(viewport(xscale = c(0.5, 10.5), yscale = c(0, 1)))
+ 	grid.points(index, x[index])
+ 	popViewport()
+ }
> anno = AnnotationFunction(fun = fun)
> 
> x = runif(10)
> fun = function(index) {
+ 	pushViewport(viewport(xscale = c(0.5, 10.5), yscale = c(0, 1)))
+ 	grid.points(index, x[index])
+ 	popViewport()
+ }
> anno = AnnotationFunction(fun = fun, var_import = "x")
> anno = AnnotationFunction(fun = fun, var_import = list(x))
> 
> 
> # devAskNewPage(ask = dev.interactive())
> 
> ########### testing anno_simple ############
> anno = anno_simple(1:10)
> draw(anno, test = "as a simple vector")
> draw(anno[1:5], test = "subset of column annotation")
> anno = anno_simple(1:10, which = "row")
> draw(anno, test = "as row annotation")
> draw(anno[1:5], test = "subste of row annotation")
> 
> anno = anno_simple(1:10, col = structure(rand_color(10), names = 1:10))
> draw(anno, test = "self-define colors")
> 
> anno = anno_simple(1:10, border = TRUE)
> draw(anno, test = "border")
> anno = anno_simple(1:10, gp = gpar(col = "red"))
> draw(anno, test = "gp for the grids")
> 
> anno = anno_simple(c(1:9, NA))
> draw(anno, test = "vector has NA values")
> 
> anno = anno_simple(cbind(1:10, 10:1))
> draw(anno, test = "a matrix")
> draw(anno[1:5], test = "subste of a matrix")
> 
> anno = anno_simple(1:10, pch = 1, pt_gp = gpar(col = "red"), pt_size = unit(seq(1, 10), "mm"))
> draw(anno, test = "with symbols + pt_gp + pt_size")
> anno = anno_simple(1:10, pch = 1:10)
> draw(anno, test = "pch is a vector")
> anno = anno_simple(1:10, pch = c(1:4, NA, 6:8, NA, 10, 11))
> draw(anno, test = "pch has NA values")
> 
> anno = anno_simple(cbind(1:10, 10:1), pch = 1, pt_gp = gpar(col = "blue"))
> draw(anno, test = "matrix with symbols")
> anno = anno_simple(cbind(1:10, 10:1), pch = 1:2)
> draw(anno, test = "matrix, length of pch is number of annotations")
> anno = anno_simple(cbind(1:10, 10:1), pch = 1:10)
> draw(anno, test = "matrix, length of pch is length of samples")
> anno = anno_simple(cbind(1:10, 10:1), pch = matrix(1:20, nc = 2))
> draw(anno, test = "matrix, pch is a matrix")
> pch = matrix(1:20, nc = 2)
> pch[sample(length(pch), 10)] = NA
> anno = anno_simple(cbind(1:10, 10:1), pch = pch)
> draw(anno, test = "matrix, pch is a matrix with NA values")
> 
> 
> ####### test anno_empty ######
> anno = anno_empty()
> draw(anno, test = "anno_empty")
> anno = anno_empty(border = FALSE)
> draw(anno, test = "anno_empty without border")
> 
> if(0) {
+ ###### test anno_image #####
+ image1 = sample(dir("~/Downloads/IcoMoon-Free-master/PNG/64px", full.names = TRUE), 10)
+ anno = anno_image(image1)
+ draw(anno, test = "png")
+ draw(anno[1:5], test = "subset of png")
+ anno = anno_image(image1, which = "row")
+ draw(anno, test = "png on rows")
+ image2 = sample(dir("~/Downloads/IcoMoon-Free-master/SVG/", full.names = TRUE), 10)
+ anno = anno_image(image2)
+ draw(anno, test = "svg")
+ image3 = sample(dir("~/Downloads/IcoMoon-Free-master/EPS/", full.names = TRUE), 10)
+ anno = anno_image(image3)
+ draw(anno, test = "eps")
+ image4 = sample(dir("~/Downloads/IcoMoon-Free-master/PDF/", full.names = TRUE), 10)
+ anno = anno_image(image4)
+ draw(anno, test = "pdf")
+ 
+ anno = anno_image(c(image1[1:3], image2[1:3], image3[1:3], image4[1:3]))
+ draw(anno, test = "png+svg+eps+pdf")
+ 
+ anno = anno_image(image1, gp = gpar(fill = 1:10, col = "black"))
+ draw(anno, test = "png + gp")
+ draw(anno[1:5], test = "png + gp")
+ 
+ anno = anno_image(image1, space = unit(3, "mm"))
+ draw(anno, test = "space")
+ 
+ image1[1] = ""
+ anno = anno_image(image1)
+ draw(anno, test = "png")
+ }
> 
> ######## test anno_points #####
> anno = anno_points(runif(10))
> draw(anno, test = "anno_points")
> anno = anno_points(matrix(runif(20), nc = 2), pch = 1:2)
> draw(anno, test = "matrix")
> anno = anno_points(c(1:5, 1:5))
> draw(anno, test = "anno_points")
> anno = anno_points(cbind(c(1:5, 1:5), c(5:1, 5:1)), gp = gpar(col = 2:3))
> draw(anno, test = "matrix")
> 
> anno = anno_points(1:10, gp = gpar(col = rep(2:3, each = 5)), pch = rep(2:3, each = 5))
> draw(anno, test = "anno_points")
> draw(anno, index = c(1, 3, 5, 7, 9, 2, 4, 6, 8, 10), test = "anno_points")
> 
> anno = anno_points(c(1:5, NA, 7:10))
> draw(anno, test = "anno_points")
> 
> 
> anno = anno_points(runif(10), axis_param = list(direction = "reverse"), ylim = c(0, 1))
> draw(anno, test = "anno_points")
> 
> anno = anno_points(runif(10), axis_param = list(direction = "reverse"), ylim = c(0, 1), which = "row")
> draw(anno, test = "anno_points")
> 
> # pch as image
> if(0) {
+ image1 = sample(dir("/desktop-home/guz/Downloads/IcoMoon-Free-master/PNG/64px", full.names = TRUE), 10)
+ x = runif(10)
+ anno1 = anno_points(x, pch = image1, pch_as_image = TRUE, size = unit(5, "mm"), height = unit(4, "cm"))
+ anno2 = anno_points(x, height = unit(4, "cm"))
+ draw(anno1, test = "anno_points")
+ draw(anno2, test = "anno_points")
+ }
> 
> ##### test anno_lines ###
> anno = anno_lines(runif(10))
> draw(anno, test = "anno_lines")
> anno = anno_lines(cbind(c(1:5, 1:5), c(5:1, 5:1)), gp = gpar(col = 2:3))
> draw(anno, test = "matrix")
> anno = anno_lines(cbind(c(1:5, 1:5), c(5:1, 5:1)), gp = gpar(col = 2:3),
+ 	add_points = TRUE, pt_gp = gpar(col = 5:6), pch = c(1, 16))
> draw(anno, test = "matrix")
> anno = anno_lines(sort(rnorm(10)), height = unit(2, "cm"), smooth = TRUE, add_points = TRUE)
> draw(anno, test = "anno_lines, smooth")
> anno = anno_lines(cbind(sort(rnorm(10)), sort(rnorm(10), decreasing = TRUE)), 
+ 	height = unit(2, "cm"), smooth = TRUE, add_points = TRUE, gp = gpar(col = 2:3))
> draw(anno, test = "anno_lines, smooth, matrix")
> 
> anno = anno_lines(sort(rnorm(10)), width = unit(2, "cm"), smooth = TRUE, add_points = TRUE, which = "row")
> draw(anno, test = "anno_lines, smooth, by row")
> anno = anno_lines(cbind(sort(rnorm(10)), sort(rnorm(10), decreasing = TRUE)), 
+ 	width = unit(2, "cm"), smooth = TRUE, add_points = TRUE, gp = gpar(col = 2:3), which = "row")
> draw(anno, test = "anno_lines, smooth, matrix, by row")
> 
> anno = anno_lines(c(1:5, NA, 7:10))
> draw(anno, test = "anno_lines")
> 
> anno = anno_lines(runif(10), axis_param = list(direction = "reverse"))
> draw(anno, test = "anno_lines")
> 
> ###### test anno_text #######
> 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")
> draw(anno, test = "month names on rows")
> anno = anno_text(month.name, location = 0, rot = 45, just = "left", gp = gpar(col = 1:12))
> draw(anno, test = "with rotations")
> anno = anno_text(month.name, location = 1, rot = 45, just = "right", gp = gpar(fontsize = 1:12+4))
> draw(anno, test = "with rotations")
> 
> 
> for(rot in seq(0, 360, by = 45)) {
+ 	anno = anno_text(month.name, which = "row", location = 0, rot = rot, 
+ 		just = "left")
+ 	draw(anno, test = paste0("rot =", rot))
+ }
> 
> 
> ##### test anno_barplot #####
> anno = anno_barplot(1:10)
> draw(anno, test = "a vector")
> draw(anno[1:5], test = "a vector, subset")
> anno = anno_barplot(1:10, which = "row")
> draw(anno, test = "a vector")
> anno = anno_barplot(1:10, bar_width = 1)
> draw(anno, test = "bar_width")
> anno = anno_barplot(1:10, gp = gpar(fill = 1:10))
> draw(anno, test = "fill colors")
> 
> anno = anno_barplot(matrix(nc = 2, c(1:10, 10:1)))
> draw(anno, test = "a matrix")
> draw(anno[1:5], test = "a matrix, subset")
> anno = anno_barplot(matrix(nc = 2, c(1:10, 10:1)), which = "row")
> draw(anno, test = "a matrix, on rows")
> anno = anno_barplot(matrix(nc = 2, c(1:10, 10:1)), gp = gpar(fill = 2:3, col = 2:3))
> draw(anno, test = "a matrix with fill")
> 
> m = matrix(runif(4*10), nc = 4)
> m = t(apply(m, 1, function(x) x/sum(x)))
> anno = anno_barplot(m)
> draw(anno, test = "proportion matrix")
> anno = anno_barplot(m, gp = gpar(fill = 2:5), bar_width = 1, height = unit(6, "cm"))
> draw(anno, test = "proportion matrix")
> 
> anno = anno_barplot(c(1:5, NA, 7:10))
> draw(anno, test = "a vector")
> 
> anno = anno_barplot(1:10, which = "row", axis_param = list(direction = "reverse"))
> draw(anno, test = "a vector")
> 
> anno = anno_barplot(1:10, baseline = 5, which = "row", axis_param = list(direction = "reverse"))
> draw(anno, test = "a vector")
> 
> anno = anno_barplot(matrix(nc = 2, c(1:10, 10:1)), which = "row", axis_param = list(direction = "reverse"))
> draw(anno, test = "a vector")
> 
> 
> ##### test anno_boxplot #####
> set.seed(123)
> m = matrix(rnorm(100), 10)
> anno = anno_boxplot(m, height = unit(4, "cm"))
> draw(anno, test = "anno_boxplot")
> draw(anno[1:5], test = "subset")
> anno = anno_boxplot(m, height = unit(4, "cm"), gp = gpar(fill = 1:10))
> draw(anno, test = "anno_boxplot with gp")
> anno = anno_boxplot(m, height = unit(4, "cm"), box_width = 0.9)
> draw(anno, test = "anno_boxplot with box_width")
> 
> m = matrix(rnorm(100), 10)
> m[1, ] = NA
> anno = anno_boxplot(m, height = unit(4, "cm"))
> draw(anno, test = "anno_boxplot")
> 
> 
> ####### test anno_joyplot ####
> m = matrix(rnorm(1000), nc = 10)
> lt = apply(m, 2, function(x) data.frame(density(x)[c("x", "y")]))
> anno = anno_joyplot(lt, width = unit(4, "cm"), which = "row")
> draw(anno, test = "joyplot")
> anno = anno_joyplot(lt, width = unit(4, "cm"), which = "row", gp = gpar(fill = 1:10))
> draw(anno, test = "joyplot + col")
> anno = anno_joyplot(lt, width = unit(4, "cm"), which = "row", scale = 1)
> draw(anno, test = "joyplot + scale")
> 
> m = matrix(rnorm(5000), nc = 50)
> lt = apply(m, 2, function(x) data.frame(density(x)[c("x", "y")]))
> anno = anno_joyplot(lt, width = unit(4, "cm"), which = "row", gp = gpar(fill = NA), scale = 4)
> draw(anno, test = "joyplot")
> 
> ######## test anno_horizon ######
> lt = lapply(1:20, function(x) cumprod(1 + runif(1000, -x/100, x/100)) - 1)
> anno = anno_horizon(lt, which = "row")
> draw(anno, test = "horizon chart")
> anno = anno_horizon(lt, which = "row", gp = gpar(pos_fill = "orange", neg_fill = "darkgreen"))
> draw(anno, test = "horizon chart, col")
> anno = anno_horizon(lt, which = "row", negative_from_top = TRUE)
> draw(anno, test = "horizon chart + negative_from_top")
> anno = anno_horizon(lt, which = "row", gap = unit(1, "mm"))
> draw(anno, test = "horizon chart + gap")
> anno = anno_horizon(lt, which = "row", gp = gpar(pos_fill = rep(c("orange", "red"), each = 10),
+ 	neg_fill = rep(c("darkgreen", "blue"), each = 10)))
> draw(anno, test = "horizon chart, col")
> 
> ####### test anno_histogram ####
> m = matrix(rnorm(1000), nc = 10)
> anno = anno_histogram(t(m), which = "row")
> draw(anno, test = "row histogram")
> draw(anno[1:5], test = "subset 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")
> m[1, ] = NA
> anno = anno_histogram(t(m), which = "row")
> draw(anno, test = "row histogram")
> 
> 
> ####### test anno_density ######
> anno = anno_density(t(m), which = "row")
> draw(anno, test = "normal density")
> draw(anno[1:5], test = "normal density, subset")
> anno = anno_density(t(m), which = "row", type = "violin")
> draw(anno, test = "violin")
> anno = anno_density(t(m), which = "row", type = "heatmap")
> draw(anno, test = "heatmap")
> anno = anno_density(t(m), which = "row", type = "heatmap", heatmap_colors = c("white", "orange"))
> draw(anno, test = "heatmap, colors")
> 
> 
> ###### anno_mark ###
> if(0) {
+ library(gridtext)
+ grid.text = function(text, x = 0.5, y = 0.5, gp = gpar(), rot = 0, default.units = "npc", just = "center") {
+ 	if(length(just) == 1) {
+ 		if(just == "center") {
+ 			just = c("center", "center")
+ 		} else if(just == "bottom") {
+ 			just = c("center", "bottom")
+ 		} else if (just == "top") {
+ 			just = c("center", "top")
+ 		} else if(just == "left") {
+ 			just = c("left", "center")
+ 		} else if(just == "right") {
+ 			just = c("right", "center")
+ 		}
+ 	}
+ 	just2 = c(0.5, 0.5)
+ 	if(is.character(just)) {
+ 		just2[1] = switch(just[1], "center" = 0.5, "left" = 0, "right" = 1)
+ 		just2[2] = switch(just[2], "center" = 0.5, "bottom" = 0, "top" = 1)
+ 	}
+ 	gb = richtext_grob(text, x = x, y = y, gp = gpar(fontsize = 10), box_gp = gpar(col = "black"),
+ 		default.units = default.units, hjust = just2[1], vjust = just2[2], rot = rot)
+ 	grid.draw(gb)
+ }
+ }
> anno = anno_mark(at = c(1:4, 20, 60, 97:100), labels = month.name[1:10], which = "row")
> draw(anno, index = 1:100, test = "anno_mark")
> 
> anno = anno_mark(at = c(1:4, 20, 60, 97:100), labels = month.name[1:10], labels_rot = 30, which = "column")
> draw(anno, index = 1:100, test = "anno_mark")
> 
> m = matrix(1:1000, byrow = TRUE, nr = 100)
> anno = anno_mark(at = c(1:4, 20, 60, 97:100), labels = month.name[1:10], which = "row", labels_rot = 30)
> Heatmap(m, cluster_rows = F, cluster_columns = F) + rowAnnotation(mark = anno)
> Heatmap(m) + rowAnnotation(mark = anno)
> 
> ht_list = Heatmap(m, cluster_rows = F, cluster_columns = F) + rowAnnotation(mark = anno)
> draw(ht_list, row_split = c(rep("a", 95), rep("b", 5)))
> 
> 
> grid.newpage()
> pushViewport(viewport(x = 0.45, w = 0.7, h = 0.95))
> h = unit(0, "mm")
> for(rot in seq(0, 360, by = 30)[-13]) {
+ 	anno = anno_mark(at = c(1:4, 20, 60, 97:100), labels = strrep(letters[1:10], 4), labels_rot = rot, which = "column", side = "bottom")
+ 	h = h + height(anno)
+ 	pushViewport(viewport(y = h, height = height(anno), just = "top"))
+ 	grid.rect()
+ 	draw(anno, index = 1:100)
+ 	grid::grid.text(qq("labels_rot = @{rot}"), unit(1, "npc") + unit(2, "mm"), just = "left")
+ 	popViewport()
+ }
> 
> 
> grid.newpage()
> pushViewport(viewport(w = 0.9, h = 0.9))
> w = unit(0, "mm")
> for(rot in seq(0, 360, by = 30)) {
+ 	anno = anno_mark(at = c(1:4, 20, 60, 97:100), labels = strrep(letters[1:10], 4), labels_rot = rot, which = "row", side = "left")
+ 	w = w + width(anno)
+ 	pushViewport(viewport(x = w, width = width(anno), just = "right"))
+ 	grid.rect()
+ 	draw(anno, index = 1:100)
+ 	popViewport()
+ }
> 
> 
> 
> ### graphic parameters after reordering
> index = c(1, 3, 5, 7, 9, 2, 4, 6, 8, 10)
> anno = anno_simple(1:10, pch = 1:10, pt_gp = gpar(col = rep(c(1, 2), each = 5)),
+ 	pt_size = unit(1:10, "mm"))
> draw(anno, index, test = "a numeric vector")
> anno = anno_simple(1:10, pch = 1:10, pt_gp = gpar(col = rep(c(1, 2), each = 5)),
+ 	pt_size = unit(1:10, "mm"), which = "row")
> draw(anno, index, test = "a numeric vector")
> 
> 
> anno = anno_points(1:10, pch = 1:10, gp = gpar(col = rep(c(1, 2), each = 5)),
+ 	size = unit(1:10, "mm"))
> draw(anno, index, test = "a numeric vector")
> anno = anno_points(1:10, pch = 1:10, gp = gpar(col = rep(c(1, 2), each = 5)),
+ 	size = unit(1:10, "mm"), which = "row")
> draw(anno, index, test = "a numeric vector")
> 
> 
> anno = anno_lines(sort(runif(10)), pch = 1:10, pt_gp = gpar(col = rep(c(1, 2), each = 5)),
+ 	size = unit(1:10, "mm"), add_points = TRUE)
> draw(anno, index, test = "a numeric vector")
> anno = anno_lines(sort(runif(10)), pch = 1:10, pt_gp = gpar(col = rep(c(1, 2), each = 5)),
+ 	size = unit(1:10, "mm"), add_points = TRUE, which = "row")
> draw(anno, index, test = "a numeric vector")
> 
> 
> anno = anno_barplot(1:10, gp = gpar(fill = rep(c(1, 2), each = 5)))
> draw(anno, index, test = "a numeric vector")
> anno = anno_barplot(1:10, gp = gpar(fill = rep(c(1, 2), each = 5)), which = "row")
> draw(anno, index, test = "a numeric vector")
> 
> anno = anno_barplot(cbind(1:10, 10:1), gp = gpar(fill = 1:2))
> draw(anno, index, test = "a numeric vector")
> anno = anno_barplot(cbind(1:10, 10:1), gp = gpar(fill = 1:2), which = "row")
> draw(anno, index, test = "a numeric vector")
> 
> 
> m = matrix(rnorm(100), 10)
> m = m[, order(apply(m, 2, median))]
> anno = anno_boxplot(m, pch = 1:10, gp = gpar(fill = rep(c(1, 2), each = 5)),
+ 	size = unit(1:10, "mm"), height = unit(4, "cm"))
> draw(anno, index, test = "a numeric vector")
> anno = anno_boxplot(t(m), pch = 1:10, gp = gpar(fill = rep(c(1, 2), each = 5)),
+ 	size = unit(1:10, "mm"), which = "row", width = unit(4, "cm"))
> draw(anno, index, test = "a numeric vector")
> 
> anno = anno_histogram(m, gp = gpar(fill = rep(c(1, 2), each = 5)))
> draw(anno, index, test = "a numeric vector")
> anno = anno_histogram(t(m), gp = gpar(fill = rep(c(1, 2), each = 5)), which = "row")
> draw(anno, index, test = "a numeric vector")
> 
> anno = anno_density(m, gp = gpar(fill = rep(c(1, 2), each = 5)))
> draw(anno, index, test = "a numeric vector")
> anno = anno_density(t(m), gp = gpar(fill = rep(c(1, 2), each = 5)), which = "row")
> draw(anno, index, test = "a numeric vector")
> 
> 
> anno = anno_density(m, type = "violin", gp = gpar(fill = rep(c(1, 2), each = 5)))
> draw(anno, index, test = "a numeric vector")
> anno = anno_density(t(m), type = "violin", gp = gpar(fill = rep(c(1, 2), each = 5)), which = "row")
> draw(anno, index, test = "a numeric vector")
> 
> 
> anno = anno_text(month.name, gp = gpar(col = rep(c(1, 2), each = 5)))
> draw(anno, index, test = "a numeric vector")
> anno = anno_text(month.name, gp = gpar(col = rep(c(1, 2), each = 5)), which= "row")
> draw(anno, index, test = "a numeric vector")
> 
> lt = lapply(1:10, function(x) cumprod(1 + runif(1000, -x/100, x/100)) - 1)
> anno = anno_horizon(lt, gp = gpar(pos_fill = rep(c(1, 2), each = 5), neg_fill = rep(c(3, 4), each = 5)), which = "row")
> draw(anno, index, test = "a numeric vector")
> 
> m = matrix(rnorm(1000), nc = 10)
> lt = apply(m, 2, function(x) data.frame(density(x)[c("x", "y")]))
> anno = anno_joyplot(lt, gp = gpar(fill = rep(c(1, 2), each = 5)), 
+ 	width = unit(4, "cm"), which = "row")
> draw(anno, index, test = "joyplot")
> 
> 
> anno = anno_block(gp = gpar(fill = 1:4))
> draw(anno, index = 1:10, k = 1, n = 4, test = "anno_block")
> draw(anno, index = 1:10, k = 2, n = 4, test = "anno_block")
> 
> anno = anno_block(gp = gpar(fill = 1:4), labels = letters[1:4], labels_gp = gpar(col = "white"))
> draw(anno, index = 1:10, k = 2, n = 4, test = "anno_block")
> draw(anno, index = 1:10, k = 4, n = 4, test = "anno_block")
> # draw(anno, index = 1:10, k = 2, n = 2, test = "anno_block")
> 
> anno = anno_block(gp = gpar(fill = 1:4), labels = letters[1:4], labels_gp = gpar(col = "white"), which = "row")
> draw(anno, index = 1:10, k = 2, n = 4, test = "anno_block")
> 
> 
> ### anno_zoom
> fa = sort(sample(letters[1:3], 100, replace = TRUE, prob = c(1, 2, 3)))
> panel_fun = function(index, nm) {
+ 	grid.rect()
+ 	grid.text(nm)
+ }
> anno = anno_zoom(align_to = fa, which = "row", panel_fun = panel_fun)
> draw(anno, index = 1:100, test = "anno_zoom")
> 
> anno = anno_zoom(align_to = list(a = which(fa == "a")), which = "row", panel_fun = panel_fun)
> draw(anno, index = 1:100, test = "anno_zoom")
> 
> 
> panel_fun = function(index, nm) {
+ 	grid.rect(gp = gpar(fill = "grey", col = NA))
+ 	grid.text(nm)
+ }
> 
> anno = anno_zoom(align_to = fa, which = "row", panel_fun = panel_fun, link_gp = gpar(fill = "grey", col = "black"), internal_line = FALSE)
> draw(anno, index = 1:100, test = "anno_zoom")
> 
> 
> anno = anno_zoom(align_to = fa, which = "row", panel_fun = panel_fun,
+ 	gap = unit(1, "cm"))
> draw(anno, index = 1:100, test = "anno_zoom, set gap")
> 
> anno = anno_zoom(align_to = fa, which = "row", panel_fun = panel_fun,
+ 	size = 1:3)
> draw(anno, index = 1:100, test = "anno_zoom, size set as relative values")
> 
> anno = anno_zoom(align_to = fa, which = "row", panel_fun = panel_fun,
+ 	size = 1:3, extend = unit(1, "cm"))
> draw(anno, index = 1:100, test = "anno_zoom, extend")
> 
> anno = anno_zoom(align_to = fa, which = "row", panel_fun = panel_fun,
+ 	size = unit(1:3, "cm"))
> draw(anno, index = 1:100, test = "anno_zoom, size set as absolute values")
> 
> anno = anno_zoom(align_to = fa, which = "row", panel_fun = panel_fun,
+ 	size = unit(c(2, 20, 40), "cm"))
> draw(anno, index = 1:100, test = "anno_zoom, big size")
> 
> anno = anno_zoom(align_to = fa, which = "row", panel_fun = panel_fun,
+ 	size = 1:3, gap = unit(1, "cm"))
> draw(anno, index = 1:100, test = "anno_zoom, size set as relative values, gap")
> 
> anno = anno_zoom(align_to = fa, which = "row", panel_fun = panel_fun,
+ 	size = unit(1:3, "cm"), gap = unit(1, "cm"))
> draw(anno, index = 1:100, test = "anno_zoom, size set as absolute values, gap")
> 
> 
> anno = anno_zoom(align_to = fa, which = "row", panel_fun = panel_fun,
+ 	size = unit(1:3, "cm"), side = "left")
> draw(anno, index = 1:100, test = "anno_zoom, side")
> 
> 
> anno = anno_zoom(align_to = fa, which = "row", panel_fun = panel_fun,
+ 	size = unit(1:3, "cm"), link_gp = gpar(fill = 1:3))
> draw(anno, index = 1:100, test = "anno_zoom, link_gp")
> 
> anno = anno_zoom(align_to = fa, which = "row", panel_fun = panel_fun,
+ 	size = unit(1:3, "cm"), link_gp = gpar(fill = 1:3),
+ 	link_width = unit(2, "cm"), width = unit(4, "cm"))
> draw(anno, index = 1:100, test = "anno_zoom, width")
> 
> anno = anno_zoom(align_to = list(a = 1:10, b = 30:45, c = 70:90), 
+ 	which = "row", panel_fun = panel_fun, size = unit(1:3, "cm"))
> draw(anno, index = 1:100, test = "anno_zoom, a list of indices")
> 
> anno = anno_zoom(align_to = fa, which = "column", panel_fun = panel_fun,
+ 	size = unit(1:3, "cm"))
> draw(anno, index = 1:100, test = "anno_zoom, column annotation")
> 
> 
> m = matrix(rnorm(100*10), nrow = 100)
> hc = hclust(dist(m))
> fa2 = cutree(hc, k = 4)
> anno = anno_zoom(align_to = fa2, which = "row", panel_fun = panel_fun)
> draw(anno, index = hc$order, test = "anno_zoom, column annotation")
> 
> anno = anno_zoom(align_to = fa2, which = "column", panel_fun = panel_fun)
> draw(anno, index = hc$order, test = "anno_zoom, column annotation")
> 
> 
> anno = anno_zoom(align_to = fa2, which = "row", panel_fun = panel_fun)
> draw(Heatmap(m, cluster_rows = hc, right_annotation = rowAnnotation(foo = anno)))
> draw(Heatmap(m, cluster_rows = hc, right_annotation = rowAnnotation(foo = anno), row_split = 2))
> 
> 
> anno = anno_zoom(align_to = fa2, which = "row", panel_fun = panel_fun, size = unit(1:4, "cm"))
> draw(Heatmap(m, cluster_rows = hc, right_annotation = rowAnnotation(foo = anno)))
> 
> set.seed(123)
> m = matrix(rnorm(100*10), nrow = 100)
> subgroup = sample(letters[1:3], 100, replace = TRUE, prob = c(1, 5, 10))
> rg = range(m)
> panel_fun = function(index, nm) {
+ 	pushViewport(viewport(xscale = rg, yscale = c(0, 2)))
+ 	grid.rect()
+ 	grid.xaxis(gp = gpar(fontsize = 8))
+ 	grid.boxplot(m[index, ], pos = 1, direction = "horizontal")
+ 	grid.text(paste("distribution of group", nm), mean(rg), y = 1.9, 
+ 		just = "top", default.units = "native", gp = gpar(fontsize = 10))
+ 	popViewport()
+ }
> anno = anno_zoom(align_to = subgroup, which = "row", panel_fun = panel_fun, 
+ 	size = unit(2, "cm"), gap = unit(1, "cm"), width = unit(4, "cm"))
> draw(Heatmap(m, right_annotation = rowAnnotation(foo = anno), row_split = subgroup))
> 
> panel_fun2 = function(index, nm) {
+ 	pushViewport(viewport())
+ 	grid.rect()
+ 	n = floor(length(index)/4)
+ 	txt = paste("gene function", 1:n, collapse = "\n")
+ 	grid.text(txt, 0.95, 0.5, default.units = "npc", just = "right", gp = gpar(fontsize = 8))
+ 	popViewport()
+ }
> anno2 = anno_zoom(align_to = subgroup, which = "row", panel_fun = panel_fun2, 
+ 	gap = unit(1, "cm"), width = unit(3, "cm"), side = "left")
> 
> draw(Heatmap(m, right_annotation = rowAnnotation(subgroup = subgroup, foo = anno,
+ 	show_annotation_name = FALSE), 
+ 	left_annotation = rowAnnotation(bar = anno2, subgroup = subgroup, show_annotation_name = FALSE),
+ 	show_row_dend = FALSE,
+ 	row_split = subgroup))
> 
> draw(Heatmap(m, right_annotation = rowAnnotation(foo = anno), 
+ 	left_annotation = rowAnnotation(bar = anno2),
+ 	show_row_dend = FALSE,
+ 	row_split = subgroup))
> 
> set.seed(12345)
> mat = matrix(rnorm(30*10), nr = 30)
> row_split = c(rep("a", 10), rep("b", 5), rep("c", 2), rep("d", 3), 
+ 	          rep("e", 2), letters[10:17])
> row_split = factor(row_split)
> 
> panel_fun = function(index, name) {
+ 	pushViewport(viewport())
+ 	grid.rect()
+ 	grid.text(name)
+ 	popViewport()
+ }
> 
> anno = anno_zoom(align_to = row_split, which = "row", panel_fun = panel_fun, 
+ 	size = unit(0.5, "cm"), width = unit(4, "cm"))
> 
> # > dev.size()
> # [1] 3.938326 4.502203
> dev.new(width = 3.938326, height = 4.502203)
dev.new(): using pdf(file="Rplots1.pdf")
> draw(Heatmap(mat, right_annotation = rowAnnotation(foo = anno), 
+ 	row_split = row_split))
> 
> 
> proc.time()
   user  system elapsed 
 20.356   0.171  20.518 

ComplexHeatmap.Rcheck/tests/test-ColorMapping-class.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(circlize)
========================================
circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> library(GetoptLong)
> 
> cm = ColorMapping(name = "test",
+ 	colors = c("blue", "white", "red"),
+ 	levels = c("a", "b", "c"))
> color_mapping_legend(cm)
> 
> cm = ColorMapping(name = "test",
+ 	col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red")))
> color_mapping_legend(cm)
> 
> cm = ColorMapping(name = "test",
+ 	colors = c("blue", "white", "red"),
+ 	levels = c(1, 2, 3))
> color_mapping_legend(cm)
> 
> proc.time()
   user  system elapsed 
  0.740   0.061   0.788 

ComplexHeatmap.Rcheck/tests/test-dendrogram.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(circlize)
========================================
circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> library(GetoptLong)
> 
> if(!exists("cut_dendrogram")) {
+ 	cut_dendrogram = ComplexHeatmap:::cut_dendrogram
+ }
> 
> library(dendextend)

---------------------
Welcome to dendextend version 1.14.0
Type citation('dendextend') for how to cite the package.

Type browseVignettes(package = 'dendextend') for the package vignette.
The github page is: https://github.com/talgalili/dendextend/

Suggestions and bug-reports can be submitted at: https://github.com/talgalili/dendextend/issues
Or contact: <tal.galili@gmail.com>

	To suppress this message use:  suppressPackageStartupMessages(library(dendextend))
---------------------


Attaching package: 'dendextend'

The following object is masked from 'package:stats':

    cutree

> 
> m = matrix(rnorm(100), 10)
> dend1 = as.dendrogram(hclust(dist(m)))
> dend1 = adjust_dend_by_x(dend1, sort(runif(10)))
> 
> m = matrix(rnorm(50), nr = 5)
> dend2 = as.dendrogram(hclust(dist(m)))
> 
> dend3 = as.dendrogram(hclust(dist(m[1:2, ])))
> 
> 
> dend_merge = merge_dendrogram(dend3, 
+ 	list(set(dend1, "branches_col", "red"), 
+ 		 set(dend2, "branches_col", "blue"))
+ )
> 
> grid.dendrogram(dend_merge, test = TRUE, facing = "bottom")
> grid.dendrogram(dend_merge, test = TRUE, facing = "top")
> grid.dendrogram(dend_merge, test = TRUE, facing = "left")
> grid.dendrogram(dend_merge, test = TRUE, facing = "right")
> 
> grid.dendrogram(dend_merge, test = TRUE, facing = "bottom", order = "reverse")
> grid.dendrogram(dend_merge, test = TRUE, facing = "top", order = "reverse")
> grid.dendrogram(dend_merge, test = TRUE, facing = "left", order = "reverse")
> grid.dendrogram(dend_merge, test = TRUE, facing = "right", order = "reverse")
> 
> 
> m = matrix(rnorm(100), 10)
> dend1 = as.dendrogram(hclust(dist(m)))
> dend1 = adjust_dend_by_x(dend1, unit(1:10, "cm"))
> grid.dendrogram(dend1, test = TRUE)
> 
> dl = cut_dendrogram(dend1, k = 3)
> grid.dendrogram(dl$upper, test = TRUE)
> 
> 
> 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 = T)
> 
> dend_m = merge_dendrogram(dend_p, list(dend1, dend2, dend3), only_parent = TRUE)
> grid.dendrogram(dend_m, test = T)
> 
> 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 = T)
> 
> 
> 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)
> 
> 
> # #  stack overflow problem
> # m = matrix(1, nrow = 1000, ncol = 10)
> # m[1, 2] = 2
> # dend = as.dendrogram(hclust(dist(m)))
> # grid.dendrogram(dend, test = T)
> 
> 
> proc.time()
   user  system elapsed 
  1.944   0.097   2.026 

ComplexHeatmap.Rcheck/tests/test-gridtext.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> 
> if(requireNamespace("gridtext")) {
+ ##### test anno_richtext ####
+ mat = matrix(rnorm(100), 10)
+ rownames(mat) = letters[1:10]
+ ht = Heatmap(mat, 
+ 	column_title = gt_render("Some <span style='color:blue'>blue text **in bold.**</span><br>And *italics text.*<br>And some <span style='font-size:18pt; color:black'>large</span> text.", r = unit(2, "pt"), padding = unit(c(2, 2, 2, 2), "pt")),
+ 	column_title_gp = gpar(box_fill = "orange"),
+ 	row_labels = gt_render(letters[1:10], padding = unit(c(2, 10, 2, 10), "pt")),
+ 	row_names_gp = gpar(box_col = rep(2:3, times = 5), box_fill = ifelse(1:10%%2, "yellow", "white")),
+ 	row_km = 2, 
+ 	row_title = gt_render(c("title1", "title2")), 
+ 	row_title_gp = gpar(box_fill = "yellow"),
+ 	heatmap_legend_param = list(
+ 		title = gt_render("<span style='color:orange'>**Legend title**</span>"), 
+ 		title_gp = gpar(box_fill = "grey"),
+ 		at = c(-3, 0, 3), 
+ 		labels = gt_render(c("*negative* three", "zero", "*positive* three"))
+ 	))
+ ht = rowAnnotation(
+ 	foo = anno_text(gt_render(sapply(LETTERS[1:10], strrep, 10), align_widths = TRUE), 
+ 	                gp = gpar(box_col = "blue", box_lwd = 2), 
+ 	                just = "right", 
+ 	                location = unit(1, "npc")
+ 	)) + ht
+ draw(ht)
+ 
+ }
Loading required namespace: gridtext
> 
> proc.time()
   user  system elapsed 
  2.998   0.102   3.085 

ComplexHeatmap.Rcheck/tests/test-Heatmap-class.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(circlize)
========================================
circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> library(GetoptLong)
> 
> set.seed(123)
> nr1 = 10; nr2 = 8; nr3 = 6
> nc1 = 6; nc2 = 8; nc3 = 10
> mat = cbind(rbind(matrix(rnorm(nr1*nc1, mean = 1,   sd = 0.5), nr = nr1),
+           matrix(rnorm(nr2*nc1, mean = 0,   sd = 0.5), nr = nr2),
+           matrix(rnorm(nr3*nc1, mean = 0,   sd = 0.5), nr = nr3)),
+     rbind(matrix(rnorm(nr1*nc2, mean = 0,   sd = 0.5), nr = nr1),
+           matrix(rnorm(nr2*nc2, mean = 1,   sd = 0.5), nr = nr2),
+           matrix(rnorm(nr3*nc2, mean = 0,   sd = 0.5), nr = nr3)),
+     rbind(matrix(rnorm(nr1*nc3, mean = 0.5, sd = 0.5), nr = nr1),
+           matrix(rnorm(nr2*nc3, mean = 0.5, sd = 0.5), nr = nr2),
+           matrix(rnorm(nr3*nc3, mean = 1,   sd = 0.5), nr = nr3))
+    )
> 
> rownames(mat) = paste0("row", seq_len(nrow(mat)))
> colnames(mat) = paste0("column", seq_len(nrow(mat)))
> 
> ht = Heatmap(mat)
> draw(ht, test = TRUE)
> ht
> 
> 
> ht = Heatmap(mat, col = colorRamp2(c(-3, 0, 3), c("green", "white", "red")))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, name = "test")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, rect_gp = gpar(col = "black"))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, border = "red")
> draw(ht, test = TRUE)
> 
> ######## test title ##########
> ht = Heatmap(mat, row_title = "blablabla")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_title = "blablabla", row_title_side = "right")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_title = "blablabla", row_title_gp = gpar(fontsize = 20, font = 2))
> draw(ht, test = TRUE)
> 
> # ht = Heatmap(mat, row_title = "blablabla", row_title_rot = 45)
> # draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_title = "blablabla", row_title_rot = 0)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_title = "blablabla", row_title_gp = gpar(fill = "red", col = "white"))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_title = "blablabla")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_title = "blablabla", column_title_side = "bottom")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_title = "blablabla", column_title_gp = gpar(fontsize = 20, font = 2))
> draw(ht, test = TRUE)
> 
> # ht = Heatmap(mat, column_title = "blablabla", column_title_rot = 45)
> # draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_title = "blablabla", column_title_rot = 90)
> draw(ht, test = TRUE)
> 
> 
> ### test clustering ####
> 
> ht = Heatmap(mat, cluster_rows = FALSE)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, clustering_distance_rows = "pearson")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, clustering_distance_rows = function(x) dist(x))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, clustering_distance_rows = function(x, y) 1 - cor(x, y))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, clustering_method_rows = "single")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_dend_side = "right")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_dend_width = unit(4, "cm"))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_dend_gp = gpar(lwd = 2, col = "red"))
> draw(ht, test = TRUE)
> 
> dend = as.dendrogram(hclust(dist(mat)))
> ht = Heatmap(mat, cluster_rows = dend)
> draw(ht, test = TRUE)
> 
> library(dendextend)

---------------------
Welcome to dendextend version 1.14.0
Type citation('dendextend') for how to cite the package.

Type browseVignettes(package = 'dendextend') for the package vignette.
The github page is: https://github.com/talgalili/dendextend/

Suggestions and bug-reports can be submitted at: https://github.com/talgalili/dendextend/issues
Or contact: <tal.galili@gmail.com>

	To suppress this message use:  suppressPackageStartupMessages(library(dendextend))
---------------------


Attaching package: 'dendextend'

The following object is masked from 'package:stats':

    cutree

> dend = color_branches(dend, k = 3)
> ht = Heatmap(mat, cluster_rows = dend)
> draw(ht, test = TRUE)
> 
> 
> ht = Heatmap(mat, cluster_columns = FALSE)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, clustering_distance_columns = "pearson")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, clustering_distance_columns = function(x) dist(x))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, clustering_distance_columns = function(x, y) 1 - cor(x, y))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, clustering_method_columns = "single")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_dend_side = "bottom")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_dend_height = unit(4, "cm"))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_dend_gp = gpar(lwd = 2, col = "red"))
> draw(ht, test = TRUE)
> 
> dend = as.dendrogram(hclust(dist(t(mat))))
> ht = Heatmap(mat, cluster_columns = dend)
> draw(ht, test = TRUE)
> 
> dend = color_branches(dend, k = 3)
> ht = Heatmap(mat, cluster_columns = dend)
> draw(ht, test = TRUE)
> 
> 
> ### test row/column order
> od = c(seq(1, 24, by = 2), seq(2, 24, by = 2))
> ht = Heatmap(mat, row_order = od)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_order = od, cluster_rows = TRUE)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_order = od)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_order = od, cluster_columns = TRUE)
> draw(ht, test = TRUE)
> 
> 
> #### test row/column names #####
> ht = Heatmap(unname(mat))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, show_row_names = FALSE)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_names_side = "left")
> draw(ht, test = TRUE)
> 
> random_str2 = function(k) {
+ 	sapply(1:k, function(i) paste(sample(letters, sample(5:10, 1)), collapse = ""))
+ }
> ht = Heatmap(mat, row_labels = random_str2(24))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_names_gp = gpar(fontsize = 20))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_names_gp = gpar(fontsize = 1:24/2 + 5))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_names_rot = 45)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_names_rot = 45, row_names_side = "left")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, show_column_names = FALSE)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_names_side = "top")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_labels = random_str2(24))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_names_gp = gpar(fontsize = 20))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_names_gp = gpar(fontsize = 1:24/2 + 5))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_names_rot = 45)
> draw(ht, test = TRUE)
> 
> ### test annotations ####
> anno = HeatmapAnnotation(
+ 	foo = 1:24,
+ 	df = data.frame(type = c(rep("A", 12), rep("B", 12))),
+ 	bar = anno_barplot(24:1))
> ht = Heatmap(mat, top_annotation = anno)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, bottom_annotation = anno)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, top_annotation = anno, bottom_annotation = anno)
> draw(ht, test = TRUE)
> 
> 
> ### test split ####
> ht = Heatmap(mat, km = 3)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_km = 3)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, split = rep(c("A", "B"), times = c(6, 18)))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_split = rep(c("A", "B"), times = c(6, 18)))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_split = factor(rep(c("A", "B"), times = c(6, 18)), levels = c("B", "A")))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_split = rep(c("A", "B"), 12), row_gap = unit(5, "mm"))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_split = data.frame(rep(c("A", "B"), 12), rep(c("C", "D"), each = 12)))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_split = data.frame(rep(c("A", "B"), 12), rep(c("C", "D"), each = 12)),
+ 	row_gap = unit(c(1, 2, 3), "mm"))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_km = 3, row_title = "foo")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_km = 3, row_title = "cluster%s")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_km = 3, row_title = "cluster%s", row_title_rot = 0)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_km = 3, row_title = "cluster%s", row_title_gp = gpar(fill = 2:4, col = "white"))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_km = 3, row_title = NULL)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_km = 3, row_names_gp = gpar(col = 2:4))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_split = rep(c("A", "B"), times = c(6, 18)), row_km = 3)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_split = rep(c("A", "B"), times = c(6, 18)), row_km = 3, row_title = "cluster%s,group%s", row_title_rot = 0)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_split = 2)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_split = 2, row_title = "foo")
> ht = Heatmap(mat, row_split = 2, row_title = "cluster%s")
> 
> 
> dend = as.dendrogram(hclust(dist(mat)))
> ht = Heatmap(mat, cluster_rows = dend, row_split = 2)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_split = 2, row_names_gp = gpar(col = 2:3))
> draw(ht, test = TRUE)
> 
> 
> ### column split
> ht = Heatmap(mat, column_km = 2)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_km = 2, column_gap = unit(1, "cm"))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_split = rep(c("A", "B"), times = c(6, 18)))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_split = data.frame(rep(c("A", "B"), 12), rep(c("C", "D"), each = 12)),
+ 	column_gap = unit(c(1, 2, 3), "mm"))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_km = 2, column_title = "foo")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_km = 2, column_title = "cluster%s")
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_km = 2, column_title = "cluster%s", column_title_rot = 90)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_km = 2, column_title = "cluster%s", column_title_gp = gpar(fill = 2:3, col = "white"))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_km = 2, column_title = NULL)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_km = 2, column_names_gp = gpar(col = 2:3))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_split = factor(rep(c("A", "B"), times = c(6, 18)), levels = c("A", "B")), column_km = 2)
> draw(ht, test = TRUE)
> ht = Heatmap(mat, column_split = factor(rep(c("A", "B"), times = c(6, 18)), levels = c("B", "A")), column_km = 2)
> 
> 
> ht = Heatmap(mat, column_split = rep(c("A", "B"), times = c(6, 18)), column_km = 2, 
+ 	column_title = "cluster%s,group%s", column_title_rot = 90)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, column_split = 3)
> draw(ht, test = TRUE)
> 
> dend = as.dendrogram(hclust(dist(t(mat))))
> ht = Heatmap(mat, cluster_columns = dend, column_split = 3)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, top_annotation = anno, bottom_annotation = anno, column_km = 2)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, top_annotation = anno, bottom_annotation = anno, column_split = 3)
> draw(ht, test = TRUE)
> 
> ### combine row and column split
> ht = Heatmap(mat, row_km = 3, column_km = 3)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_split = 3, column_split = 3)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_km = 3, column_split = 3)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_split = rep(c("A", "B"), 12), 
+ 	column_split = rep(c("C", "D"), 12))
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, top_annotation = anno,
+ 	row_split = rep(c("A", "B"), 12), 
+ 	row_names_gp = gpar(col = 2:3), row_gap = unit(2, "mm"),
+ 	column_split = 3,
+ 	column_names_gp = gpar(col = 2:4), column_gap = unit(4, "mm")
+ )
> draw(ht, test = TRUE)
> 
> 
> #### character matrix
> mat3 = matrix(sample(letters[1:6], 100, replace = TRUE), 10, 10)
> rownames(mat3) = {x = letters[1:10]; x[1] = "aaaaaaaaaaaaaaaaaaaaaaa";x}
> ht = Heatmap(mat3, rect_gp = gpar(col = "white"))
> draw(ht, test = TRUE)
> 
> 
> ### cell_fun
> mat = matrix(1:9, 3, 3)
> rownames(mat) = letters[1:3]
> colnames(mat) = letters[1:3]
> 
> ht = Heatmap(mat, rect_gp = gpar(col = "white"), cell_fun = function(j, i, x, y, width, height, fill) grid.text(mat[i, j], x = x, y = y),
+ 	cluster_rows = FALSE, cluster_columns = FALSE, row_names_side = "left", column_names_side = "top",
+ 	column_names_rot = 0)
> draw(ht, test = TRUE)
> 
> 
> ### test the size
> ht = Heatmap(mat)
> ht = prepare(ht)
> ht@heatmap_param[c("width", "height")]
$width
[1] 1npc

$height
[1] 1npc

> ht@matrix_param[c("width", "height")]
$width
[1] 3null

$height
[1] 3null

> 
> ht = Heatmap(mat, width = unit(10, "cm"), height = unit(10, "cm"))
> ht = prepare(ht)
> ht@heatmap_param[c("width", "height")]
$width
[1] 114.853733333333mm

$height
[1] 114.853733333333mm

> ht@matrix_param[c("width", "height")]
$width
[1] 10cm

$height
[1] 10cm

> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, width = unit(10, "cm"))
> ht = prepare(ht)
> ht@heatmap_param[c("width", "height")]
$width
[1] 114.853733333333mm

$height
[1] 1npc

> ht@matrix_param[c("width", "height")]
$width
[1] 10cm

$height
[1] 3null

> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, heatmap_width = unit(10, "cm"), heatmap_height = unit(10, "cm"))
> ht = prepare(ht)
> ht@heatmap_param[c("width", "height")]
$width
[1] 10cm

$height
[1] 10cm

> ht@matrix_param[c("width", "height")]
$width
[1] 85.1462666666667mm

$height
[1] 85.1462666666667mm

> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, heatmap_width = unit(10, "cm"))
> ht = prepare(ht)
> ht@heatmap_param[c("width", "height")]
$width
[1] 10cm

$height
[1] 1npc

> ht@matrix_param[c("width", "height")]
$width
[1] 85.1462666666667mm

$height
[1] 3null

> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, use_raster = TRUE)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_km = 2, use_raster = TRUE)
> draw(ht, test = TRUE)
> 
> ht = Heatmap(mat, row_km = 2, column_km = 2, use_raster = TRUE)
> draw(ht, test = TRUE)
> 
> #### test global padding
> ra = rowAnnotation(foo = 1:24)
> ht = Heatmap(mat, show_column_names = FALSE) + ra
> draw(ht)
> 
> ht = Heatmap(matrix(rnorm(100), 10), row_km = 2, row_title = "")
> draw(ht)
> 
> if(0) {
+ ht = Heatmap(matrix(rnorm(100), 10), heatmap_width = unit(5, "mm"))
+ draw(ht)
+ }
> 
> proc.time()
   user  system elapsed 
 21.800   0.210  21.998 

ComplexHeatmap.Rcheck/tests/test-Heatmap-cluster.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(circlize)
========================================
circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> library(GetoptLong)
> 
> # ht_opt("verbose" = TRUE)
> m = matrix(rnorm(50), nr = 10)
> 
> ht = Heatmap(m)
> ht = make_row_cluster(ht)
> 
> ht = Heatmap(m, cluster_rows = FALSE)
> ht = make_row_cluster(ht)
> 
> ht = Heatmap(m, row_km = 2)
> ht = make_row_cluster(ht)
> 
> ht = Heatmap(m, row_split = sample(letters[1:2], 10, replace = TRUE))
> ht = make_row_cluster(ht)
> 
> ht = Heatmap(m, cluster_rows = hclust(dist(m)))
> ht = make_row_cluster(ht)
> 
> ht = Heatmap(m, cluster_rows = hclust(dist(m)), row_split = 2)
> ht = make_row_cluster(ht)
> 
> # ht_opt("verbose" = FALSE)
> 
> proc.time()
   user  system elapsed 
  1.177   0.061   1.225 

ComplexHeatmap.Rcheck/tests/test-HeatmapAnnotation.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(circlize)
========================================
circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> library(GetoptLong)
> 
> 
> ha = HeatmapAnnotation(foo = 1:10)
> ha
A HeatmapAnnotation object with 1 annotation
  name: heatmap_annotation_0 
  position: column 
  items: 10 
  width: 1npc 
  height: 5mm 
  this object is subsetable
  6.75733333333333mm extension on the right 

 name   annotation_type color_mapping height
  foo continuous vector        random    5mm
> 
> 
> ha = HeatmapAnnotation(foo = cbind(1:10, 10:1))
> ha
A HeatmapAnnotation object with 1 annotation
  name: heatmap_annotation_1 
  position: column 
  items: 10 
  width: 1npc 
  height: 10mm 
  this object is subsetable
  6.75733333333333mm extension on the right 

 name   annotation_type color_mapping height
  foo continuous matrix        random   10mm
> draw(ha, test = "matrix as column annotation")
> 
> ha = HeatmapAnnotation(foo = 1:10, bar = sample(c("a", "b"), 10, replace = TRUE),
+ 	pt = anno_points(1:10), annotation_name_side = "left")
> draw(ha, test = "complex annotations")
> 
> ha = HeatmapAnnotation(foo = 1:10, bar = sample(c("a", "b"), 10, replace = TRUE),
+ 	pt = anno_points(1:10), annotation_name_side = "left", height = unit(8, "cm"))
> draw(ha, test = "complex annotations")
> 
> 
> ha = HeatmapAnnotation(foo = 1:10, bar = sample(c("a", "b"), 10, replace = TRUE))
> 
> ha = HeatmapAnnotation(foo = 1:10, 
+ 	bar = cbind(1:10, 10:1),
+ 	pt = anno_points(1:10),
+ 	gap = unit(2, "mm"))
> draw(ha, test = "complex annotations")
> 
> ha2 = re_size(ha, annotation_height = unit(1:3, "cm"))
> draw(ha2, test = "complex annotations")
> ha2 = re_size(ha, annotation_height = 1, height = unit(6, "cm"))
> draw(ha2, test = "complex annotations")
> ha2 = re_size(ha, annotation_height = 1:3, height = unit(6, "cm"))
> draw(ha2, test = "complex annotations")
> ha2 = re_size(ha, annotation_height = unit(c(1, 2, 3), c("null", "null", "cm")), height = unit(6, "cm"))
> draw(ha2, test = "complex annotations")
> ha2 = re_size(ha, annotation_height = unit(c(2, 2, 3), c("cm", "null", "cm")), height = unit(6, "cm"))
> draw(ha2, test = "complex annotations")
> ha2 = re_size(ha, annotation_height = unit(c(2, 2, 3), c("cm", "cm", "cm")))
> draw(ha2, test = "complex annotations")
> ha2 = re_size(ha[, 1:2], annotation_height = 1, height = unit(4, "cm"))
> draw(ha2, test = "complex annotations")
> ha2 = re_size(ha[, 1:2], annotation_height = c(1, 4), height = unit(4, "cm"))
> draw(ha2, test = "complex annotations")
> ha2 = re_size(ha[, 1:2], height = unit(6, "cm"))
> draw(ha2, test = "complex annotations")
> 
> ha2 = re_size(ha, height = unit(6, "cm"))
> draw(ha2, test = "complex annotations")
> 
> #### test anno_empty and self-defined anotation function
> ha = HeatmapAnnotation(foo = anno_empty(), height = unit(4, "cm"))
> draw(ha, 1:10, test = "anno_empty")
> ha = HeatmapAnnotation(foo = anno_empty(), bar = 1:10, height = unit(4, "cm"))
> draw(ha, 1:10, test = "anno_empty")
> ha = HeatmapAnnotation(foo = anno_empty(), bar = 1:10, height = unit(4, "cm"))
> draw(ha, 1:10, test = "anno_empty")
> 
> ha = HeatmapAnnotation(foo = function(index) {grid.rect()}, bar = 1:10, height = unit(4, "cm"))
> draw(ha, 1:10, test = "self-defined function")
> 
> 
> lt = lapply(1:10, function(x) cumprod(1 + runif(1000, -x/100, x/100)) - 1)
> ha = HeatmapAnnotation(foo = 1:10, bar = sample(c("a", "b"), 10, replace = TRUE),
+ 	anno = anno_horizon(lt), which = "row")
> draw(ha, test = "complex annotations on row")
> 
> ## test row annotation with no heatmap
> rowAnnotation(foo = 1:10, bar = anno_points(10:1))
A HeatmapAnnotation object with 2 annotations
  name: heatmap_annotation_11 
  position: row 
  items: 10 
  width: 15.3514598035146mm 
  height: 1npc 
  this object is subsetable
  9.17784444444445mm extension on the bottom 

 name   annotation_type color_mapping width
  foo continuous vector        random   5mm
  bar     anno_points()                10mm
> 
> if(0) {
+ HeatmapAnnotation(1:10)
+ 
+ HeatmapAnnotation(data.frame(1:10))
+ }
> 
> 
> ha = HeatmapAnnotation(summary = anno_summary(height = unit(4, "cm")))
> v = sample(letters[1:2], 50, replace = TRUE)
> split = sample(letters[1:2], 50, replace = TRUE)
> 
> ht = Heatmap(v, top_annotation = ha, width = unit(1, "cm"), split = split)
> draw(ht)
> 
> ha = HeatmapAnnotation(summary = anno_summary(gp = gpar(fill = 2:3), height = unit(4, "cm")))
> v = rnorm(50)
> ht = Heatmap(v, top_annotation = ha, width = unit(1, "cm"), split = split)
> draw(ht)
> 
> 
> ### auto adjust
> m = matrix(rnorm(100), 10)
> ht_list = Heatmap(m, top_annotation = HeatmapAnnotation(foo = 1:10), column_dend_height = unit(4, "cm")) +
+ 	Heatmap(m, top_annotation = HeatmapAnnotation(bar = anno_points(1:10)),
+ 		cluster_columns = FALSE)
> draw(ht_list)
> 
> fun = function(index) {
+ 	grid.rect()
+ }
> ha = HeatmapAnnotation(fun = fun, height = unit(4, "cm"))
> draw(ha, 1:10, test = TRUE)
> 
> ha = rowAnnotation(fun = fun, width = unit(4, "cm"))
> draw(ha, 1:10, test = TRUE)
> 
> 
> ## test anno_mark
> m = matrix(rnorm(1000), nrow = 100)
> ha1 = rowAnnotation(foo = anno_mark(at = c(1:4, 20, 60, 97:100), labels = month.name[1:10]))
> ht = Heatmap(m, name = "mat", cluster_rows = FALSE, right_annotation = ha1)
> draw(ht)
> ht = Heatmap(m, name = "mat", cluster_rows = FALSE) + ha1
> draw(ht)
> 
> split = rep("a", 100); split[c(1:4, 20, 60, 98:100)] = "b"
> ht = Heatmap(m, name = "mat", cluster_rows = FALSE, right_annotation = ha1, row_split = split, gap = unit(1, "cm"))
> draw(ht)
> ht = Heatmap(m, name = "mat", cluster_rows = FALSE, row_split = split, gap = unit(1, "cm")) + ha1
> draw(ht)
> 
> # ha has two annotations
> ha2 = rowAnnotation(foo = anno_mark(at = c(1:4, 20, 60, 97:100), labels = month.name[1:10]), bar = 1:100)
> ht = Heatmap(m, name = "mat", cluster_rows = FALSE, right_annotation = ha2)
> draw(ht)
> ht = Heatmap(m, name = "mat", cluster_rows = FALSE) + ha2
> draw(ht)
> 
> ht = Heatmap(m, name = "mat", cluster_rows = FALSE, right_annotation = ha2, row_split = split, gap = unit(1, "cm"))
> draw(ht)
> ht = Heatmap(m, name = "mat", cluster_rows = FALSE, row_split = split, gap = unit(1, "cm")) + ha2
> draw(ht)
> 
> ## test anno_mark as column annotation
> m = matrix(rnorm(1000), ncol = 100)
> ha1 = columnAnnotation(foo = anno_mark(at = c(1:4, 20, 60, 97:100), labels = month.name[1:10]))
> ht = Heatmap(m, name = "mat", cluster_columns = FALSE, top_annotation = ha1)
> draw(ht)
> ht_list = ha1 %v% Heatmap(m, name = "mat", cluster_columns = FALSE)
> draw(ht_list)
> 
> split = rep("a", 100); split[c(1:4, 20, 60, 98:100)] = "b"
> ht = Heatmap(m, name = "mat", cluster_columns = FALSE, top_annotation = ha1, column_split = split, column_gap = unit(1, "cm"))
> draw(ht)
> ht_list = ha1 %v% Heatmap(m, name = "mat", cluster_columns = FALSE, column_split = split, gap = unit(1, "cm"))
> draw(ht_list)
> 
> # ha has two annotations
> ha2 = HeatmapAnnotation(foo = anno_mark(at = c(1:4, 20, 60, 97:100), labels = month.name[1:10]), bar = 1:100)
> ht = Heatmap(m, name = "mat", cluster_columns = FALSE, top_annotation = ha2)
> draw(ht)
> ht_list = ha2 %v% Heatmap(m, name = "mat", cluster_columns = FALSE)
> draw(ht_list)
> 
> ht = Heatmap(m, name = "mat", cluster_columns = FALSE, top_annotation = ha2, column_split = split, column_gap = unit(1, "cm"))
> draw(ht)
> ht_list = ha2 %v% Heatmap(m, name = "mat", cluster_columns = FALSE, column_split = split, column_gap = unit(1, "cm"))
> draw(ht_list)
> 
> 
> ### when there are only simple annotations
> col_fun = colorRamp2(c(0, 10), c("white", "blue"))
> ha = HeatmapAnnotation(
+     foo = cbind(a = 1:10, b = 10:1), 
+     bar = sample(letters[1:3], 10, replace = TRUE),
+     col = list(foo = col_fun,
+                bar = c("a" = "red", "b" = "green", "c" = "blue")
+     ),
+     simple_anno_size = unit(1, "cm")
+ )
> draw(ha, test = TRUE)
> 
> set.seed(123)
> mat1 = matrix(rnorm(80, 2), 8, 10)
> mat1 = rbind(mat1, matrix(rnorm(40, -2), 4, 10))
> rownames(mat1) = paste0("R", 1:12)
> colnames(mat1) = paste0("C", 1:10)
> 
> mat2 = matrix(runif(60, max = 3, min = 1), 6, 10)
> mat2 = rbind(mat2, matrix(runif(60, max = 2, min = 0), 6, 10))
> rownames(mat2) = paste0("R", 1:12)
> colnames(mat2) = paste0("C", 1:10)
> 
> ind = sample(12, 12)
> mat1 = mat1[ind, ]
> mat2 = mat2[ind, ]
> 
> ha1 = HeatmapAnnotation(foo1 = 1:10, 
+ 	                    annotation_height = unit(1, "cm"),
+ 	                    simple_anno_size_adjust = TRUE,
+                         annotation_name_side = "left")
> ha2 = HeatmapAnnotation(df = data.frame(foo1 = 1:10,
+                                         foo2 = 1:10,
+                                         foo4 = 1:10,
+                                         foo5 = 1:10))
> ht1 = Heatmap(mat1, name = "rnorm", top_annotation = ha1)
> ht2 = Heatmap(mat2, name = "runif", top_annotation = ha2)
> 
> draw(ht1 + ht2)
> 
> ##### test size of a single simple annotation
> 
> ha = HeatmapAnnotation(foo1 = 1:10, 
+ 	simple_anno_size = unit(1, "cm")
+ )
> ha = HeatmapAnnotation(foo1 = 1:10, 
+ 	annotation_height = unit(1, "cm"),
+ 	simple_anno_size_adjust = TRUE
+ )
> ha = HeatmapAnnotation(foo1 = 1:10, 
+ 	height = unit(1, "cm"),
+ 	simple_anno_size_adjust = TRUE
+ )
> 
> 
> ## annotation with the same names
> 
> set.seed(123)
> m = matrix(rnorm(100), 10)
> ha1 = HeatmapAnnotation(foo = sample(c("a", "b"), 10, replace = TRUE))
> ha2 = HeatmapAnnotation(foo = sample(c("b", "c"), 10, replace = TRUE))
> 
> ht_list = Heatmap(m, top_annotation = ha1) + 
+ 	Heatmap(m, top_annotation = ha2)
> draw(ht_list)
> 
> ha1 = HeatmapAnnotation(foo = sample(c("a", "b"), 10, replace = TRUE),
+ 	annotation_legend_param = list(
+ 		foo = list(title = "letters", 
+ 			       at = c("a", "b", "c"),
+ 			       labels = c("A", "B", "C")
+ 			  )
+ 	))
> ha2 = HeatmapAnnotation(foo = sample(c("b", "c"), 10, replace = TRUE))
> 
> ht_list = Heatmap(m, top_annotation = ha1) + 
+ 	Heatmap(m, top_annotation = ha2)
> draw(ht_list)
> 
> x = matrix(rnorm(6), ncol=3)
> subtype_col = c("Basal" = "purple","Her2" = "black","Normal" = "blue")
> h1 <- HeatmapAnnotation("Subtype" = c("Basal","Her2", "Normal"),
+                         col = list("Subtype" = subtype_col))
> h2 <- HeatmapAnnotation("Subtype" = c("Normal","Normal", "Basal"),
+                         col = list("Subtype" = subtype_col))
> 
> ht_list = Heatmap(x,top_annotation = h1) + Heatmap(x,top_annotation = h2)
> draw(ht_list)
> 
> 
> ### test annotation_label
> ha = HeatmapAnnotation(foo = 1:10, bar = letters[1:10],
+ 	annotation_label = c("anno1", "anno2"))
> draw(ha, test = TRUE)
> 
> ha = HeatmapAnnotation(foo = 1:10, bar = letters[1:10],
+ 	annotation_label = list(foo = "anno1"))
> draw(ha, test = TRUE)
> 
> 
> ha = HeatmapAnnotation(foo = 1:10, bar = letters[1:10],
+ 	annotation_label = list(
+ 		foo = gt_render("foo", gp = gpar(box_fill = "red"))))
Loading required namespace: gridtext
> draw(ha, test = TRUE)
> 
> ha = HeatmapAnnotation(foo = 1:10, bar = letters[1:10],
+ 	annotation_label = list(
+ 		foo = gt_render("foo", gp = gpar(box_fill = "red")),
+ 		bar = gt_render("bar", gp = gpar(box_fill = "blue"))))
> draw(ha, test = TRUE)
> 
> proc.time()
   user  system elapsed 
 11.269   0.093  11.425 

ComplexHeatmap.Rcheck/tests/test-HeatmapList-class.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(circlize)
========================================
circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> library(GetoptLong)
> 
> set.seed(123)
> nr1 = 10; nr2 = 8; nr3 = 6
> nc1 = 6; nc2 = 8; nc3 = 10
> mat1 = cbind(rbind(matrix(rnorm(nr1*nc1, mean = 1,   sd = 0.5), nr = nr1),
+           matrix(rnorm(nr2*nc1, mean = 0,   sd = 0.5), nr = nr2),
+           matrix(rnorm(nr3*nc1, mean = 0,   sd = 0.5), nr = nr3)),
+     rbind(matrix(rnorm(nr1*nc2, mean = 0,   sd = 0.5), nr = nr1),
+           matrix(rnorm(nr2*nc2, mean = 1,   sd = 0.5), nr = nr2),
+           matrix(rnorm(nr3*nc2, mean = 0,   sd = 0.5), nr = nr3)),
+     rbind(matrix(rnorm(nr1*nc3, mean = 0.5, sd = 0.5), nr = nr1),
+           matrix(rnorm(nr2*nc3, mean = 0.5, sd = 0.5), nr = nr2),
+           matrix(rnorm(nr3*nc3, mean = 1,   sd = 0.5), nr = nr3))
+    )
> 
> rownames(mat1) = paste0("row_1_", seq_len(nrow(mat1)))
> colnames(mat1) = paste0("column_1_", seq_len(nrow(mat1)))
> 
> nr3 = 10; nr1 = 8; nr2 = 6
> nc3 = 6; nc1 = 8; nc2 = 10
> mat2 = cbind(rbind(matrix(rnorm(nr1*nc1, mean = 1,   sd = 0.5), nr = nr1),
+           matrix(rnorm(nr2*nc1, mean = 0,   sd = 0.5), nr = nr2),
+           matrix(rnorm(nr3*nc1, mean = 0,   sd = 0.5), nr = nr3)),
+     rbind(matrix(rnorm(nr1*nc2, mean = 0,   sd = 0.5), nr = nr1),
+           matrix(rnorm(nr2*nc2, mean = 1,   sd = 0.5), nr = nr2),
+           matrix(rnorm(nr3*nc2, mean = 0,   sd = 0.5), nr = nr3)),
+     rbind(matrix(rnorm(nr1*nc3, mean = 0.5, sd = 0.5), nr = nr1),
+           matrix(rnorm(nr2*nc3, mean = 0.5, sd = 0.5), nr = nr2),
+           matrix(rnorm(nr3*nc3, mean = 1,   sd = 0.5), nr = nr3))
+    )
> 
> rownames(mat2) = paste0("row_2_", seq_len(nrow(mat2)))
> colnames(mat2) = paste0("column_2_", seq_len(nrow(mat2)))
> 
> 
> ht_list = Heatmap(mat1) + Heatmap(mat2)
> draw(ht_list)
> 
> ######### legend ############
> draw(ht_list, heatmap_legend_side = "bottom")
> draw(ht_list, heatmap_legend_side = "left")
> draw(ht_list, heatmap_legend_side = "top")
> 
> 
> ########## width #############
> ht_list = Heatmap(mat1, width = unit(6, "cm")) + Heatmap(mat2)
> draw(ht_list)
> ht_list = Heatmap(mat1) + Heatmap(mat2, width = unit(8, "cm"))
> draw(ht_list)
> ht_list = Heatmap(mat1, width = unit(12, "cm")) + Heatmap(mat2, width = unit(8, "cm"))
> draw(ht_list)
> 
> ht_list = Heatmap(mat1, width = unit(6, "cm")) + Heatmap(mat2)
> draw(ht_list)
> ht_list = Heatmap(mat1) + Heatmap(mat2, width = unit(6, "cm"))
> draw(ht_list)
> ht_list = Heatmap(mat1, width = unit(6, "cm")) + Heatmap(mat2, width = unit(6, "cm"))
> draw(ht_list)
> ht_list = Heatmap(mat1, width = 4) + Heatmap(mat2)
> draw(ht_list)
> ht_list = Heatmap(mat1, width = 2) + Heatmap(mat2, width = 1)
> draw(ht_list)
> 
> 
> ########### height ###########
> ht_list = Heatmap(mat1, height = unit(6, "cm")) + Heatmap(mat2)
> draw(ht_list)
> ht_list = Heatmap(mat1, heatmap_height = unit(6, "cm")) + Heatmap(mat2)
> draw(ht_list)
> ht_list = Heatmap(mat1, width = unit(6, "cm"), height = unit(6, "cm")) + 
+ 	Heatmap(mat2, width = unit(6, "cm"), height = unit(6, "cm"))
> draw(ht_list, column_title = "foooooooooo", row_title = "baaaaaaaaaaar")
> 
> ##### split #####
> ht_list = Heatmap(mat1, name = "m1", row_km = 2) + Heatmap(mat2, name = "m2", row_km = 3)
> draw(ht_list, main_heatmap = "m1")
> draw(ht_list, main_heatmap = "m2")
> 
> ht_list = Heatmap(mat1, name = "m1", row_km = 2, column_km = 3, width = unit(8, "cm"), height = unit(6, "cm")) + 
+ 	Heatmap(mat2, name = "m2", row_km = 3, column_km = 2, width = unit(8, "cm"), height = unit(10, "cm"))
> draw(ht_list, main_heatmap = "m1", column_title = "foooooooooo", row_title = "baaaaaaaaaaar")
> draw(ht_list, main_heatmap = "m2", column_title = "foooooooooo", row_title = "baaaaaaaaaaar")
> 
> ##### adjust column annotations #####
> ha1 = HeatmapAnnotation(foo = 1:24, bar = anno_points(24:1, height = unit(4, "cm")))
> ha2 = HeatmapAnnotation(bar = anno_points(24:1), foo = 1:24)
> ht_list = Heatmap(mat1, top_annotation = ha1) + Heatmap(mat2, top_annotation = ha2)
> draw(ht_list)
> ha2 = HeatmapAnnotation(foo = 1:24)
> ht_list = Heatmap(mat1, top_annotation = ha1) + Heatmap(mat2, top_annotation = ha2)
> draw(ht_list)
> ht_list = Heatmap(mat1, top_annotation = ha1) + Heatmap(mat2)
> draw(ht_list)
> ht_list = Heatmap(mat1, bottom_annotation = ha1) + Heatmap(mat2)
> draw(ht_list)
> 
> 
> #### row annotations #####
> ha = rowAnnotation(foo = 1:24, bar = anno_points(24:1), width = unit(6, "cm"))
> ht_list = Heatmap(mat1) + ha
> draw(ht_list)
> ht_list = Heatmap(mat1, width = unit(6, "cm")) + ha
> draw(ht_list)
> ht_list = Heatmap(mat1, width = unit(6, "cm"), row_km = 2) + ha
> draw(ht_list)
> 
> 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")
> summary(ht_list[1:5, ])
A horizontal heamtap list with 3 heatmap/annotations.
  rnorm: a matrix with 5 rows and 10 columns
  heatmap_annotation_4: a list of 2 annotations
    foo:   a simple annotation.
    bar:   a complex annotation.
  runif: a matrix with 5 rows and 10 columns
> summary(ht_list[1:5, 1])
A horizontal heamtap list with 1 heatmap/annotations.
  rnorm: a matrix with 5 rows and 10 columns
> summary(ht_list[1:5, "rnorm"])
A horizontal heamtap list with 1 heatmap/annotations.
  rnorm: a matrix with 5 rows and 10 columns
> summary(ht_list[1:5, c("rnorm", "foo")])
A horizontal heamtap list with 2 heatmap/annotations.
  rnorm: a matrix with 5 rows and 10 columns
  heatmap_annotation_4: a list of 1 annotations
    foo:   a simple annotation.
> 
> ht_list = Heatmap(matrix(rnorm(100), 10), name = "rnorm") %v%
+   columnAnnotation(foo = 1:10, bar = anno_points(10:1)) %v%
+   Heatmap(matrix(runif(100), 10), name = "runif")
> summary(ht_list[, 1:5])
A vertical heamtap list with 3 heatmap/annotations.
  rnorm: a matrix with 10 rows and 5 columns
  heatmap_annotation_5: a list of 2 annotations
    foo:   a simple annotation.
    bar:   a complex annotation.
  runif: a matrix with 10 rows and 5 columns
> summary(ht_list[1, 1:5])
A vertical heamtap list with 1 heatmap/annotations.
  rnorm: a matrix with 10 rows and 5 columns
> summary(ht_list["rnorm", 1:5])
A vertical heamtap list with 1 heatmap/annotations.
  rnorm: a matrix with 10 rows and 5 columns
> summary(ht_list[c("rnorm", "foo"), 1:5])
A vertical heamtap list with 2 heatmap/annotations.
  rnorm: a matrix with 10 rows and 5 columns
  heatmap_annotation_5: a list of 1 annotations
    foo:   a simple annotation.
> 
> 
> 
> 
> proc.time()
   user  system elapsed 
 12.563   0.098  12.654 

ComplexHeatmap.Rcheck/tests/test-Legend.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(circlize)
========================================
circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> library(GetoptLong)
> 
> if(!exists("random_str")) {
+ 	random_str = ComplexHeatmap:::random_str
+ }
> 
> lgd = Legend(at = 1:6, legend_gp = gpar(fill = 1:6))
> draw(lgd, test = "default discrete legends style")
> 
> lgd = Legend(labels = 1:6, legend_gp = gpar(fill = 1:6))
> draw(lgd, test = "only specify labels with no at")
> 
> 
> lgd = Legend(labels = month.name[1:6], title = "foo", legend_gp = gpar(fill = 1:6))
> draw(lgd, test = "add labels and title")
> 
> lgd = Legend(labels = month.name[1:6], title = "foo", legend_gp = gpar(fill = 1:6),
+ 	title_position = "lefttop")
> draw(lgd, test = "title put in the lefttop")
> 
> lgd = Legend(labels = month.name[1:6], title = "foo", legend_gp = gpar(fill = 1:6),
+ 	title_position = "lefttop-rot")
> draw(lgd, test = "title put in the lefttop-rot")
> 
> lgd = Legend(labels = month.name[1:6], title = "foo", legend_gp = gpar(fill = 1:6),
+ 	title_position = "leftcenter-rot")
> draw(lgd, test = "title put in the leftcenter-rot")
> 
> lgd = Legend(labels = 1:6, title = "fooooooo", legend_gp = gpar(fill = 1:6))
> draw(lgd, test = "title is longer than the legend body")
> 
> lgd = Legend(at = 1:6, legend_gp = gpar(fill = 1:6), grid_height = unit(1, "cm"), 
+ 	title = "foo", grid_width = unit(5, "mm"))
> draw(lgd, test = "grid size")
> 
> lgd = Legend(labels = month.name[1:6], legend_gp = gpar(fill = 1:6), title = "foo", 
+ 	labels_gp = gpar(col = "red", fontsize = 14))
> draw(lgd, test = "labels_gp")
> 
> lgd = Legend(labels = month.name[1:6], legend_gp = gpar(fill = 1:6), title = "foo", 
+ 	title_gp = gpar(col = "red", fontsize = 14))
> draw(lgd, test = "title_gp")
> 
> lgd = Legend(labels = month.name[1:6], legend_gp = gpar(fill = 1:6), title = "foo", 
+ 	border = "red")
> draw(lgd, test = "legend border")
> 
> lgd = Legend(labels = month.name[1:10], legend_gp = gpar(fill = 1:10), title = "foo", 
+ 	ncol = 3)
> draw(lgd, test = "in 3 columns")
> 
> lgd = Legend(labels = month.name[1:10], legend_gp = gpar(fill = 1:10), title = "foo", 
+ 	ncol = 3, title_position = "topcenter")
> draw(lgd, test = "in 3 columns, title in the center")
> 
> lgd = Legend(labels = month.name[1:10], legend_gp = gpar(fill = 1:10), title = "foo", 
+ 	ncol = 3, by_row = TRUE)
> draw(lgd, test = "in 3 columns and by rows")
> 
> lgd = Legend(labels = month.name[1:10], legend_gp = gpar(fill = 1:10), title = "foo", 
+ 	ncol = 3, gap = unit(1, "cm"))
> draw(lgd, test = "in 3 columns with gap between columns")
> 
> lgd = Legend(labels = month.name[1:10], legend_gp = gpar(fill = 1:10), title = "foo", 
+ 	nrow = 3)
> draw(lgd, test = "in 3 rows")
> 
> lgd = Legend(labels = month.name[1:6], legend_gp = gpar(fill = 1:6), title = "foooooo", 
+ 	nrow = 1, title_position = "lefttop")
> draw(lgd, test = "1 row and title is on the left")
> 
> lgd = Legend(labels = month.name[1:6], legend_gp = gpar(fill = 1:6), title = "foooooo", 
+ 	nrow = 1, title_position = "lefttop-rot")
> draw(lgd, test = "1 row and title is on the left, 90 rotation")
> 
> lgd = Legend(labels = month.name[1:6], legend_gp = gpar(fill = 1:6), title = "foooooo", 
+ 	nrow = 1, title_position = "leftcenter")
> draw(lgd, test = "1 row and title is on the left, 90 rotation")
> 
> lgd = Legend(labels = month.name[1:6], title = "foo", type = "points", pch = 1:6, 
+ 	legend_gp = gpar(col = 1:6), background = "red")
> draw(lgd, test = "points as legends")
> 
> lgd = Legend(labels = month.name[1:6], title = "foo", type = "points", pch = letters[1:6], 
+ 	legend_gp = gpar(col = 1:6), background = "white")
> draw(lgd, test = "letters as legends")
> 
> lgd = Legend(labels = month.name[1:6], title = "foo", type = "lines", 
+ 	legend_gp = gpar(col = 1:6, lty = 1:6))
> draw(lgd, test = "lines as legends")
> 
> ###### vertical continous legend #######
> col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red"))
> lgd = Legend(col_fun = col_fun, title = "foo")
> draw(lgd, test = "only col_fun")
> 
> lgd = Legend(col_fun = col_fun, title = "foo", at = c(0, 0.25, 0.5, 0.75, 1))
> draw(lgd, test = "with at")
> 
> lgd = Legend(col_fun = col_fun, title = "foo", at = c(0, 0.5, 1), labels = c("low", "median", "high"))
> draw(lgd, test = "with labels")
> 
> lgd = Legend(col_fun = col_fun, title = "foo", legend_height = unit(6, "cm"))
> draw(lgd, test = "set legend_height")
> 
> lgd = Legend(col_fun = col_fun, title = "foo", labels_gp = gpar(col = "red"))
> draw(lgd, test = "set label color")
> 
> lgd = Legend(col_fun = col_fun, title = "foo", border = "red")
> draw(lgd, test = "legend border")
> 
> lgd = Legend(col_fun = col_fun, title = "foooooooo", title_position = "lefttop-rot")
> draw(lgd, test = "lefttop rot title")
> 
> lgd = Legend(col_fun = col_fun, title = "foooooooo", title_position = "leftcenter-rot")
> draw(lgd, test = "leftcenter top title")
> 
> ###### horizontal continous legend #######
> col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red"))
> lgd = Legend(col_fun = col_fun, title = "foo", direction = "horizontal")
> draw(lgd, test = "only col_fun")
> 
> lgd = Legend(col_fun = col_fun, title = "foo", at = c(0, 0.25, 0.5, 0.75, 1), direction = "horizontal")
> draw(lgd, test = "with at")
> 
> lgd = Legend(col_fun = col_fun, title = "foo", at = c(0, 0.5, 1), labels = c("low", "median", "high"),
+ 	direction = "horizontal")
> draw(lgd, test = "with labels")
> 
> lgd = Legend(col_fun = col_fun, title = "foo", legend_width = unit(6, "cm"), direction = "horizontal")
> draw(lgd, test = "set legend_width")
> 
> lgd = Legend(col_fun = col_fun, title = "foo", labels_gp = gpar(col = "red"), direction = "horizontal")
> draw(lgd, test = "set label color")
> 
> lgd = Legend(col_fun = col_fun, title = "foo", border = "red", direction = "horizontal")
> draw(lgd, test = "legend border")
> 
> lgd = Legend(col_fun = col_fun, title = "foooooooo", direction = "horizontal", 
+ 	title_position = "topcenter")
> draw(lgd, test = "topcenter title")
> 
> lgd = Legend(col_fun = col_fun, title = "foooooooo", direction = "horizontal", 
+ 	title_position = "lefttop")
> draw(lgd, test = "lefttop title")
> 
> lgd = Legend(col_fun = col_fun, title = "foooooooo", direction = "horizontal", 
+ 	title_position = "leftcenter")
> draw(lgd, test = "leftcenter title")
> 
> 
> ###### pack legend
> lgd1 = Legend(at = 1:6, legend_gp = gpar(fill = 1:6), title = "legend1")
> lgd2 = Legend(col_fun = col_fun, title = "legend2", at = c(0, 0.25, 0.5, 0.75, 1))
> 
> pd = packLegend(lgd1, lgd2)
> draw(pd, test = "two legends")
> 
> pd = packLegend(list = list(lgd1, lgd2))
> draw(pd, test = "two legends specified as a list")
> 
> pd = packLegend(lgd1, lgd2, direction = "horizontal")
> draw(pd, test = "two legends packed horizontally")
> 
> lgd3 = Legend(at = 1:6, legend_gp = gpar(fill = 1:6), title = "legend1")
> lgd4 = Legend(col_fun = col_fun, title = "legend2", at = c(0, 0.25, 0.5, 0.75, 1), direction = "horizontal")
> pd = packLegend(lgd3, lgd4)
> draw(pd, test = "two legends with different directions")
> pd = packLegend(lgd3, lgd4, direction = "horizontal")
> draw(pd, test = "two legends with different directions")
> 
> pd = packLegend(lgd1, lgd2, lgd1, lgd2)
> draw(pd, test = "many legends with same legends")
> 
> lgd3 = Legend(at = 1:6, legend_gp = gpar(fill = 1:6), title = "legend1")
> lgd4 = Legend(col_fun = col_fun, title = "legend2", at = c(0, 0.25, 0.5, 0.75, 1))
> pd = packLegend(lgd1, lgd2, lgd3, lgd4)
> draw(pd, test = "many legends with all different legends")
> 
> pd = packLegend(lgd1, lgd2, lgd1, lgd2, lgd1, lgd2)
> draw(pd, test = "many legends")
> 
> pd = packLegend(lgd1, lgd2, lgd1, lgd2, lgd1, lgd2, max_height = unit(1, "npc"))
> draw(pd, test = "many legends, max_height = unit(1, 'npc')")
> ## reduce the height of the interactive window and rerun draw()
> 
> pd = packLegend(lgd1, lgd2, lgd1, lgd2, lgd1, lgd2, max_height = unit(10, "cm"))
> draw(pd, test = "many legends, max_height = unit(10, 'cm')")
> 
> pd = packLegend(lgd1, lgd2, lgd1, lgd2, lgd1, lgd2, max_height = unit(10, "cm"), gap = unit(1, "cm"))
> draw(pd, test = "many legends, max_height = unit(10, 'cm'), with gap")
> 
> lgd_long = Legend(at = 1:50, legend_gp = gpar(fill = 1:50))
> pd = packLegend(lgd1, lgd2, lgd1, lgd2, lgd1, lgd2, lgd_long, max_height = unit(10, "cm"))
> draw(pd, test = "many legends with a long one, max_height = unit(10, 'cm')")
> 
> lgd1 = Legend(at = 1:6, legend_gp = gpar(fill = 1:6), title = "legend1",
+ 	nr = 1)
> lgd2 = Legend(col_fun = col_fun, title = "legend2", at = c(0, 0.25, 0.5, 0.75, 1),
+ 	direction = "horizontal")
> pd = packLegend(lgd1, lgd2, lgd1, lgd2, lgd1, lgd2, direction = "horizontal")
> draw(pd, test = "many legends")
> 
> pd = packLegend(lgd1, lgd2, lgd1, lgd2, lgd1, lgd2, max_width = unit(1, "npc"), direction = "horizontal")
> draw(pd, test = "many legends, max_width = unit(1, 'npc')")
> ## reduce the height of the interactive window and rerun draw()
> 
> pd = packLegend(lgd1, lgd2, lgd1, lgd2, lgd1, lgd2, max_width = unit(10, "cm"), direction = "horizontal")
> draw(pd, test = "many legends, max_width = unit(10, 'cm')")
> 
> 
> ####### unequal interval breaks
> col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red"))
> lgd = Legend(col_fun = col_fun, title = "foo", at = c(0, 0.1, 0.15, 0.5, 0.9, 0.95, 1))
> draw(lgd, test = "unequal interval breaks")
> lgd = Legend(col_fun = col_fun, title = "foo", at = c(0, 0.3, 1), legend_height = unit(4, "cm"))
> draw(lgd, test = "unequal interval breaks but not label position adjustment")
> 
> lgd = Legend(col_fun = col_fun, title = "foo", at = c(0, 0.1, 0.15, 0.5, 0.9, 0.95, 1),
+ 	direction = "horizontal")
> draw(lgd, test = "unequal interval breaks")
> 
> lgd = Legend(col_fun = col_fun, title = "foo", at = c(0, 0.1, 0.15, 0.5, 0.9, 0.95, 1),
+ 	direction = "horizontal", title_position = "lefttop")
> draw(lgd, test = "unequal interval breaks")
> 
> 
> lgd = Legend(col_fun = col_fun, title = "foo", at = c(0, 0.1, 0.15, 0.5, 0.9, 0.95, 1),
+ 	direction = "horizontal", title_position = "lefttop", labels_rot = 90)
> draw(lgd, test = "unequal interval breaks, label rot 90")
> 
> lgd = Legend(col_fun = col_fun, title = "foo", at = c(0, 0.1, 0.5, 0.75, 1),
+ 	labels = c("mininal", "q10", "median", "q75", "maximal"),
+ 	direction = "horizontal", title_position = "lefttop")
> draw(lgd, test = "unequal interval breaks with labels")
> 
> 
> lgd = Legend(col_fun = col_fun, title = "foo", at = c(0, 0.1, 0.5, 0.75, 1),
+ 	labels = c("mininal", "q10", "median", "q75", "maximal"),
+ 	direction = "horizontal")
> draw(lgd, test = "unequal interval breaks with labels")
> 
> 
> #### position of legends to heatmaps ##
> if(0) {
+ m = matrix(rnorm(100), 10)
+ rownames(m) = random_str(10, len = 20)
+ colnames(m) = random_str(10, len = 20)
+ Heatmap(m)
+ }
> 
> 
> 
> proc.time()
   user  system elapsed 
  2.949   0.094   3.028 

ComplexHeatmap.Rcheck/tests/test-multiple-page.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(circlize)
========================================
circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> library(GetoptLong)
> 
> m = matrix(rnorm(100), 10)
> 
> postscript("test.ps")
> lgd = Legend(labels = c("a", "b", "c"))
> draw(Heatmap(m), heatmap_legend_list = list(lgd))
> dev.off()
null device 
          1 
> 
> check_pages = function() {
+ 	lines = readLines("test.ps")
+ 	print(lines[length(lines)-1])
+ 	invisible(file.remove("test.ps"))
+ }
> 
> check_pages()
[1] "%%Pages: 1"
> 
> postscript("test.ps")
> ha = HeatmapAnnotation(foo = 1:10, bar = anno_points(1:10))
> Heatmap(m, top_annotation = ha)
> dev.off()
null device 
          1 
> 
> check_pages()
[1] "%%Pages: 1"
> 
> proc.time()
   user  system elapsed 
  4.464   0.052   4.503 

ComplexHeatmap.Rcheck/tests/test-oncoPrint.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(circlize)
========================================
circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> library(GetoptLong)
> 
> mat = read.table(textConnection(
+ "s1,s2,s3
+ g1,snv;indel,snv,indel
+ g2,,snv;indel,snv
+ g3,snv,,indel;snv"), row.names = 1, header = TRUE, sep = ",", stringsAsFactors = FALSE)
> mat = as.matrix(mat)
> 
> get_type_fun = function(x) strsplit(x, ";")[[1]]
> 
> alter_fun = list(
+     snv = function(x, y, w, h) grid.rect(x, y, w*0.9, h*0.9, 
+         gp = gpar(fill = col["snv"], col = NA)),
+     indel = function(x, y, w, h) grid.rect(x, y, w*0.9, h*0.4, 
+         gp = gpar(fill = col["indel"], col = NA))
+ )
> 
> col = c(snv = "red", indel = "blue")
> ht = oncoPrint(mat, get_type = get_type_fun,
+     alter_fun = alter_fun, col = col)
All mutation types: snv, indel
> draw(ht)
> 
> ## turn off row names while turn on column names
> ht = oncoPrint(mat, get_type = get_type_fun,
+     alter_fun = alter_fun, col = col, 
+     show_column_names = TRUE, show_row_names = FALSE, show_pct = FALSE)
All mutation types: snv, indel
> draw(ht)
> 
> ht = oncoPrint(mat, get_type = get_type_fun,
+     alter_fun = alter_fun, col = col, pct_side = "right", 
+     row_names_side = "left")
All mutation types: snv, indel
> draw(ht)
> 
> ht = oncoPrint(mat, get_type = get_type_fun,
+     alter_fun = alter_fun, col = col,
+     top_annotation = HeatmapAnnotation(column_barplot = anno_oncoprint_barplot())
+ )
All mutation types: snv, indel
> draw(ht)
> 
> ht = oncoPrint(mat, get_type = get_type_fun,
+     alter_fun = alter_fun, col = col,
+     top_annotation = HeatmapAnnotation(
+     	column_barplot = anno_oncoprint_barplot(),
+     	foo = 1:3,
+     	annotation_name_side = "left")
+ )
All mutation types: snv, indel
> draw(ht)
> 
> ht = oncoPrint(mat, get_type = get_type_fun,
+     alter_fun = alter_fun, col = col,
+     top_annotation = HeatmapAnnotation(
+     	cbar = anno_oncoprint_barplot(),
+     	foo1 = 1:3,
+     	annotation_name_side = "left"),
+     left_annotation = rowAnnotation(foo2 = 1:3),
+     right_annotation = rowAnnotation(cbar = anno_oncoprint_barplot(), foo3 = 1:3),
+ )
All mutation types: snv, indel
> draw(ht)
> 
> 
> ht = oncoPrint(mat, get_type = get_type_fun,
+     alter_fun = alter_fun, col = col,
+     top_annotation = HeatmapAnnotation(
+         cbar = anno_oncoprint_barplot(border = TRUE),
+         foo1 = 1:3,
+         annotation_name_side = "left"),
+     left_annotation = rowAnnotation(foo2 = 1:3),
+     right_annotation = rowAnnotation(
+         cbar = anno_oncoprint_barplot(border = TRUE), 
+         foo3 = 1:3),
+ )
All mutation types: snv, indel
> draw(ht)
> 
> ht = oncoPrint(mat, get_type = get_type_fun,
+     alter_fun = alter_fun, col = col,
+     right_annotation = rowAnnotation(rbar = anno_oncoprint_barplot(axis_param = list(side = "bottom", labels_rot = 90)))
+ )
All mutation types: snv, indel
> draw(ht)
> 
> 
> proc.time()
   user  system elapsed 
  5.767   0.054   5.807 

ComplexHeatmap.Rcheck/tests/test-SingleAnnotation.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(circlize)
========================================
circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> library(GetoptLong)
> 
> ha = SingleAnnotation(value = 1:10)
> draw(ha, test = "single column annotation")
> ha = SingleAnnotation(value = 1:10, which = "row")
> draw(ha, test = "single row annotation")
> ha = SingleAnnotation(value = 1:10)
> draw(ha, index = 6:10, test = "single column annotation, subset")
> draw(ha, index = 6:10, k = 1, n = 2, test = "single column annotation, subset, k=1 n=2")
> draw(ha, index = 6:10, k = 2, n = 2, test = "single column annotation, subset, k=1 n=2")
> 
> x = 1:10
> ha = SingleAnnotation(value = x)
> 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")
> 
> ha = SingleAnnotation(value = 1:10, col = colorRamp2(c(1, 10), c("blue", "red")))
> draw(ha, test = "color mapping function")
> 
> ha = SingleAnnotation(value = c(rep(c("a", "b"), 5)))
> draw(ha, test = "discrete annotation")
> ha = SingleAnnotation(value = c(rep(c("a", "b"), 5)), col = c("a" = "red", "b" = "blue"))
> draw(ha, test = "discrete annotation with defined colors")
> 
> anno = anno_simple(1:10)
> ha = SingleAnnotation(fun = anno)
> draw(ha, test = "AnnotationFunction as input")
> 
> anno = anno_barplot(matrix(nc = 2, c(1:10, 10:1)))
> ha = SingleAnnotation(fun = anno)
> draw(ha, test = "anno_barplot as input")
> draw(ha, index = 1:5, test = "anno_barplot as input, 1:5")
> draw(ha, index = 1:5, k = 1, n = 2, test = "anno_barplot as input, 1:5, k = 1, n = 2")
> draw(ha, index = 1:5, k = 2, n = 2, test = "anno_barplot as input, 1:5, k = 2, n = 2")
> 
> lt = lapply(1:20, function(x) cumprod(1 + runif(1000, -x/100, x/100)) - 1)
> anno = anno_horizon(lt, which = "row")
> ha = SingleAnnotation(fun = anno, which = "row")
> draw(ha, test = "anno_horizon as input")
> 
> fun = local({
+ 	value = 1:10
+ 	function(index, k = 1, n = 1) {
+ 		pushViewport(viewport(xscale = c(0.5, length(index) + 0.5), yscale = range(value)))
+ 		grid.points(seq_along(index), value[index])
+ 		grid.rect()
+ 		if(k == 1) grid.yaxis()
+ 		popViewport()
+ 	}
+ })
> ha = SingleAnnotation(fun = fun, height = unit(4, "cm"))
> # ha[1:5]
> draw(ha, index = c(1, 4, 2, 6), test = "self-defined function")
> draw(ha, index = c(1, 4, 2, 6), k = 1, n = 2, test = "self-defined function, k = 1, n = 2")
> draw(ha, index = c(1, 4, 2, 6), k = 2, n = 2, test = "self-defined function, k = 2, n = 2")
> 
> 
> # test gridtext
> ha = SingleAnnotation(value = 1:10, label = gt_render("foo", r = unit(2, "pt")), name_gp = gpar(box_fill = "red"))
Loading required namespace: gridtext
> draw(ha, test = "single column annotation")
> 
> 
> 
> proc.time()
   user  system elapsed 
  2.129   0.078   2.186 

ComplexHeatmap.Rcheck/tests/test-upset.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(circlize)
========================================
circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> library(GetoptLong)
> 
> set.seed(123)
> lt = list(a = sample(letters, 10),
+ 	      b = sample(letters, 15),
+ 	      c = sample(letters, 20))
> 
> m = make_comb_mat(lt)
> t(m)
A combination matrix with 3 sets and 6 combinations.
  ranges of combination set size: c(1, 8).
  mode for the combination size: distinct.
  sets are on columns

Combination sets are:
  a b c code size
  x x x  111    4
  x x    110    4
  x   x  101    2
    x x  011    6
    x    010    1
      x  001    8

Sets are:
  set size
    a   10
    b   15
    c   20
> set_name(m)
[1] "a" "b" "c"
> comb_name(m)
[1] "111" "110" "101" "011" "010" "001"
> set_size(m)
 a  b  c 
10 15 20 
> comb_size(m)
111 110 101 011 010 001 
  4   4   2   6   1   8 
> lapply(comb_name(m), function(x) extract_comb(m, x))
[[1]]
[1] "e" "j" "x" "y"

[[2]]
[1] "c" "k" "n" "s"

[[3]]
[1] "o" "r"

[[4]]
[1] "a" "g" "h" "i" "l" "u"

[[5]]
[1] "d"

[[6]]
[1] "b" "f" "m" "q" "t" "v" "w" "z"

> draw(UpSet(m))
> draw(UpSet(m, comb_col = c(rep(2, 3), rep(3, 3), 1)))
> draw(UpSet(t(m)))
> 
> set_name(t(m))
[1] "a" "b" "c"
> comb_name(t(m))
[1] "111" "110" "101" "011" "010" "001"
> set_size(t(m))
 a  b  c 
10 15 20 
> comb_size(t(m))
111 110 101 011 010 001 
  4   4   2   6   1   8 
> lapply(comb_name(t(m)), function(x) extract_comb(t(m), x))
[[1]]
[1] "e" "j" "x" "y"

[[2]]
[1] "c" "k" "n" "s"

[[3]]
[1] "o" "r"

[[4]]
[1] "a" "g" "h" "i" "l" "u"

[[5]]
[1] "d"

[[6]]
[1] "b" "f" "m" "q" "t" "v" "w" "z"

> 
> m = make_comb_mat(lt, mode = "intersect")
> lapply(comb_name(m), function(x) extract_comb(m, x))
[[1]]
[1] "e" "j" "x" "y"

[[2]]
[1] "c" "e" "j" "k" "n" "s" "x" "y"

[[3]]
[1] "e" "j" "o" "r" "x" "y"

[[4]]
 [1] "a" "e" "g" "h" "i" "j" "l" "u" "x" "y"

[[5]]
 [1] "c" "e" "j" "k" "n" "o" "r" "s" "x" "y"

[[6]]
 [1] "a" "c" "d" "e" "g" "h" "i" "j" "k" "l" "n" "s" "u" "x" "y"

[[7]]
 [1] "a" "b" "e" "f" "g" "h" "i" "j" "l" "m" "o" "q" "r" "t" "u" "v" "w" "x" "y"
[20] "z"

> draw(UpSet(m))
> 
> m = make_comb_mat(lt, mode = "union")
> lapply(comb_name(m), function(x) extract_comb(m, x))
[[1]]
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "q" "r" "s" "t"
[20] "u" "v" "w" "x" "y" "z"

[[2]]
 [1] "a" "c" "d" "e" "g" "h" "i" "j" "k" "l" "n" "o" "r" "s" "u" "x" "y"

[[3]]
 [1] "a" "b" "c" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "q" "r" "s" "t" "u"
[20] "v" "w" "x" "y" "z"

[[4]]
 [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "q" "r" "s" "t"
[20] "u" "v" "w" "x" "y" "z"

[[5]]
 [1] "c" "e" "j" "k" "n" "o" "r" "s" "x" "y"

[[6]]
 [1] "a" "c" "d" "e" "g" "h" "i" "j" "k" "l" "n" "s" "u" "x" "y"

[[7]]
 [1] "a" "b" "e" "f" "g" "h" "i" "j" "l" "m" "o" "q" "r" "t" "u" "v" "w" "x" "y"
[20] "z"

> draw(UpSet(m))
> 
> f = system.file("extdata", "movies.csv", package = "UpSetR")
> if(file.exists(f)) {
+ 	movies <- read.csv(system.file("extdata", "movies.csv", package = "UpSetR"), header = T, sep = ";")
+ 	m = make_comb_mat(movies, top_n_sets = 6)
+ 	t(m)
+ 	set_name(m)
+ 	comb_name(m)
+ 	set_size(m)
+ 	comb_size(m)
+ 	lapply(comb_name(m), function(x) extract_comb(m, x))
+ 
+ 	set_name(t(m))
+ 	comb_name(t(m))
+ 	set_size(t(m))
+ 	comb_size(t(m))
+ 	lapply(comb_name(t(m)), function(x) extract_comb(t(m), x))
+ 
+ 	draw(UpSet(m))
+ 	draw(UpSet(t(m)))
+ 
+ 	m = make_comb_mat(movies, top_n_sets = 6, mode = "intersect")
+ 	m = make_comb_mat(movies, top_n_sets = 6, mode = "union")
+ }
> 
> library(circlize)
> library(GenomicRanges)
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which, which.max, which.min

Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following object is masked from 'package:base':

    expand.grid

Loading required package: IRanges
Loading required package: GenomeInfoDb
> lt = lapply(1:4, function(i) generateRandomBed())
> lt = lapply(lt, function(df) GRanges(seqnames = df[, 1], ranges = IRanges(df[, 2], df[, 3])))
> names(lt) = letters[1:4]
> m = make_comb_mat(lt)
> 
> # if(0) {
> # set.seed(123)
> # lt = list(a = sample(letters, 10),
> # 	      b = sample(letters, 15),
> # 	      c = sample(letters, 20))
> # v = gplots::venn(lt, show.plot = FALSE)
> # rownames(v) = apply(v[, -1], 1, paste, collapse = "")
> # m = make_comb_mat(lt)
> # cs = structure(comb_size(m), names = comb_name(m))
> # }
> 
> if(file.exists(f)) {
+ 	movies <- read.csv(f, header = T, sep = ";")
+ 	genre = c("Action", "Romance", "Horror", "Children", "SciFi", "Documentary")
+ 	rate = cut(movies$AvgRating, c(0, 1, 2, 3, 4, 5))
+ 	m_list = tapply(seq_len(nrow(movies)), rate, function(ind) {
+ 		make_comb_mat(movies[ind, genre, drop = FALSE])
+ 	})
+ 	m_list2 = normalize_comb_mat(m_list)
+ 
+ 	lapply(m_list2, set_name)
+ 	lapply(m_list2, set_size)
+ 	lapply(m_list2, comb_name)
+ 	lapply(m_list2, comb_size)
+ 
+ 	lapply(1:length(m_list), function(i) {
+ 		n1 = comb_name(m_list[[i]])
+ 		x1 = comb_size(m_list[[i]])
+ 		n2 = comb_name(m_list2[[i]])
+ 		x2 = comb_size(m_list2[[i]])
+ 		l = n2 %in% n1
+ 		x2[!l]
+ 	})
+ }
[[1]]
110001 100101 100011 110000 100100 100010 100001 010100 010010 010001 000110 
     0      0      0      0      0      0      0      0      0      0      0 
000101 000011 100000 000010 
     0      0      0      1 

[[2]]
110001 100101 100011 100001 010100 010010 010001 000110 000101 000011 
     1      1      0      5      0      0      0      0      8      0 

[[3]]
110001 100101 100011 100001 010001 000101 000011 
     0      4      0     35      7     27      1 

[[4]]
110001 100101 100011 100100 100001 010001 000101 000011 
     1      6      1      6     45      5     11      4 

[[5]]
110001 100101 100011 100100 100001 010100 010010 010001 000110 000101 000011 
     0      1      1      1      6      0      0      0      0      0      0 

> 
> 
> proc.time()
   user  system elapsed 
 25.257   0.173  25.451 

ComplexHeatmap.Rcheck/tests/test-utils.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(circlize)
========================================
circlize version 0.4.10
CRAN page: https://cran.r-project.org/package=circlize
Github page: https://github.com/jokergoo/circlize
Documentation: https://jokergoo.github.io/circlize_book/book/

If you use it in published research, please cite:
Gu, Z. circlize implements and enhances circular visualization
  in R. Bioinformatics 2014.

This message can be suppressed by:
  suppressPackageStartupMessages(library(circlize))
========================================

> library(ComplexHeatmap)
Loading required package: grid
========================================
ComplexHeatmap version 2.4.3
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

> library(GetoptLong)
> 
> # things needed to be tested
> # 1. the order
> # 2. if the sum of sizes are larger than xlim
> 
> make_plot = function(pos1, pos2, range) {
+ 	oxpd = par("xpd")
+ 	par(xpd = NA)
+ 	plot(NULL, xlim = c(0, 4), ylim = range, ann = FALSE)
+ 	col = rand_color(nrow(pos1), transparency = 0.5)
+ 	rect(0.5, pos1[, 1], 1.5, pos1[, 2], col = col)
+ 	rect(2.5, pos2[, 1], 3.5, pos2[, 2], col = col)
+ 	segments(1.5, rowMeans(pos1), 2.5, rowMeans(pos2))
+ 	par(xpd = oxpd)
+ }
> 
> range = c(0, 10)
> pos1 = rbind(c(1, 2), c(5, 7))
> make_plot(pos1, smartAlign2(pos1, range = range), range)
> 
> range = c(0, 10)
> pos1 = rbind(c(-0.5, 2), c(5, 7))
> make_plot(pos1, smartAlign2(pos1, range = range), range)
> 
> pos1 = rbind(c(-1, 2), c(3, 4), c(5, 6), c(7, 11))
> pos1 = pos1 + runif(length(pos1), max = 0.3, min = -0.3)
> par(mfrow = c(3, 3))
> for(i in 1:9) {
+ 	ind = sample(4, 4)
+ 	make_plot(pos1[ind, ], smartAlign2(pos1[ind, ], range = range), range)
+ }
> par(mfrow = c(1, 1))
> 
> pos1 = rbind(c(3, 6), c(4, 7))
> make_plot(pos1, smartAlign2(pos1, range = range), range)
> 
> pos1 = rbind(c(1, 8), c(3, 10))
> make_plot(pos1, smartAlign2(pos1, range = range), range)
> 
> ########## new version of smartAlign2() ############
> 
> start = c(0.0400972528391016, 0.0491583597430212, 0.0424302664385027, 0.0547524243812509, 0.0820937279769642, 0.126861283282835, 0.178503822565168, 0.327742831447437, 0.570671411156898, 0.81775868755151)
> end = c(0.0921142856224367, 0.107091640256979, 0.137858195099959, 0.159189883311057, 0.177521656638421, 0.20727333210178, 0.304669254357909, 0.463122553167947, 0.676924742689255, 0.929837466294643)
> range = c(0, 1)
> smartAlign2(start, end, range, plot = TRUE)
enter to continue
             [,1]       [,2]
 [1,] 0.002200888 0.05421792
 [2,] 0.054217921 0.11215120
 [3,] 0.112151202 0.20757913
 [4,] 0.207579130 0.31201659
 [5,] 0.312016589 0.40744452
 [6,] 0.407444518 0.48785657
 [7,] 0.487856567 0.61402200
 [8,] 0.614021999 0.74940172
 [9,] 0.749401720 0.85565505
[10,] 0.855655052 0.96773383
> 
> 
> start <- c(0.722121284290678, 0.701851666769472, 0.284795592003117, 0.335674695572052, 0.246977082249377, 0.767289857630785, 0.728198060058033, 0.299241440370817, -0.0149946764559372, 0.85294351791166, 0.126216621670218, 0.478169948493225)
> end <- c(0.766196472718668, 0.763101604258565, 0.34604552949221, 0.421334650222341, 0.344144413077725, 0.847196123677626, 0.813858014708322, 0.392347344675911, 0.108452620381171, 0.969486388630396, 0.249951602628847, 0.584914163656308)
> od = order(start)
> start = start[od]; end = end[od]
> range = c(0, 1)
> pos = smartAlign2(start, end, range)
> n = nrow(pos)
> pos[1:(n-1), 2] > pos[2:n, 1]
 [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
> 
> 
> if(0) {
+ 	go_id = random_GO(500)
+ 	mat = GO_similarity(go_id)
+ 	invisible(simplify(mat, order_by_size = FALSE))
+ }
> 
> proc.time()
   user  system elapsed 
  1.570   0.101   1.655 

ComplexHeatmap.Rcheck/tests/testthat-all.Rout


R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Freak Out"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> 
> suppressWarnings(suppressPackageStartupMessages(library(ComplexHeatmap)))
> library(testthat)
> 
> test_check("ComplexHeatmap")
══ testthat results  ═══════════════════════════════════════════════════════════
[ OK: 181 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 0 ]
> 
> proc.time()
   user  system elapsed 
 22.156   0.278  22.396 

Example timings

ComplexHeatmap.Rcheck/ComplexHeatmap-Ex.timings

nameusersystemelapsed
AdditiveUnit-class000
AdditiveUnit0.0010.0000.000
AnnotationFunction-class000
AnnotationFunction4.6670.0034.679
ColorMapping-class000
ColorMapping0.0220.0000.022
ComplexHeatmap-package000
Extract.AnnotationFunction0.0360.0000.036
Extract.Heatmap0.6750.0080.683
Extract.HeatmapAnnotation0.0750.0000.076
Extract.HeatmapList0.2240.0040.227
Extract.SingleAnnotation0.0250.0000.025
Extract.comb_mat0.0240.0000.023
Extract.gridtext000
Heatmap-class000
Heatmap000
HeatmapAnnotation-class0.0010.0000.000
HeatmapAnnotation0.0010.0000.000
HeatmapList-class0.0010.0000.000
HeatmapList0.0010.0000.000
Legend0.0910.0040.095
Legends-class0.0070.0000.007
Legends000
SingleAnnotation-class000
SingleAnnotation0.0960.0000.096
UpSet0.8040.0000.805
add.AdditiveUnit000
add_heatmap-Heatmap-method000
add_heatmap-HeatmapAnnotation-method000
add_heatmap-HeatmapList-method000
add_heatmap-dispatch000
adjust_dend_by_x0.0200.0030.024
adjust_heatmap_list-HeatmapList-method0.0010.0000.000
alter_graphic0.2320.0010.232
anno_barplot0.0320.0040.036
anno_block0.3470.0040.351
anno_boxplot0.0530.0000.053
anno_density0.8600.0110.872
anno_empty0.0220.0000.022
anno_histogram0.1060.0110.119
anno_horizon5.1880.0485.246
anno_image000
anno_joyplot0.3770.0080.386
anno_lines0.0760.0040.079
anno_link000
anno_mark0.3520.0000.352
anno_oncoprint_barplot000
anno_points0.0210.0000.021
anno_simple0.0530.0000.053
anno_summary0.230.000.23
anno_text0.0630.0000.064
anno_zoom0.3700.0000.369
annotation_axis_grob0.0550.0000.054
annotation_legend_size-HeatmapList-method000
c.ColorMapping0.0010.0000.001
c.HeatmapAnnotation0.0330.0000.033
cluster_within_group0.0210.0000.021
color_mapping_legend-ColorMapping-method000
columnAnnotation000
column_dend-Heatmap-method0.2290.0030.233
column_dend-HeatmapList-method0.7130.0080.722
column_dend-dispatch000
column_order-Heatmap-method0.2250.0000.225
column_order-HeatmapList-method1.0840.0041.088
column_order-dispatch000
comb_degree0.0040.0000.003
comb_name0.0040.0000.004
comb_size0.0030.0000.004
complement_size000
component_height-Heatmap-method000
component_height-HeatmapList-method000
component_height-dispatch000
component_width-Heatmap-method000
component_width-HeatmapList-method000
component_width-dispatch000
copy_all-AnnotationFunction-method000
copy_all-SingleAnnotation-method000
copy_all-dispatch000
decorate_annotation0.3350.0000.335
decorate_column_dend0.0000.0010.000
decorate_column_names0.0000.0010.000
decorate_column_title000
decorate_dend0.1770.0000.178
decorate_dimnames0.2210.0000.221
decorate_heatmap_body0.1580.0000.158
decorate_row_dend000
decorate_row_names000
decorate_row_title000
decorate_title0.1770.0010.179
default_axis_param0.0010.0000.001
default_get_type0.0000.0000.001
dend_heights0.0010.0000.000
dend_xy0.0160.0000.016
dendrogramGrob000
densityHeatmap1.6560.0161.672
dim.Heatmap000
dist20.0120.0040.016
draw-AnnotationFunction-method000
draw-Heatmap-method0.0010.0000.000
draw-HeatmapAnnotation-method0.0010.0000.001
draw-HeatmapList-method0.0000.0000.001
draw-Legends-method0.0150.0000.015
draw-SingleAnnotation-method000
draw-dispatch000
draw_annotation-Heatmap-method000
draw_annotation_legend-HeatmapList-method000
draw_dend-Heatmap-method000
draw_dimnames-Heatmap-method000
draw_heatmap_body-Heatmap-method0.0010.0000.000
draw_heatmap_legend-HeatmapList-method0.0010.0000.000
draw_heatmap_list-HeatmapList-method0.0000.0000.001
draw_title-Heatmap-method0.0000.0000.001
draw_title-HeatmapList-method000
draw_title-dispatch000
extract_comb0.0040.0000.004
full_comb_code0.0040.0000.004
getXY_in_parent_vp0.020.000.02
get_color_mapping_list-HeatmapAnnotation-method000
get_legend_param_list-HeatmapAnnotation-method000
grid.annotation_axis000
grid.boxplot0.010.000.01
grid.dendrogram0.6770.0120.689
grid.draw.Legends0.0140.0000.014
gt_render0.9730.0080.996
heatmap_legend_size-HeatmapList-method000
height.AnnotationFunction0.0070.0000.007
height.Heatmap000
height.HeatmapAnnotation000
height.HeatmapList000
height.Legends0.0080.0000.008
height.SingleAnnotation000
heightAssign.AnnotationFunction000
heightAssign.HeatmapAnnotation000
heightAssign.SingleAnnotation000
heightDetails.annotation_axis000
heightDetails.legend0.0000.0000.001
heightDetails.legend_body000
heightDetails.packed_legends000
ht_global_opt000
ht_opt0.0050.0000.005
is_abs_unit0.0010.0000.000
length.HeatmapAnnotation000
length.HeatmapList000
list_components000
list_to_matrix0.0010.0000.002
make_column_cluster-Heatmap-method000
make_comb_mat0.0040.0000.003
make_layout-Heatmap-method000
make_layout-HeatmapList-method0.0000.0000.001
make_layout-dispatch000
make_row_cluster-Heatmap-method000
map_to_colors-ColorMapping-method0.0130.0000.014
max_text_height0.0020.0000.001
max_text_width0.0010.0000.002
merge_dendrogram0.0710.0000.072
names.HeatmapAnnotation0.0170.0000.018
names.HeatmapList000
namesAssign.HeatmapAnnotation0.0150.0000.015
ncol.Heatmap0.0010.0000.000
nobs.AnnotationFunction0.0040.0000.003
nobs.HeatmapAnnotation0.0010.0000.000
nobs.SingleAnnotation000
normalize_comb_mat0.0000.0000.001
nrow.Heatmap0.0000.0010.000
oncoPrint000
order.comb_mat000
packLegend0.0510.0000.051
pct_v_pct000
pindex0.0050.0000.005
prepare-Heatmap-method000
print.comb_mat0.0000.0000.001
re_size-HeatmapAnnotation-method0.0010.0010.000
restore_matrix0.3170.0030.321
rowAnnotation0.0010.0000.000
row_anno_barplot0.0000.0010.000
row_anno_boxplot000
row_anno_density0.0000.0000.001
row_anno_histogram0.0000.0000.001
row_anno_points0.0000.0000.001
row_anno_text000
row_dend-Heatmap-method0.2470.0050.253
row_dend-HeatmapList-method0.5620.0000.562
row_dend-dispatch000
row_order-Heatmap-method0.2700.0000.271
row_order-HeatmapList-method0.9220.0000.923
row_order-dispatch0.0010.0000.000
set_component_height-Heatmap-method0.0010.0000.000
set_component_width-Heatmap-method0.0010.0000.000
set_name0.0040.0000.003
set_nameAssign0.0090.0000.010
set_size0.0040.0000.003
show-AnnotationFunction-method000
show-ColorMapping-method000
show-Heatmap-method000
show-HeatmapAnnotation-method000
show-HeatmapList-method000
show-SingleAnnotation-method000
show-dispatch000
size.AnnotationFunction0.0110.0000.011
size.HeatmapAnnotation0.0010.0000.000
size.SingleAnnotation0.0010.0010.000
sizeAssign.AnnotationFunction0.0020.0030.005
sizeAssign.HeatmapAnnotation0.0000.0000.001
sizeAssign.SingleAnnotation0.0000.0000.001
smartAlign20.3450.0040.349
str.comb_mat000
subset_gp000
subset_matrix_by_row0.0010.0000.000
subset_vector000
summary.Heatmap0.0000.0000.001
summary.HeatmapList000
t.comb_mat0.0070.0000.006
test_alter_fun0.0590.0000.058
unify_mat_list000
upset_right_annotation000
upset_top_annotation0.0010.0000.000
width.AnnotationFunction0.0070.0000.006
width.Heatmap000
width.HeatmapAnnotation000
width.HeatmapList000
width.Legends0.0090.0000.008
width.SingleAnnotation000
widthAssign.AnnotationFunction000
widthAssign.HeatmapAnnotation000
widthAssign.SingleAnnotation000
widthDetails.annotation_axis000
widthDetails.legend0.0010.0000.000
widthDetails.legend_body000
widthDetails.packed_legends000