Dear members,
I was running oncoPrint function of ComplexHeatmap package and I got the following:
library(ComplexHeatmap)
mat = read.table(textConnection(
"\tS1\tS2\tS3
Gene_1\t\t\tMUT;HOMDEL
Gene_2\tMUT\tMUT\tMUT
Gene_3\t\tHOMDEL\t
Gene_4\t\t\t\
Gene_5\t\tAMP\t
"), row.names = 1, header = TRUE, sep = "\t", stringsAsFactors = FALSE)
mat <- as.matrix(mat)
alter_fun_list = list(
background = function(x, y, w, h) {
grid.rect(x, y, w-unit(0.5, "mm"), h-unit(0.5, "mm"), gp = gpar(fill = "#CCCCCC", col = NA))
},
HOMDEL = function(x, y, w, h) {
grid.rect(x, y, w-unit(0.5, "mm"), h-unit(0.5, "mm"), gp = gpar(fill = "blue", col = NA))
},
AMP = function(x, y, w, h) {
grid.rect(x, y, w-unit(0.5, "mm"), h-unit(0.5, "mm"), gp = gpar(fill = "red", col = NA))
},
MUT = function(x, y, w, h) {
grid.rect(x, y, w-unit(0.5, "mm"), h*0.33, gp = gpar(fill = "#008000", col = NA))
}
)
col = c("MUT" = "#008000", "AMP" = "red", "HOMDEL" = "blue")
oncoPrint(mat, alter_fun_list = alter_fun_list, col = col, heatmap_legend_param = list(title = "Alternations", at = c("AMP", "HOMDEL", "MUT"), labels = c("Amplification", "Deep deletion", "Mutation")))
Error in oncoPrint(mat, alter_fun_list = alter_fun_list, col = col, heatmap_legend_param = list(title = "Alternations", : You should define shape function for: MUT;HOMDEL
It works when I set only MUT or HOMDEL
I would like to know how to create this graphic when I have two events together (MUT and HOMDEL for exemple).
Thanks for help,
Here is the session info
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.9.5 (Mavericks)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] ComplexHeatmap_1.6.0
loaded via a namespace (and not attached):
[1] colorspace_1.2-6 rjson_0.2.15 magrittr_1.5 circlize_0.3.3 tools_3.2.2 whisker_0.3-2
[7] GlobalOptions_0.0.8 RColorBrewer_1.1-2 GetoptLong_0.1.1 shape_1.4.2 dendextend_1.1.2