library(ComplexHeatmap)
#> Loading required package: grid
#> ========================================
#> ComplexHeatmap version 2.20.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(pheatmap)
#>
#> Attaching package: 'pheatmap'
#> The following object is masked from 'package:ComplexHeatmap':
#>
#> pheatmap
library(gplots)
#>
#> Attaching package: 'gplots'
#> The following object is masked from 'package:stats':
#>
#> lowess
library(ggalign)
#> Loading required package: ggplot2
A simple heatmap.
bench::mark(
"heatmap()" = {
pdf(NULL)
heatmap(mat, Rowv = NA, Colv = NA)
dev.off()
NULL
},
"heatmap.2()" = {
pdf(NULL)
heatmap.2(mat, dendrogram = "none", trace = "none")
dev.off()
NULL
},
"Heatmap()" = {
pdf(NULL)
draw(Heatmap(mat, cluster_rows = FALSE, cluster_columns = FALSE))
dev.off()
NULL
},
"pheatmap()" = {
pdf(NULL)
pheatmap(mat, cluster_rows = FALSE, cluster_cols = FALSE)
dev.off()
NULL
},
"ggalign()" = {
pdf(NULL)
print(ggheatmap(mat))
dev.off()
NULL
}
)
#> → heatmap built with `geom_raster()`
#> → heatmap built with `geom_raster()`
#> Warning: Some expressions had a GC in every iteration; so filtering is
#> disabled.
#> # A tibble: 5 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 heatmap() 154.03ms 159.3ms 6.16 139.1MB 7.71
#> 2 heatmap.2() 2.43s 2.43s 0.412 224.2MB 1.65
#> 3 Heatmap() 3.38s 3.38s 0.295 785MB 3.25
#> 4 pheatmap() 690.62ms 690.62ms 1.45 124.1MB 2.90
#> 5 ggalign() 2.57s 2.57s 0.390 2.5GB 9.35
For heatmap with dendrogram
bench::mark(
"heatmap()" = {
pdf(NULL)
heatmap(mat)
dev.off()
NULL
},
"heatmap.2()" = {
pdf(NULL)
heatmap.2(mat, trace = "none")
dev.off()
NULL
},
"Heatmap()" = {
pdf(NULL)
draw(Heatmap(mat, row_dend_reorder = FALSE, column_dend_reorder = FALSE))
dev.off()
NULL
},
"pheatmap()" = {
pdf(NULL)
pheatmap(mat)
dev.off()
NULL
},
"ggalign()" = {
pdf(NULL)
print(ggheatmap(mat) +
hmanno("t") + align_dendro() +
hmanno("r") + align_dendro())
dev.off()
NULL
}
)
#> → heatmap built with `geom_raster()`
#> → heatmap built with `geom_raster()`
#> Warning: Some expressions had a GC in every iteration; so filtering is
#> disabled.
#> # A tibble: 5 × 6
#> expression min median `itr/sec` mem_alloc `gc/sec`
#> <bch:expr> <bch:tm> <bch:tm> <dbl> <bch:byt> <dbl>
#> 1 heatmap() 2.72s 2.72s 0.367 173.72MB 1.47
#> 2 heatmap.2() 3.15s 3.15s 0.318 223.41MB 0.954
#> 3 Heatmap() 4.49s 4.49s 0.223 1.51GB 2.23
#> 4 pheatmap() 2.31s 2.31s 0.432 177.53MB 0.432
#> 5 ggalign() 5.19s 5.19s 0.193 2.57GB 4.62