This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error while using ComplexHeatmap

Hi,

I was using ComplexHeatmap package to plot some data, however, I come across an error message as shown below while running the code. Please assist me how to resolve this error.

Error in Heatmap(df_plot, cluster_rows = TRUE, cluster_columns = F, height = unit(4, : unused arguments (height = unit(4, "mm") * nrow(df_plot), row_split = ann_table$Cluster, left_annotation = row_ha)

dput(head(df_plot))
structure(list(GSM261581 = c(0, 0, 0, 0, -19.047619047619, 0), 
    GSM261913 = c(0, 0, 30.7692307692308, 0, 23.8095238095238, 
    -16), GSM261914 = c(0, 0, -23.0769230769231, 0, 0, 0), GSM260537 = c(0, 
    17.6470588235294, -38.4615384615385, 0, -23.8095238095238, 
    28), GSM260541 = c(0, 17.6470588235294, -65.3846153846154, 
    0, 19.047619047619, 0), GSM260542 = c(0, 0, 65.3846153846154, 
    0, -42.8571428571429, 48), GSM261573 = c(0, 0, 50, 20, -28.5714285714286, 
    16), GSM261575 = c(0, 23.5294117647059, -50, 0, 47.6190476190476, 
    -28), GSM261580 = c(0, 23.5294117647059, -76.9230769230769, 
    0, -33.3333333333333, 28)), row.names = c("M3.1.Cell cycle", 
"M8.1.TBD", "M8.2.Prostanoids", "M8.3.Type 1 Interferon", "M9.1.Cytotoxic lymphocytes", 
"M9.2.Erythrocytes"), class = "data.frame")
class(df_plot)
"data.frame"
  
GSE_ID = "GSE12345"
platform = "GPL123"
pdf(paste0(GSE_ID, "_", platform, "_plot.pdf"), height = 70, width = 18)
ht=Heatmap(df_plot,
           cluster_rows = TRUE,
           cluster_columns = F,
           height = unit(4, "mm")*nrow(df_plot),
           width  = unit(4, "mm")*ncol(df_plot), 
           rect_gp = gpar(type = "none"),
           row_split = ann_table$Cluster,
           top_annotation = ha_column,
           left_annotation = row_ha,
           row_title_rot = 0,
           name = "% Response",
           row_names_max_width = unit(10,"in"),
           row_title_gp = gpar(fontsize = 12),
           column_names_gp = gpar(fontsize = 12),
           row_names_gp = gpar(fontsize = 12),
           cell_fun = function(j, i, x, y, width, height, fill) {
             grid.circle(x = x, y = y, r = unit(1.85, "mm") ,gp = gpar(fill = col_fun(df_plot[i, j]), col = NA))
           }
)
draw(ht,heatmap_legend_side = "left", annotation_legend_side = "left", padding = unit(c(2, 20, 2, 2), "mm"))

dev.off()

Best Regards,

Toufiq

r data.frame complexheatmap heatmap clustering

1 answer

It is related to these parameters:

  • height
  • width

Please confirm the version of the package that you are using, and also check that these parameters are part of your version of ComplexHeatmap by checking the manual page entry:

?Heatmap

@Kevin Blighe, thank you for looking into this.

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

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

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.14.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

locale:
[1] C

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ComplexHeatmap_1.20.0 stringr_1.4.0        

loaded via a namespace (and not attached):
 [1] colorspace_1.4-1    compiler_3.5.1      rjson_0.2.20        magrittr_1.5       
 [5] circlize_0.4.9      tools_3.5.1         GlobalOptions_0.1.1 RColorBrewer_1.1-2 
 [9] yaml_2.2.1          stringi_1.4.6       GetoptLong_0.1.8    shape_1.4.4    



install.packages("ComplexHeatmap")
Error in install.packages : Updating loaded packages

Restarting R session...

During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C" 
2: Setting LC_COLLATE failed, using "C" 
3: Setting LC_TIME failed, using "C" 
4: Setting LC_MESSAGES failed, using "C" 
5: Setting LC_MONETARY failed, using "C" 
> install.packages("ComplexHeatmap")
Installing package into '/Users/mtoufiq/Library/R/3.5/library'
(as 'lib' is unspecified)
Warning in install.packages :
  package 'ComplexHeatmap' is not available (for R version 3.5.1)

I see. You are using an older version of the package in which the height parameter did not exist. You should considering upgrading both R and ComplexHeatmap

@Kevin Blighe , thank you so much. The issue has been resolved after upgrading both R and ComplexHeatmap.

Log in to answer this question.