Back to Rapid builds (Linux only) of a subset of BioC 3.21 Report updated every 6 hours |
This page was generated on 2024-11-21 09:25 -0500 (Thu, 21 Nov 2024).
Hostname | OS | Arch (*) | R version | Installed pkgs |
---|---|---|---|---|
teran2 | Linux (Ubuntu 24.04.1 LTS) | x86_64 | R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" | 858 |
Click on any hostname to see more info about the system (e.g. compilers) (*) as reported by 'uname -p', except on Windows and Mac OS X |
Package 52/215 | Hostname | OS / Arch | INSTALL | BUILD | CHECK | |||||||
ComplexHeatmap 2.23.0 (landing page) Zuguang Gu
| teran2 | Linux (Ubuntu 24.04.1 LTS) / x86_64 | OK | OK | OK | |||||||
To the developers/maintainers of the ComplexHeatmap package: - Use the following Renviron settings to reproduce errors and warnings. - If 'R CMD check' started to fail recently on the Linux builder(s) over a missing dependency, add the missing dependency to 'Suggests:' in your DESCRIPTION file. See Renviron.bioc for more information. |
Package: ComplexHeatmap |
Version: 2.23.0 |
Command: /home/rapidbuild/bbs-3.21-bioc-rapid/R/bin/R CMD check --install=check:ComplexHeatmap.install-out.txt --library=/home/rapidbuild/bbs-3.21-bioc-rapid/R/site-library --timings ComplexHeatmap_2.23.0.tar.gz |
StartedAt: 2024-11-21 07:54:08 -0500 (Thu, 21 Nov 2024) |
EndedAt: 2024-11-21 07:57:58 -0500 (Thu, 21 Nov 2024) |
EllapsedTime: 229.9 seconds |
RetCode: 0 |
Status: OK |
CheckDir: ComplexHeatmap.Rcheck |
Warnings: 0 |
############################################################################## ############################################################################## ### ### Running command: ### ### /home/rapidbuild/bbs-3.21-bioc-rapid/R/bin/R CMD check --install=check:ComplexHeatmap.install-out.txt --library=/home/rapidbuild/bbs-3.21-bioc-rapid/R/site-library --timings ComplexHeatmap_2.23.0.tar.gz ### ############################################################################## ############################################################################## * using log directory ‘/media/volume/teran2_disk/rapidbuild/bbs-3.21-bioc-rapid/meat/ComplexHeatmap.Rcheck’ * using R Under development (unstable) (2024-11-14 r87333) * using platform: x86_64-pc-linux-gnu * R was compiled by gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0 GNU Fortran (Ubuntu 13.2.0-23ubuntu4) 13.2.0 * running under: Ubuntu 24.04.1 LTS * using session charset: UTF-8 * checking for file ‘ComplexHeatmap/DESCRIPTION’ ... OK * checking extension type ... Package * this is package ‘ComplexHeatmap’ version ‘2.23.0’ * 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 code 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 loading without being on the library search path ... OK * checking whether startup messages can be suppressed ... 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 * 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-interactive.R’ Running ‘test-multiple-page.R’ Running ‘test-oncoPrint.R’ Running ‘test-pheatmap.R’ Running ‘test-textbox.R’ Running ‘test-upset.R’ Running ‘test-utils.R’ Running ‘testthat-all.R’ OK * checking for unstated dependencies in vignettes ... OK * checking package vignettes ... NOTE Package vignettes with \VignetteEngine{} not specifying an engine package: ‘complex_heatmap.rmd’ ‘most_probably_asked_questions.Rmd’ Engines should be specified as \VignetteEngine{PKG::ENG}. * checking re-building of vignette outputs ... OK * checking PDF version of manual ... OK * DONE Status: 1 NOTE See ‘/media/volume/teran2_disk/rapidbuild/bbs-3.21-bioc-rapid/meat/ComplexHeatmap.Rcheck/00check.log’ for details.
ComplexHeatmap.Rcheck/00install.out
############################################################################## ############################################################################## ### ### Running command: ### ### /home/rapidbuild/bbs-3.21-bioc-rapid/R/bin/R CMD INSTALL ComplexHeatmap ### ############################################################################## ############################################################################## * installing to library ‘/media/volume/teran2_disk/rapidbuild/bbs-3.21-bioc-rapid/R/site-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)
ComplexHeatmap.Rcheck/tests/test-annotation_axis.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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.452 0.150 1.588
ComplexHeatmap.Rcheck/tests/test-AnnotationFunction.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.16 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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)) > > > x = runif(10) > cell_fun = function(i) { + pushViewport(viewport(yscale = c(0, 1))) + grid.points(unit(0.5, "npc"), x[i]) + popViewport() + } > anno = AnnotationFunction(cell_fun = cell_fun, var_import = "x") > ha = HeatmapAnnotation(foo = anno) > draw(ha, 1:10, test = T) > > cell_fun = function(i) { + pushViewport(viewport(xscale = c(0, 1))) + grid.points(x[i], unit(0.5, "npc")) + popViewport() + } > anno = AnnotationFunction(cell_fun = cell_fun, var_import = "x", which = "row") > ha = rowAnnotation(foo = anno) > draw(ha, 1:10, test = T) > > # 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") > > > anno = anno_barplot(matrix(nc = 2, c(1:10, 10:1)), beside = TRUE) > draw(anno, test = "a matrix") > draw(anno[1:5], test = "a matrix, subset") > anno = anno_barplot(matrix(nc = 2, c(1:10, 10:1)), beside = TRUE, which = "row") > draw(anno, test = "a matrix, on rows") > anno = anno_barplot(matrix(nc = 2, c(1:10, 10:1)), beside = TRUE, gp = gpar(fill = 2:3, col = 2:3)) > draw(anno, test = "a matrix with fill") > > > ##### 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 = anno_density(t(m), which = "row", xlim = c(-2, 2)) > draw(anno, test = "normal density") > anno = anno_density(t(m), which = "row", type = "violin", xlim = c(-2, 2)) > draw(anno, test = "violin") > anno = anno_density(t(m), which = "row", type = "heatmap", xlim = c(-2, 2)) > draw(anno, test = "heatmap") > > ###### 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)) > > > > #### anno_customize ### > x = sort(sample(letters[1:3], 10, replace = TRUE)) > graphics = list( + "a" = function(x, y, w, h) grid.points(x, y, pch = 16), + "b" = function(x, y, w, h) grid.rect(x, y, w*0.8, h*0.8, gp = gpar(fill = "red")), + "c" = function(x, y, w, h) grid.segments(x - 0.5*w, y - 0.5*h, x + 0.5*w, y + 0.5*h, gp = gpar(lty = 2)) + ) > > anno = anno_customize(x, graphics = graphics) > draw(anno, index = 1:10, test = "") > > anno = anno_customize(c(x, "d"), graphics = graphics) Note: following levels in `x` have no graphics defined: d. Set `verbose = FALSE` in `anno_customize()` to turn off this message. > > ### anno_numeric ## > x = runif(10) > anno = anno_numeric(x) > draw(anno, 1:10, test = TRUE) > anno = anno_numeric(x, align_to = "right") > draw(anno, 1:10, test = TRUE) > > > x = 10^(-runif(10, 1, 6)) > anno = anno_numeric(x, x_convert = function(x) -log10(x), labels_format = function(x) sprintf("%.2e", x)) > draw(anno, 1:10, test = TRUE) > > x = runif(10, -1, 1) > anno = anno_numeric(x) > draw(anno, 1:10, test = TRUE) > anno = anno_numeric(x, labels_gp = gpar(col = c("green", "red"))) > draw(anno, 1:10, test = TRUE) > > anno = anno_numeric(x, bg_gp = gpar(col = c("green", "red"))) > draw(anno, 1:10, test = TRUE) > > > x = runif(10, 0.5, 1.5) > anno = anno_numeric(x, align_to = 0) > draw(anno, 1:10, test = TRUE) > > > > > > proc.time() user system elapsed 11.884 0.333 12.207
ComplexHeatmap.Rcheck/tests/test-ColorMapping-class.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.16 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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) > > ha = SingleAnnotation(value = rep(NA, 10), name = "foo") > cm = ha@color_mapping > color_mapping_legend(cm) > > > proc.time() user system elapsed 1.644 0.187 1.815
ComplexHeatmap.Rcheck/tests/test-dendrogram.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.16 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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.19.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 You may ask questions at stackoverflow, use the r and dendextend tags: https://stackoverflow.com/questions/tagged/dendextend 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) > > # node attr > m = matrix(rnorm(100), 10) > dend = as.dendrogram(hclust(dist(m))) > require(dendextend) > dend1 = color_branches(dend, k = 2, col = 1:2) > grid.dendrogram(dend1, test = T) > dend1 = dend > dend1 = dendrapply(dend, function(d) { + attr(d, "nodePar") = list(pch = sample(20, 1), cex = runif(1, min = 0.3, max = 1.3), col = rand_color(1)) + d + }) > grid.dendrogram(dend1, test = T) > > Heatmap(m, cluster_rows = dend1, cluster_columns = dend1) > > d1 = ComplexHeatmap:::dend_edit_node(dend, method = "top-bottom", function(d, index) { + attr(d, "depth") = length(index) + d + }) > > d2 = ComplexHeatmap:::dend_edit_node(dend, method = "bottom-top", function(d, index) { + attr(d, "depth") = length(index) + d + }) > > identical(d1, d2) [1] TRUE > > proc.time() user system elapsed 4.488 0.330 4.805
ComplexHeatmap.Rcheck/tests/test-gridtext.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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.919 0.288 3.189
ComplexHeatmap.Rcheck/tests/test-Heatmap-class.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.16 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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.19.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 You may ask questions at stackoverflow, use the r and dendextend tags: https://stackoverflow.com/questions/tagged/dendextend 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:3) > 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 14.001 0.374 14.329
ComplexHeatmap.Rcheck/tests/test-Heatmap-cluster.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.16 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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.704 0.200 1.889
ComplexHeatmap.Rcheck/tests/test-HeatmapAnnotation.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.16 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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 subsettable 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 subsettable 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 subsettable 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) > > > ### test whether arguments can be captured > HeatmapAnnotation(a = 1:10) A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_38 position: column items: 10 width: 1npc height: 5mm this object is subsettable 3.35373333333333mm extension on the right name annotation_type color_mapping height a continuous vector random 5mm > rowAnnotation(a = 1:10) A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_39 position: row items: 10 width: 5mm height: 1npc this object is subsettable 3.35373333333333mm extension on the bottom name annotation_type color_mapping width a continuous vector random 5mm > columnAnnotation(a = 1:10) A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_40 position: column items: 10 width: 1npc height: 5mm this object is subsettable 3.35373333333333mm extension on the right name annotation_type color_mapping height a continuous vector random 5mm > do.call(HeatmapAnnotation, list(a = 1:10)) A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_41 position: column items: 10 width: 1npc height: 5mm this object is subsettable 3.35373333333333mm extension on the right name annotation_type color_mapping height a continuous vector random 5mm > do.call(rowAnnotation, list(a = 1:10)) A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_42 position: row items: 10 width: 5mm height: 1npc this object is subsettable 3.35373333333333mm extension on the bottom name annotation_type color_mapping width a continuous vector random 5mm > do.call(columnAnnotation, list(a = 1:10)) A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_43 position: column items: 10 width: 1npc height: 5mm this object is subsettable 3.35373333333333mm extension on the right name annotation_type color_mapping height a continuous vector random 5mm > do.call("HeatmapAnnotation", list(a = 1:10)) A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_44 position: column items: 10 width: 1npc height: 5mm this object is subsettable 3.35373333333333mm extension on the right name annotation_type color_mapping height a continuous vector random 5mm > do.call("rowAnnotation", list(a = 1:10)) A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_45 position: row items: 10 width: 5mm height: 1npc this object is subsettable 3.35373333333333mm extension on the bottom name annotation_type color_mapping width a continuous vector random 5mm > do.call("columnAnnotation", list(a = 1:10)) A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_46 position: column items: 10 width: 1npc height: 5mm this object is subsettable 3.35373333333333mm extension on the right name annotation_type color_mapping height a continuous vector random 5mm > > f = function() HeatmapAnnotation(a = 1:10) > f() A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_47 position: column items: 10 width: 1npc height: 5mm this object is subsettable 3.35373333333333mm extension on the right name annotation_type color_mapping height a continuous vector random 5mm > f = function() rowAnnotation(a = 1:10) > f() A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_48 position: row items: 10 width: 5mm height: 1npc this object is subsettable 3.35373333333333mm extension on the bottom name annotation_type color_mapping width a continuous vector random 5mm > f = function() columnAnnotation(a = 1:10) > f() A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_49 position: column items: 10 width: 1npc height: 5mm this object is subsettable 3.35373333333333mm extension on the right name annotation_type color_mapping height a continuous vector random 5mm > > sapply(1, function(x) HeatmapAnnotation(a = 1:10)) [[1]] A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_50 position: column items: 10 width: 1npc height: 5mm this object is subsettable 3.35373333333333mm extension on the right name annotation_type color_mapping height a continuous vector random 5mm > sapply(1, function(x) rowAnnotation(a = 1:10)) [[1]] A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_51 position: row items: 10 width: 5mm height: 1npc this object is subsettable 3.35373333333333mm extension on the bottom name annotation_type color_mapping width a continuous vector random 5mm > sapply(1, function(x) columnAnnotation(a = 1:10)) [[1]] A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_52 position: column items: 10 width: 1npc height: 5mm this object is subsettable 3.35373333333333mm extension on the right name annotation_type color_mapping height a continuous vector random 5mm > > mapply(function(x, y) HeatmapAnnotation(a = 1:10), list(1), list(1)) [[1]] A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_53 position: column items: 10 width: 1npc height: 5mm this object is subsettable 3.35373333333333mm extension on the right name annotation_type color_mapping height a continuous vector random 5mm > mapply(function(x, y) rowAnnotation(a = 1:10), list(1), list(1)) [[1]] A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_54 position: row items: 10 width: 5mm height: 1npc this object is subsettable 3.35373333333333mm extension on the bottom name annotation_type color_mapping width a continuous vector random 5mm > mapply(function(x, y) columnAnnotation(a = 1:10), list(1), list(1)) [[1]] A HeatmapAnnotation object with 1 annotation name: heatmap_annotation_55 position: column items: 10 width: 1npc height: 5mm this object is subsettable 3.35373333333333mm extension on the right name annotation_type color_mapping height a continuous vector random 5mm > > > try({ + HeatmapAnnotation(1:10) + HeatmapAnnotation(df = data.frame(a = 1:10), a = 1:10) + }) Error : The annotation should be specified as name-value pairs or via argument `df` with a data frame. > > proc.time() user system elapsed 8.398 0.320 8.704
ComplexHeatmap.Rcheck/tests/test-HeatmapList-class.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.16 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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 10.717 0.262 10.967
ComplexHeatmap.Rcheck/tests/test-interactive.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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. > > if(0) { + + m = matrix(rnorm(100), 10) + rownames(m) = 1:10 + colnames(m) = 1:10 + + ht = Heatmap(m) + ht = draw(ht) + selectArea(ht) + + + + ht = Heatmap(m, row_km = 2, column_km = 2) + ht = draw(ht) + selectArea(ht) + + + ht = Heatmap(m, row_km = 2, column_km = 2) + Heatmap(m, row_km = 2, column_km = 2) + ht = draw(ht) + selectArea(ht) + + pdf("~/test.pdf") + ht = Heatmap(m) + ht = draw(ht) + selectArea(ht, pos1 = unit(c(1, 1), "cm"), pos2 = unit(c(4, 4), "cm"), verbose = TRUE) + + set.seed(123) + ht = Heatmap(m, row_km = 2, column_km = 2) + ht = draw(ht) + selectArea(ht, pos1 = unit(c(1, 1), "cm"), pos2 = unit(c(8, 8), "cm"), verbose = TRUE) + dev.off() + + png("~/test-1.png") + ht = Heatmap(m) + ht = draw(ht) + selectArea(ht, pos1 = unit(c(1, 1), "cm"), pos2 = unit(c(4, 4), "cm"), verbose = TRUE) + dev.off() + + png("~/test-2.png") + set.seed(123) + ht = Heatmap(m, row_km = 2, column_km = 2) + ht = draw(ht) + selectArea(ht, pos1 = unit(c(1, 1), "cm"), pos2 = unit(c(8, 8), "cm"), verbose = TRUE) + dev.off() + + } > > proc.time() user system elapsed 0.109 0.045 0.142
ComplexHeatmap.Rcheck/tests/test-Legend.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.16 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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 = rev(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") > > > lgd = Legend(col_fun = col_fun, title = "foo", title_position = "lefttop", direction = "horizontal") > draw(lgd, test = "lefttop 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 = rev(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") > > > col_fun = colorRamp2(c(0, 0.05, 0.1, 0.5, 1), c("green", "white", "red", "black", "blue")) > lgd = Legend(col_fun = col_fun, title = "foo", break_dist = 1:4) > draw(lgd, test = "unequal interval breaks") > > > #### 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.513 0.220 2.718
ComplexHeatmap.Rcheck/tests/test-multiple-page.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.16 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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.096 0.185 4.269
ComplexHeatmap.Rcheck/tests/test-oncoPrint.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.16 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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. `alter_fun` is assumed vectorizable. If it does not generate correct plot, please set `alter_fun_is_vectorized = FALSE` in `oncoPrint()`. > 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. `alter_fun` is assumed vectorizable. If it does not generate correct plot, please set `alter_fun_is_vectorized = FALSE` in `oncoPrint()`. > 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. `alter_fun` is assumed vectorizable. If it does not generate correct plot, please set `alter_fun_is_vectorized = FALSE` in `oncoPrint()`. > 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. `alter_fun` is assumed vectorizable. If it does not generate correct plot, please set `alter_fun_is_vectorized = FALSE` in `oncoPrint()`. > 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. `alter_fun` is assumed vectorizable. If it does not generate correct plot, please set `alter_fun_is_vectorized = FALSE` in `oncoPrint()`. > 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. `alter_fun` is assumed vectorizable. If it does not generate correct plot, please set `alter_fun_is_vectorized = FALSE` in `oncoPrint()`. > 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. `alter_fun` is assumed vectorizable. If it does not generate correct plot, please set `alter_fun_is_vectorized = FALSE` in `oncoPrint()`. > 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. `alter_fun` is assumed vectorizable. If it does not generate correct plot, please set `alter_fun_is_vectorized = FALSE` in `oncoPrint()`. > draw(ht) > > > proc.time() user system elapsed 5.319 0.272 5.579
ComplexHeatmap.Rcheck/tests/test-pheatmap.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! This message can be suppressed by: suppressPackageStartupMessages(library(ComplexHeatmap)) ======================================== > > if(requireNamespace("pheatmap")) { + mat = matrix(rnorm(100), 10) + + compare_pheatmap(mat) + + pheatmap(mat) + pheatmap(mat, col = rev(RColorBrewer::brewer.pal(n = 7, name = "RdYlBu"))) + + test = matrix(rnorm(200), 20, 10) + test[1:10, seq(1, 10, 2)] = test[1:10, seq(1, 10, 2)] + 3 + test[11:20, seq(2, 10, 2)] = test[11:20, seq(2, 10, 2)] + 2 + test[15:20, seq(2, 10, 2)] = test[15:20, seq(2, 10, 2)] + 4 + colnames(test) = paste("Test", 1:10, sep = "") + rownames(test) = paste("Gene", 1:20, sep = "") + + # Draw heatmaps + compare_pheatmap(test) + compare_pheatmap(test, kmeans_k = 2) + compare_pheatmap(test, scale = "row", clustering_distance_rows = "correlation") + compare_pheatmap(test, color = colorRampPalette(c("navy", "white", "firebrick3"))(50)) + compare_pheatmap(test, cluster_row = FALSE) + compare_pheatmap(test, legend = FALSE) + + # Show text within cells + compare_pheatmap(test, display_numbers = TRUE) + compare_pheatmap(test, display_numbers = TRUE, number_format = "%.1e") + compare_pheatmap(test, display_numbers = matrix(ifelse(test > 5, "*", ""), nrow(test))) + compare_pheatmap(test, cluster_row = FALSE, legend_breaks = -1:4, legend_labels = c("0", + "1e-4", "1e-3", "1e-2", "1e-1", "1")) + + # Fix cell sizes and save to file with correct size + compare_pheatmap(test, cellwidth = 15, cellheight = 12, main = "Example heatmap") + + # Generate annotations for rows and columns + annotation_col = data.frame( + CellType = factor(rep(c("CT1", "CT2"), 5)), + Time = 1:5 + ) + rownames(annotation_col) = paste("Test", 1:10, sep = "") + + annotation_row = data.frame( + GeneClass = factor(rep(c("Path1", "Path2", "Path3"), c(10, 4, 6))) + ) + rownames(annotation_row) = paste("Gene", 1:20, sep = "") + + # Display row and color annotations + compare_pheatmap(test, annotation_col = annotation_col) + compare_pheatmap(test, annotation_col = annotation_col, annotation_legend = FALSE) + compare_pheatmap(test, annotation_col = annotation_col, annotation_row = annotation_row) + + # Change angle of text in the columns + compare_pheatmap(test, annotation_col = annotation_col, annotation_row = annotation_row, angle_col = "45") + compare_pheatmap(test, annotation_col = annotation_col, angle_col = "0") + + # Specify colors + ann_colors = list( + Time = c("white", "firebrick"), + CellType = c(CT1 = "#1B9E77", CT2 = "#D95F02"), + GeneClass = c(Path1 = "#7570B3", Path2 = "#E7298A", Path3 = "#66A61E") + ) + + compare_pheatmap(test, annotation_col = annotation_col, annotation_colors = ann_colors, main = "Title") + compare_pheatmap(test, annotation_col = annotation_col, annotation_row = annotation_row, + annotation_colors = ann_colors) + compare_pheatmap(test, annotation_col = annotation_col, annotation_colors = ann_colors[2]) + + # Gaps in heatmaps + compare_pheatmap(test, annotation_col = annotation_col, cluster_rows = FALSE, gaps_row = c(10, 14)) + compare_pheatmap(test, annotation_col = annotation_col, cluster_rows = FALSE, gaps_row = c(10, 14), + cutree_col = 2) + + # Show custom strings as row/col names + labels_row = c("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", + "", "", "Il10", "Il15", "Il1b") + + compare_pheatmap(test, annotation_col = annotation_col, labels_row = labels_row) + + # Specifying clustering from distance matrix + drows = dist(test, method = "minkowski") + dcols = dist(t(test), method = "minkowski") + compare_pheatmap(test, clustering_distance_rows = drows, clustering_distance_cols = dcols) + + library(dendsort) + + callback = function(hc, ...){dendsort(hc)} + compare_pheatmap(test, clustering_callback = callback) + } Loading required namespace: pheatmap Warning message: argument `kmeans_k` is not suggested to use in pheatmap -> Heatmap translation because it changes the input matrix. You might check `row_km` and `column_km` arguments in Heatmap(). > > > set.seed(42) > nsamples <- 10 > > mat <- matrix(rpois(20*nsamples, 20), ncol=nsamples) > colnames(mat) <- paste0("sample", seq_len(ncol(mat))) > rownames(mat) <- paste0("gene", seq_len(nrow(mat))) > > annot <- data.frame( + labs = sample(c("A","B","C","D"), size = ncol(mat), replace = TRUE), + row.names = colnames(mat) + ) > ins <- list(mat = mat, annotation_col = annot) > do.call(ComplexHeatmap::pheatmap, ins[1]) > do.call(ComplexHeatmap::pheatmap, ins) > > proc.time() user system elapsed 16.018 0.287 16.298
ComplexHeatmap.Rcheck/tests/test-SingleAnnotation.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.16 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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.828 0.235 3.047
ComplexHeatmap.Rcheck/tests/test-textbox.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! This message can be suppressed by: suppressPackageStartupMessages(library(ComplexHeatmap)) ======================================== > > words = sapply(1:30, function(x) strrep(sample(letters, 1), sample(3:10, 1))) > grid.newpage() > grid.textbox(words, gp = gpar(fontsize = runif(30, min = 5, max = 30))) > > sentenses = c("This is sentense 1", "This is a long long long long long long long sentense.") > grid.newpage() > grid.textbox(sentenses) > grid.textbox(sentenses, word_wrap = TRUE) > grid.textbox(sentenses, word_wrap = TRUE, add_new_line = TRUE) > > > require(circlize) Loading required package: circlize ======================================== circlize version 0.4.16 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)) ======================================== > mat = matrix(rnorm(100*10), nrow = 100) > > split = sample(letters[1:10], 100, replace = TRUE) > text = lapply(unique(split), function(x) { + data.frame(month.name, col = rand_color(12, friendly = TRUE), fontsize = runif(12, 6, 14)) + }) > names(text) = unique(split) > > Heatmap(mat, cluster_rows = FALSE, row_split = split, + right_annotation = rowAnnotation(wc = anno_textbox(split, text)) + ) > > proc.time() user system elapsed 2.744 0.241 2.971
ComplexHeatmap.Rcheck/tests/test-upset.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.16 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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: generics Attaching package: 'generics' The following objects are masked from 'package:base': as.difftime, as.factor, as.ordered, intersect, is.element, setdiff, setequal, union Attaching package: 'BiocGenerics' 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, aperm, append, as.data.frame, basename, cbind, colnames, dirname, do.call, duplicated, eval, evalq, get, grep, grepl, is.unsorted, lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind, rownames, sapply, saveRDS, table, tapply, unique, unsplit, which.max, which.min Loading required package: S4Vectors Attaching package: 'S4Vectors' The following object is masked from 'package:utils': findMatches The following objects are masked from 'package:base': I, expand.grid, unname 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] + }) + } > > > proc.time() user system elapsed 9.048 0.297 9.332
ComplexHeatmap.Rcheck/tests/test-utils.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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.16 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.23.0 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 either one: - Gu, Z. Complex Heatmap Visualization. iMeta 2022. - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional genomic data. Bioinformatics 2016. The new InteractiveComplexHeatmap package can directly export static complex heatmaps into an interactive Shiny app with zero effort. Have a try! 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.703 0.188 1.878
ComplexHeatmap.Rcheck/tests/testthat-all.Rout
R Under development (unstable) (2024-11-14 r87333) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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") [ FAIL 0 | WARN 0 | SKIP 0 | PASS 181 ] > > proc.time() user system elapsed 13.273 0.409 20.396
ComplexHeatmap.Rcheck/ComplexHeatmap-Ex.timings
name | user | system | elapsed | |
AdditiveUnit-class | 0 | 0 | 0 | |
AdditiveUnit | 0.000 | 0.001 | 0.000 | |
AnnotationFunction-class | 0 | 0 | 0 | |
AnnotationFunction | 2.856 | 0.099 | 2.957 | |
ColorMapping-class | 0 | 0 | 0 | |
ColorMapping | 0.008 | 0.000 | 0.008 | |
ComplexHeatmap-package | 0 | 0 | 0 | |
Extract.AnnotationFunction | 0.014 | 0.000 | 0.014 | |
Extract.Heatmap | 0.327 | 0.000 | 0.326 | |
Extract.HeatmapAnnotation | 0.027 | 0.000 | 0.027 | |
Extract.HeatmapList | 0.097 | 0.002 | 0.098 | |
Extract.SingleAnnotation | 0.01 | 0.00 | 0.01 | |
Extract.comb_mat | 0.005 | 0.000 | 0.005 | |
Extract.gridtext | 0 | 0 | 0 | |
Heatmap-class | 0.000 | 0.001 | 0.000 | |
Heatmap | 0 | 0 | 0 | |
Heatmap3D | 0.097 | 0.000 | 0.096 | |
HeatmapAnnotation-class | 0 | 0 | 0 | |
HeatmapAnnotation | 0 | 0 | 0 | |
HeatmapList-class | 0 | 0 | 0 | |
HeatmapList | 0 | 0 | 0 | |
Legend | 0.045 | 0.000 | 0.045 | |
Legends-class | 0.004 | 0.000 | 0.004 | |
Legends | 0.000 | 0.000 | 0.001 | |
SingleAnnotation-class | 0 | 0 | 0 | |
SingleAnnotation | 0.038 | 0.000 | 0.038 | |
UpSet | 0.319 | 0.001 | 0.319 | |
add.AdditiveUnit | 0 | 0 | 0 | |
add_heatmap-Heatmap-method | 0 | 0 | 0 | |
add_heatmap-HeatmapAnnotation-method | 0 | 0 | 0 | |
add_heatmap-HeatmapList-method | 0 | 0 | 0 | |
add_heatmap-dispatch | 0 | 0 | 0 | |
adjust_dend_by_x | 0.007 | 0.001 | 0.009 | |
adjust_heatmap_list-HeatmapList-method | 0 | 0 | 0 | |
alter_graphic | 0.100 | 0.000 | 0.099 | |
anno_barplot | 0.013 | 0.000 | 0.013 | |
anno_block | 0.655 | 0.001 | 0.656 | |
anno_boxplot | 0.021 | 0.000 | 0.020 | |
anno_customize | 0.428 | 0.001 | 0.430 | |
anno_density | 0.354 | 0.014 | 0.368 | |
anno_empty | 0.008 | 0.003 | 0.011 | |
anno_histogram | 0.044 | 0.001 | 0.046 | |
anno_horizon | 2.813 | 0.021 | 2.836 | |
anno_image | 0 | 0 | 0 | |
anno_joyplot | 0.332 | 0.007 | 0.340 | |
anno_lines | 0.064 | 0.001 | 0.064 | |
anno_link | 0 | 0 | 0 | |
anno_mark | 0.310 | 0.000 | 0.311 | |
anno_numeric | 0.117 | 0.000 | 0.117 | |
anno_oncoprint_barplot | 0 | 0 | 0 | |
anno_points | 0.012 | 0.000 | 0.013 | |
anno_simple | 0.033 | 0.001 | 0.035 | |
anno_summary | 0.210 | 0.000 | 0.211 | |
anno_text | 0.043 | 0.000 | 0.043 | |
anno_textbox | 0.407 | 0.000 | 0.407 | |
anno_zoom | 0.216 | 0.002 | 0.219 | |
annotation_axis_grob | 0.040 | 0.002 | 0.042 | |
annotation_legend_size-HeatmapList-method | 0 | 0 | 0 | |
attach_annotation-Heatmap-method | 0.364 | 0.000 | 0.365 | |
bar3D | 0.004 | 0.000 | 0.005 | |
bin_genome | 0 | 0 | 0 | |
c.ColorMapping | 0.001 | 0.000 | 0.001 | |
c.HeatmapAnnotation | 0.021 | 0.000 | 0.022 | |
cluster_between_groups | 0.015 | 0.000 | 0.015 | |
cluster_within_group | 0.013 | 0.000 | 0.012 | |
color_mapping_legend-ColorMapping-method | 0 | 0 | 0 | |
columnAnnotation | 0.000 | 0.001 | 0.000 | |
column_dend-Heatmap-method | 0.192 | 0.000 | 0.192 | |
column_dend-HeatmapList-method | 0.635 | 0.004 | 0.639 | |
column_dend-dispatch | 0.000 | 0.001 | 0.000 | |
column_order-Heatmap-method | 0.182 | 0.001 | 0.185 | |
column_order-HeatmapList-method | 0.685 | 0.003 | 0.690 | |
column_order-dispatch | 0 | 0 | 0 | |
comb_degree | 0.002 | 0.000 | 0.002 | |
comb_name | 0.001 | 0.000 | 0.002 | |
comb_size | 0.000 | 0.001 | 0.001 | |
compare_heatmap.2 | 0.662 | 0.003 | 0.665 | |
compare_heatmap | 0.470 | 0.001 | 0.471 | |
compare_pheatmap | 0.833 | 0.002 | 0.835 | |
complement_size | 0.001 | 0.000 | 0.000 | |
component_height-Heatmap-method | 0 | 0 | 0 | |
component_height-HeatmapList-method | 0 | 0 | 0 | |
component_height-dispatch | 0.001 | 0.000 | 0.000 | |
component_width-Heatmap-method | 0.000 | 0.001 | 0.000 | |
component_width-HeatmapList-method | 0 | 0 | 0 | |
component_width-dispatch | 0 | 0 | 0 | |
copy_all-AnnotationFunction-method | 0 | 0 | 0 | |
copy_all-SingleAnnotation-method | 0 | 0 | 0 | |
copy_all-dispatch | 0 | 0 | 0 | |
decorate_annotation | 0.155 | 0.001 | 0.156 | |
decorate_column_dend | 0 | 0 | 0 | |
decorate_column_names | 0 | 0 | 0 | |
decorate_column_title | 0 | 0 | 0 | |
decorate_dend | 0.086 | 0.000 | 0.086 | |
decorate_dimnames | 0.105 | 0.000 | 0.105 | |
decorate_heatmap_body | 0.070 | 0.001 | 0.071 | |
decorate_row_dend | 0 | 0 | 0 | |
decorate_row_names | 0 | 0 | 0 | |
decorate_row_title | 0 | 0 | 0 | |
decorate_title | 0.084 | 0.001 | 0.086 | |
default_axis_param | 0.000 | 0.001 | 0.000 | |
default_get_type | 0 | 0 | 0 | |
dend_heights | 0 | 0 | 0 | |
dend_xy | 0.005 | 0.000 | 0.007 | |
dendrogramGrob | 0 | 0 | 0 | |
densityHeatmap | 0.679 | 0.002 | 0.683 | |
dim.Heatmap | 0 | 0 | 0 | |
dist2 | 0.007 | 0.000 | 0.008 | |
draw-AnnotationFunction-method | 0 | 0 | 0 | |
draw-Heatmap-method | 0.000 | 0.000 | 0.001 | |
draw-HeatmapAnnotation-method | 0 | 0 | 0 | |
draw-HeatmapList-method | 0 | 0 | 0 | |
draw-Legends-method | 0.008 | 0.000 | 0.009 | |
draw-SingleAnnotation-method | 0 | 0 | 0 | |
draw-dispatch | 0 | 0 | 0 | |
draw_annotation-Heatmap-method | 0 | 0 | 0 | |
draw_annotation_legend-HeatmapList-method | 0 | 0 | 0 | |
draw_dend-Heatmap-method | 0 | 0 | 0 | |
draw_dimnames-Heatmap-method | 0.000 | 0.000 | 0.001 | |
draw_heatmap_body-Heatmap-method | 0 | 0 | 0 | |
draw_heatmap_legend-HeatmapList-method | 0.001 | 0.000 | 0.000 | |
draw_heatmap_list-HeatmapList-method | 0 | 0 | 0 | |
draw_title-Heatmap-method | 0 | 0 | 0 | |
draw_title-HeatmapList-method | 0 | 0 | 0 | |
draw_title-dispatch | 0 | 0 | 0 | |
extract_comb | 0.002 | 0.000 | 0.001 | |
frequencyHeatmap | 0.300 | 0.000 | 0.299 | |
full_comb_code | 0.001 | 0.001 | 0.001 | |
getXY_in_parent_vp | 0.004 | 0.000 | 0.005 | |
get_color_mapping_list-HeatmapAnnotation-method | 0 | 0 | 0 | |
get_legend_param_list-HeatmapAnnotation-method | 0 | 0 | 0 | |
grid.annotation_axis | 0 | 0 | 0 | |
grid.boxplot | 0.004 | 0.000 | 0.004 | |
grid.dendrogram | 0.172 | 0.005 | 0.176 | |
grid.draw.Legends | 0.007 | 0.001 | 0.007 | |
grid.textbox | 0 | 0 | 0 | |
gt_render | 0.52 | 0.01 | 0.53 | |
heatmap_legend_size-HeatmapList-method | 0 | 0 | 0 | |
height.AnnotationFunction | 0.004 | 0.000 | 0.004 | |
height.Heatmap | 0 | 0 | 0 | |
height.HeatmapAnnotation | 0.000 | 0.000 | 0.001 | |
height.HeatmapList | 0 | 0 | 0 | |
height.Legends | 0.008 | 0.000 | 0.009 | |
height.SingleAnnotation | 0 | 0 | 0 | |
heightAssign.AnnotationFunction | 0 | 0 | 0 | |
heightAssign.HeatmapAnnotation | 0 | 0 | 0 | |
heightAssign.SingleAnnotation | 0 | 0 | 0 | |
heightDetails.annotation_axis | 0.000 | 0.001 | 0.000 | |
heightDetails.legend | 0 | 0 | 0 | |
heightDetails.legend_body | 0 | 0 | 0 | |
heightDetails.packed_legends | 0 | 0 | 0 | |
heightDetails.textbox | 0 | 0 | 0 | |
ht_global_opt | 0.001 | 0.000 | 0.001 | |
ht_opt | 0.004 | 0.000 | 0.004 | |
ht_size | 0 | 0 | 0 | |
is_abs_unit | 0.001 | 0.000 | 0.001 | |
length.HeatmapAnnotation | 0 | 0 | 0 | |
length.HeatmapList | 0 | 0 | 0 | |
list_components | 0 | 0 | 0 | |
list_to_matrix | 0.000 | 0.001 | 0.001 | |
make_column_cluster-Heatmap-method | 0.000 | 0.001 | 0.000 | |
make_comb_mat | 0.002 | 0.000 | 0.003 | |
make_layout-Heatmap-method | 0 | 0 | 0 | |
make_layout-HeatmapList-method | 0 | 0 | 0 | |
make_layout-dispatch | 0 | 0 | 0 | |
make_row_cluster-Heatmap-method | 0 | 0 | 0 | |
map_to_colors-ColorMapping-method | 0.009 | 0.001 | 0.011 | |
max_text_height | 0.001 | 0.000 | 0.001 | |
max_text_width | 0.001 | 0.000 | 0.001 | |
merge_dendrogram | 0.048 | 0.000 | 0.048 | |
names.HeatmapAnnotation | 0.009 | 0.000 | 0.009 | |
names.HeatmapList | 0 | 0 | 0 | |
namesAssign.HeatmapAnnotation | 0.009 | 0.000 | 0.009 | |
ncol.Heatmap | 0 | 0 | 0 | |
nobs.AnnotationFunction | 0.001 | 0.000 | 0.001 | |
nobs.HeatmapAnnotation | 0 | 0 | 0 | |
nobs.SingleAnnotation | 0 | 0 | 0 | |
normalize_comb_mat | 0 | 0 | 0 | |
normalize_genomic_signals_to_bins | 0.000 | 0.001 | 0.000 | |
nrow.Heatmap | 0 | 0 | 0 | |
oncoPrint | 0 | 0 | 0 | |
order.comb_mat | 0 | 0 | 0 | |
packLegend | 0.038 | 0.000 | 0.038 | |
pct_v_pct | 0 | 0 | 0 | |
pheatmap | 0 | 0 | 0 | |
pindex | 0.003 | 0.000 | 0.003 | |
plot.Heatmap | 0 | 0 | 0 | |
plot.HeatmapAnnotation | 0 | 0 | 0 | |
plot.HeatmapList | 0 | 0 | 0 | |
prepare-Heatmap-method | 0 | 0 | 0 | |
print.comb_mat | 0.000 | 0.000 | 0.001 | |
re_size-HeatmapAnnotation-method | 0 | 0 | 0 | |
restore_matrix | 0.227 | 0.000 | 0.227 | |
rowAnnotation | 0 | 0 | 0 | |
row_anno_barplot | 0 | 0 | 0 | |
row_anno_boxplot | 0.001 | 0.000 | 0.000 | |
row_anno_density | 0 | 0 | 0 | |
row_anno_histogram | 0 | 0 | 0 | |
row_anno_points | 0.000 | 0.000 | 0.001 | |
row_anno_text | 0 | 0 | 0 | |
row_dend-Heatmap-method | 0.168 | 0.002 | 0.171 | |
row_dend-HeatmapList-method | 0.453 | 0.000 | 0.453 | |
row_dend-dispatch | 0 | 0 | 0 | |
row_order-Heatmap-method | 0.176 | 0.001 | 0.177 | |
row_order-HeatmapList-method | 0.444 | 0.002 | 0.446 | |
row_order-dispatch | 0.001 | 0.000 | 0.000 | |
set_component_height-Heatmap-method | 0 | 0 | 0 | |
set_component_width-Heatmap-method | 0 | 0 | 0 | |
set_name | 0.002 | 0.000 | 0.001 | |
set_nameAssign | 0.003 | 0.000 | 0.003 | |
set_size | 0.001 | 0.000 | 0.001 | |
show-AnnotationFunction-method | 0 | 0 | 0 | |
show-ColorMapping-method | 0 | 0 | 0 | |
show-Heatmap-method | 0 | 0 | 0 | |
show-HeatmapAnnotation-method | 0 | 0 | 0 | |
show-HeatmapList-method | 0 | 0 | 0 | |
show-SingleAnnotation-method | 0 | 0 | 0 | |
show-dispatch | 0 | 0 | 0 | |
size.AnnotationFunction | 0.004 | 0.000 | 0.004 | |
size.HeatmapAnnotation | 0 | 0 | 0 | |
size.SingleAnnotation | 0 | 0 | 0 | |
sizeAssign.AnnotationFunction | 0.002 | 0.000 | 0.002 | |
sizeAssign.HeatmapAnnotation | 0 | 0 | 0 | |
sizeAssign.SingleAnnotation | 0 | 0 | 0 | |
smartAlign2 | 0.131 | 0.003 | 0.135 | |
str.comb_mat | 0 | 0 | 0 | |
subset_gp | 0.001 | 0.000 | 0.000 | |
subset_matrix_by_row | 0 | 0 | 0 | |
subset_no | 0 | 0 | 0 | |
subset_vector | 0 | 0 | 0 | |
summary.Heatmap | 0 | 0 | 0 | |
summary.HeatmapList | 0 | 0 | 0 | |
t.comb_mat | 0.003 | 0.000 | 0.003 | |
test_alter_fun | 0.031 | 0.001 | 0.032 | |
textbox_grob | 0.061 | 0.000 | 0.061 | |
unify_mat_list | 0 | 0 | 0 | |
upset_left_annotation | 0 | 0 | 0 | |
upset_right_annotation | 0 | 0 | 0 | |
upset_top_annotation | 0 | 0 | 0 | |
width.AnnotationFunction | 0.004 | 0.000 | 0.004 | |
width.Heatmap | 0.000 | 0.000 | 0.001 | |
width.HeatmapAnnotation | 0 | 0 | 0 | |
width.HeatmapList | 0 | 0 | 0 | |
width.Legends | 0.01 | 0.00 | 0.01 | |
width.SingleAnnotation | 0 | 0 | 0 | |
widthAssign.AnnotationFunction | 0 | 0 | 0 | |
widthAssign.HeatmapAnnotation | 0 | 0 | 0 | |
widthAssign.SingleAnnotation | 0 | 0 | 0 | |
widthDetails.annotation_axis | 0 | 0 | 0 | |
widthDetails.legend | 0.001 | 0.000 | 0.000 | |
widthDetails.legend_body | 0 | 0 | 0 | |
widthDetails.packed_legends | 0 | 0 | 0 | |
widthDetails.textbox | 0.000 | 0.000 | 0.001 | |