... | ... |
@@ -1,8 +1,8 @@ |
1 | 1 |
Package: ComplexHeatmap |
2 | 2 |
Type: Package |
3 | 3 |
Title: Making Complex Heatmaps |
4 |
-Version: 1.7.4 |
|
5 |
-Date: 2015-11-24 |
|
4 |
+Version: 1.8.0 |
|
5 |
+Date: 2015-12-16 |
|
6 | 6 |
Author: Zuguang Gu |
7 | 7 |
Maintainer: Zuguang Gu <z.gu@dkfz.de> |
8 | 8 |
Depends: R (>= 3.1.2), grid, graphics, stats, grDevices |
... | ... |
@@ -18,6 +18,6 @@ Description: Complex heatmaps are efficient to visualize associations |
18 | 18 |
biocViews: Software, Visualization, Sequencing |
19 | 19 |
URL: https://github.com/jokergoo/ComplexHeatmap |
20 | 20 |
License: GPL (>= 2) |
21 |
-Packaged: 2015-11-24 00:00:00 UTC; Administrator |
|
21 |
+Packaged: 2015-12-16 00:00:00 UTC; Administrator |
|
22 | 22 |
Repository: Bioconductor |
23 |
-Date/Publication: 2015-11-24 00:00:00 |
|
23 |
+Date/Publication: 2015-12-16 00:00:00 |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-CHANEGS in VERSION 1.7.4 |
|
1 |
+CHANEGS in VERSION 1.8.0 |
|
2 | 2 |
|
3 | 3 |
* width of the heatmap body are calculated correctly if it is set as a fixed unit |
4 | 4 |
* there is no dendrogram is nrows in a row-slice is 1 |
... | ... |
@@ -6,6 +6,9 @@ CHANEGS in VERSION 1.7.4 |
6 | 6 |
* bottom annotations are attached to the bottom edge of the heatmap |
7 | 7 |
if there are additional blank space |
8 | 8 |
* colors for NA can be set by "_NA_" in annotations |
9 |
+* `row_dend_reorder` and `column_dend_reorder` are set to `TRUE` by default again -_-!! |
|
10 |
+* optimize the way to specify na_col in heatmap annotations |
|
11 |
+* correct wrong viewport names in decorate_* functions |
|
9 | 12 |
|
10 | 13 |
=============================== |
11 | 14 |
|
... | ... |
@@ -110,7 +110,9 @@ ColorMapping = function(name, colors = NULL, levels = NULL, |
110 | 110 |
} |
111 | 111 |
|
112 | 112 |
.Object@name = name |
113 |
- .Object@na_col = na_col |
|
113 |
+ na_col = t(col2rgb(na_col, alpha = TRUE)) |
|
114 |
+ na_col = rgb(na_col[, 1:3, drop = FALSE], alpha = na_col[, 4], maxColorValue = 255) |
|
115 |
+ .Object@na_col = na_col[1] |
|
114 | 116 |
|
115 | 117 |
return(.Object) |
116 | 118 |
} |
... | ... |
@@ -235,7 +235,7 @@ Heatmap = function(matrix, col, name, |
235 | 235 |
row_dend_side = c("left", "right"), |
236 | 236 |
row_dend_width = unit(10, "mm"), |
237 | 237 |
show_row_dend = TRUE, |
238 |
- row_dend_reorder = FALSE, |
|
238 |
+ row_dend_reorder = TRUE, |
|
239 | 239 |
row_dend_gp = gpar(), |
240 | 240 |
row_hclust_side = row_dend_side, |
241 | 241 |
row_hclust_width = row_dend_width, |
... | ... |
@@ -249,7 +249,7 @@ Heatmap = function(matrix, col, name, |
249 | 249 |
column_dend_height = unit(10, "mm"), |
250 | 250 |
show_column_dend = TRUE, |
251 | 251 |
column_dend_gp = gpar(), |
252 |
- column_dend_reorder = FALSE, |
|
252 |
+ column_dend_reorder = TRUE, |
|
253 | 253 |
column_hclust_side = column_dend_side, |
254 | 254 |
column_hclust_height = column_dend_height, |
255 | 255 |
show_column_hclust = show_column_dend, |
... | ... |
@@ -41,6 +41,7 @@ HeatmapAnnotation = setClass("HeatmapAnnotation", |
41 | 41 |
# -df a data frame. Each column will be treated as a simple annotation. The data frame must have column names. |
42 | 42 |
# -name name of the heatmap annotation, optional. |
43 | 43 |
# -col a list of colors which contains color mapping to columns in ``df``. See `SingleAnnotation` for how to set colors. |
44 |
+# -na_col color for ``NA`` values in simple annotations. |
|
44 | 45 |
# -annotation_legend_param a list which contains parameters for annotation legends |
45 | 46 |
# -show_legend whether show legend for each column in ``df``. |
46 | 47 |
# -... functions which define complex annotations. Values should be named arguments. |
... | ... |
@@ -65,7 +66,7 @@ HeatmapAnnotation = setClass("HeatmapAnnotation", |
65 | 66 |
# == author |
66 | 67 |
# Zuguang Gu <z.gu@dkfz.de> |
67 | 68 |
# |
68 |
-HeatmapAnnotation = function(df, name, col, |
|
69 |
+HeatmapAnnotation = function(df, name, col, na_col = "grey", |
|
69 | 70 |
annotation_legend_param = list(), |
70 | 71 |
show_legend = TRUE, |
71 | 72 |
..., |
... | ... |
@@ -92,7 +93,7 @@ HeatmapAnnotation = function(df, name, col, |
92 | 93 |
|
93 | 94 |
arg_list = as.list(match.call())[-1] |
94 | 95 |
called_args = names(arg_list) |
95 |
- anno_args = setdiff(called_args, c("name", "col", "annotation_legend_param", "show_legend", "which", |
|
96 |
+ anno_args = setdiff(called_args, c("name", "col", "na_col", "annotation_legend_param", "show_legend", "which", |
|
96 | 97 |
"annotation_height", "annotation_width", "height", "width", "gp", "gap")) |
97 | 98 |
if(any(anno_args == "")) stop("annotations should have names.") |
98 | 99 |
if(any(duplicated(anno_args))) stop("names of annotations should be unique.") |
... | ... |
@@ -160,14 +161,14 @@ HeatmapAnnotation = function(df, name, col, |
160 | 161 |
|
161 | 162 |
if(missing(col)) { |
162 | 163 |
for(i in seq_len(n_anno)) { |
163 |
- anno_list = c(anno_list, list(SingleAnnotation(name = anno_name[i], value = df[, i], which = which, show_legend = show_legend[i_simple + i], gp = gp, legend_param = annotation_legend_param[[i_simple + i]]))) |
|
164 |
+ anno_list = c(anno_list, list(SingleAnnotation(name = anno_name[i], value = df[, i], na_col = na_col, which = which, show_legend = show_legend[i_simple + i], gp = gp, legend_param = annotation_legend_param[[i_simple + i]]))) |
|
164 | 165 |
} |
165 | 166 |
} else { |
166 | 167 |
for(i in seq_len(n_anno)) { |
167 | 168 |
if(is.null(col[[ anno_name[i] ]])) { # if the color is not provided |
168 |
- anno_list = c(anno_list, list(SingleAnnotation(name = anno_name[i], value = df[, i], which = which, show_legend = show_legend[i_simple + i], gp = gp, legend_param = annotation_legend_param[[i_simple + i]]))) |
|
169 |
+ anno_list = c(anno_list, list(SingleAnnotation(name = anno_name[i], value = df[, i], na_col = na_col, which = which, show_legend = show_legend[i_simple + i], gp = gp, legend_param = annotation_legend_param[[i_simple + i]]))) |
|
169 | 170 |
} else { |
170 |
- anno_list = c(anno_list, list(SingleAnnotation(name = anno_name[i], value = df[, i], col = col[[ anno_name[i] ]], which = which, show_legend = show_legend[i_simple + i], gp = gp, legend_param = annotation_legend_param[[i_simple + i]]))) |
|
171 |
+ anno_list = c(anno_list, list(SingleAnnotation(name = anno_name[i], value = df[, i], na_col = na_col, col = col[[ anno_name[i] ]], which = which, show_legend = show_legend[i_simple + i], gp = gp, legend_param = annotation_legend_param[[i_simple + i]]))) |
|
171 | 172 |
} |
172 | 173 |
} |
173 | 174 |
} |
... | ... |
@@ -183,12 +184,12 @@ HeatmapAnnotation = function(df, name, col, |
183 | 184 |
stop("length of simple annotations differ.") |
184 | 185 |
} |
185 | 186 |
if(missing(col)) { |
186 |
- anno_list = c(anno_list, list(SingleAnnotation(name = ag, value = anno_arg_list[[ag]], which = which, show_legend = show_legend[i_simple + 1], gp = gp, legend_param = annotation_legend_param[[i_simple + 1]]))) |
|
187 |
+ anno_list = c(anno_list, list(SingleAnnotation(name = ag, value = anno_arg_list[[ag]], na_col = na_col, which = which, show_legend = show_legend[i_simple + 1], gp = gp, legend_param = annotation_legend_param[[i_simple + 1]]))) |
|
187 | 188 |
} else { |
188 | 189 |
if(is.null(col[[ ag ]])) { # if the color is not provided |
189 |
- anno_list = c(anno_list, list(SingleAnnotation(name = ag, value = anno_arg_list[[ag]], which = which, show_legend = show_legend[i_simple + 1], gp = gp, legend_param = annotation_legend_param[[i_simple + 1]]))) |
|
190 |
+ anno_list = c(anno_list, list(SingleAnnotation(name = ag, value = anno_arg_list[[ag]], na_col = na_col, which = which, show_legend = show_legend[i_simple + 1], gp = gp, legend_param = annotation_legend_param[[i_simple + 1]]))) |
|
190 | 191 |
} else { |
191 |
- anno_list = c(anno_list, list(SingleAnnotation(name = ag, value = anno_arg_list[[ag]], col = col[[ ag ]], which = which, show_legend = show_legend[i_simple + 1], gp = gp, legend_param = annotation_legend_param[[i_simple + 1]]))) |
|
192 |
+ anno_list = c(anno_list, list(SingleAnnotation(name = ag, value = anno_arg_list[[ag]], na_col = na_col, col = col[[ ag ]], which = which, show_legend = show_legend[i_simple + 1], gp = gp, legend_param = annotation_legend_param[[i_simple + 1]]))) |
|
192 | 193 |
} |
193 | 194 |
} |
194 | 195 |
i_simple = i_simple + 1 |
... | ... |
@@ -55,6 +55,7 @@ SingleAnnotation = setClass("SingleAnnotation", |
55 | 55 |
# a color mapping function. |
56 | 56 |
# -fun a self-defined function to add annotation graphics. The argument of this function should only |
57 | 57 |
# be a vector of index that corresponds to rows or columns. |
58 |
+# -na_col color for ``NA`` values in simple annotations. |
|
58 | 59 |
# -which is the annotation a row annotation or a column annotation? |
59 | 60 |
# -show_legend if it is a simple annotation, whether show legend when making the complete heatmap. |
60 | 61 |
# -gp Since simple annotation is represented as a row of grids. This argument controls graphic parameters for the simple annotation. |
... | ... |
@@ -84,6 +85,7 @@ SingleAnnotation = setClass("SingleAnnotation", |
84 | 85 |
# Zuguang Gu <z.gu@dkfz.de> |
85 | 86 |
# |
86 | 87 |
SingleAnnotation = function(name, value, col, fun, |
88 |
+ na_col = "grey", |
|
87 | 89 |
which = c("column", "row"), |
88 | 90 |
show_legend = TRUE, |
89 | 91 |
gp = gpar(col = NA), |
... | ... |
@@ -138,12 +140,10 @@ SingleAnnotation = function(name, value, col, fun, |
138 | 140 |
if("_NA_" %in% names(col)) { |
139 | 141 |
na_col = col["_NA_"] |
140 | 142 |
col = col[names(col) != "_NA_"] |
141 |
- } else { |
|
142 |
- na_col = "#FFFFFF" |
|
143 | 143 |
} |
144 | 144 |
color_mapping = ColorMapping(name = name, colors = col, na_col = na_col) |
145 | 145 |
} else if(is.function(col)) { |
146 |
- color_mapping = ColorMapping(name = name, col_fun = col) |
|
146 |
+ color_mapping = ColorMapping(name = name, col_fun = col, na_col = na_col) |
|
147 | 147 |
} |
148 | 148 |
|
149 | 149 |
.Object@color_mapping = color_mapping |
... | ... |
@@ -970,6 +970,9 @@ column_anno_text = function(...) { |
970 | 970 |
# This annotation function is used to mark these rows and connect labels and corresponding rows |
971 | 971 |
# with links. |
972 | 972 |
# |
973 |
+# == value |
|
974 |
+# A graphic function which can be set in `HeatmapAnnotation` constructor method. |
|
975 |
+# |
|
973 | 976 |
# == author |
974 | 977 |
# Zuguang Gu <z.gu@dkfz.de> |
975 | 978 |
anno_link = function(at, labels, which = c("column", "row"), side = ifelse(which == "column", "top", "right"), |
... | ... |
@@ -43,9 +43,15 @@ |
43 | 43 |
# |
44 | 44 |
decorate_heatmap_body = function(heatmap, code, slice = 1) { |
45 | 45 |
|
46 |
- vp_name = paste0(heatmap, "_heatmap_body_", slice) |
|
46 |
+ if(is.null(slice)) { |
|
47 |
+ vp_name = paste0(heatmap, "_heatmap_body_", 1) |
|
48 |
+ seekViewport(vp_name) |
|
49 |
+ upViewport() |
|
50 |
+ } else { |
|
51 |
+ vp_name = paste0(heatmap, "_heatmap_body_", slice) |
|
52 |
+ seekViewport(vp_name) |
|
53 |
+ } |
|
47 | 54 |
|
48 |
- seekViewport(vp_name) |
|
49 | 55 |
e = new.env(parent = parent.frame()) |
50 | 56 |
eval(substitute(code), envir = e) |
51 | 57 |
|
... | ... |
@@ -94,7 +100,14 @@ decorate_dend = function(heatmap, code, slice = 1, which = c("column", "row")) { |
94 | 100 |
if(which == "column") { |
95 | 101 |
vp_name = paste0(heatmap, "_dend_", which) |
96 | 102 |
} else if(which == "row") { |
97 |
- vp_name = paste0(heatmap, "_dend_", which, "_", slice) |
|
103 |
+ if(is.null(slice)) { |
|
104 |
+ vp_name = paste0(heatmap, "_dend_", which, "_", 1) |
|
105 |
+ seekViewport(vp_name) |
|
106 |
+ upViewport() |
|
107 |
+ } else { |
|
108 |
+ vp_name = paste0(heatmap, "_dend_", which, "_", slice) |
|
109 |
+ seekViewport(vp_name) |
|
110 |
+ } |
|
98 | 111 |
} |
99 | 112 |
|
100 | 113 |
seekViewport(vp_name) |
... | ... |
@@ -197,7 +210,14 @@ decorate_dimnames = function(heatmap, code, slice = 1, which = c("column", "row" |
197 | 210 |
if(which == "column") { |
198 | 211 |
vp_name = paste0(heatmap, "_", which, "_names") |
199 | 212 |
} else if(which == "row") { |
200 |
- vp_name = paste0(heatmap, "_", which, "_names_", slice) |
|
213 |
+ if(is.null(slice)) { |
|
214 |
+ vp_name = paste0(heatmap, "_", which, "_names_", 1) |
|
215 |
+ seekViewport(vp_name) |
|
216 |
+ upViewport() |
|
217 |
+ } else { |
|
218 |
+ vp_name = paste0(heatmap, "_", which, "_names_", slice) |
|
219 |
+ seekViewport(vp_name) |
|
220 |
+ } |
|
201 | 221 |
} |
202 | 222 |
|
203 | 223 |
seekViewport(vp_name) |
... | ... |
@@ -287,7 +307,14 @@ decorate_title = function(heatmap, code, slice = 1, which = c("column", "row")) |
287 | 307 |
if(which == "column") { |
288 | 308 |
vp_name = paste0(heatmap, "_", which, "_title") |
289 | 309 |
} else if(which == "row") { |
290 |
- vp_name = paste0(heatmap, "_", which, "_title_", slice) |
|
310 |
+ if(is.null(slice)) { |
|
311 |
+ vp_name = paste0(heatmap, "_", which, "_title_", 1) |
|
312 |
+ seekViewport(vp_name) |
|
313 |
+ upViewport() |
|
314 |
+ } else { |
|
315 |
+ vp_name = paste0(heatmap, "_", which, "_title_", slice) |
|
316 |
+ seekViewport(vp_name) |
|
317 |
+ } |
|
291 | 318 |
} |
292 | 319 |
|
293 | 320 |
seekViewport(vp_name) |
... | ... |
@@ -376,9 +403,9 @@ decorate_column_title = function(...) { |
376 | 403 |
# grid.rect(gp = gpar(fill = "#FF000080")) |
377 | 404 |
# }, slice = 2) |
378 | 405 |
# |
379 |
-decorate_annotation = function(annotation, code, slice = NULL) { |
|
406 |
+decorate_annotation = function(annotation, code, slice) { |
|
380 | 407 |
|
381 |
- if(is.null(slice)) { |
|
408 |
+ if(missing(slice)) { |
|
382 | 409 |
vp_name = paste0("annotation_", annotation) |
383 | 410 |
o = try(seekViewport(vp_name), silent = TRUE) |
384 | 411 |
if(inherits(o, "try-error")) { |
... | ... |
@@ -391,8 +418,14 @@ decorate_annotation = function(annotation, code, slice = NULL) { |
391 | 418 |
} |
392 | 419 |
seekViewport(vp_name) |
393 | 420 |
} else { |
394 |
- vp_name = paste0("annotation_", annotation, "_", slice) |
|
395 |
- seekViewport(vp_name) |
|
421 |
+ if(is.null(slice)) { |
|
422 |
+ vp_name = paste0("annotation_", annotation, "_", 1) |
|
423 |
+ seekViewport(vp_name) |
|
424 |
+ upViewport() |
|
425 |
+ } else { |
|
426 |
+ vp_name = paste0("annotation_", annotation, "_", slice) |
|
427 |
+ seekViewport(vp_name) |
|
428 |
+ } |
|
396 | 429 |
} |
397 | 430 |
|
398 | 431 |
e = new.env(parent = parent.frame()) |
... | ... |
@@ -23,7 +23,6 @@ |
23 | 23 |
# -remove_empty_columns if there is no alteration in that sample, whether remove it on the heatmap |
24 | 24 |
# -heatmap_legend_param pass to `Heatmap` |
25 | 25 |
# -top_annotation by default the top annotation contains barplots representing frequency of mutations in every sample. |
26 |
-# -top_annotation_height height of the top annotation, should be a `grid::unit` object. |
|
27 | 26 |
# -barplot_ignore alterations that you don't want to put on the barplots. |
28 | 27 |
# -... pass to `Heatmap`, so can set ``bottom_annotation`` here. |
29 | 28 |
# |
... | ... |
@@ -55,8 +54,8 @@ oncoPrint = function(mat, get_type = function(x) x, |
55 | 54 |
row_barplot_width = unit(2, "cm"), |
56 | 55 |
remove_empty_columns = FALSE, |
57 | 56 |
heatmap_legend_param = list(title = "Alterations"), |
58 |
- top_annotation = HeatmapAnnotation(column_bar = anno_column_bar), |
|
59 |
- top_annotation_height = unit(2, "cm"), |
|
57 |
+ top_annotation = HeatmapAnnotation(column_bar = anno_column_bar, |
|
58 |
+ annotation_height = unit(2, "cm")), |
|
60 | 59 |
barplot_ignore = NULL, |
61 | 60 |
...) { |
62 | 61 |
|
... | ... |
@@ -81,8 +80,12 @@ oncoPrint = function(mat, get_type = function(x) x, |
81 | 80 |
}) |
82 | 81 |
} else if(inherits(mat, "list")) { |
83 | 82 |
mat_list = mat |
83 |
+ |
|
84 | 84 |
all_type = names(mat_list) |
85 | 85 |
mat_list = lapply(mat_list, function(x) { |
86 |
+ if(!is.matrix(x)) { |
|
87 |
+ stop("Expect a list of matrix (not data frames).") |
|
88 |
+ } |
|
86 | 89 |
oattr = attributes(x) |
87 | 90 |
x = as.logical(x) |
88 | 91 |
attributes(x) = oattr |
... | ... |
@@ -250,7 +253,7 @@ oncoPrint = function(mat, get_type = function(x) x, |
250 | 253 |
add_oncoprint(type, x, y, width, height) |
251 | 254 |
} |
252 | 255 |
}, show_column_names = show_column_names, |
253 |
- top_annotation = top_annotation, top_annotation_height = top_annotation_height, |
|
256 |
+ top_annotation = top_annotation, |
|
254 | 257 |
heatmap_legend_param = heatmap_legend_param, ...) |
255 | 258 |
|
256 | 259 |
if(show_row_barplot) { |
... | ... |
@@ -273,6 +276,9 @@ oncoPrint = function(mat, get_type = function(x) x, |
273 | 276 |
# == details |
274 | 277 |
# All matrix will be unified to have same row names and column names |
275 | 278 |
# |
279 |
+# == value |
|
280 |
+# A list of matrix |
|
281 |
+# |
|
276 | 282 |
# == author |
277 | 283 |
# Zuguang Gu <z.gu@dkfz.de> |
278 | 284 |
# |
... | ... |
@@ -26,7 +26,7 @@ Heatmap(matrix, col, name, |
26 | 26 |
row_dend_side = c("left", "right"), |
27 | 27 |
row_dend_width = unit(10, "mm"), |
28 | 28 |
show_row_dend = TRUE, |
29 |
- row_dend_reorder = FALSE, |
|
29 |
+ row_dend_reorder = TRUE, |
|
30 | 30 |
row_dend_gp = gpar(), |
31 | 31 |
row_hclust_side = row_dend_side, |
32 | 32 |
row_hclust_width = row_dend_width, |
... | ... |
@@ -40,7 +40,7 @@ Heatmap(matrix, col, name, |
40 | 40 |
column_dend_height = unit(10, "mm"), |
41 | 41 |
show_column_dend = TRUE, |
42 | 42 |
column_dend_gp = gpar(), |
43 |
- column_dend_reorder = FALSE, |
|
43 |
+ column_dend_reorder = TRUE, |
|
44 | 44 |
column_hclust_side = column_dend_side, |
45 | 45 |
column_hclust_height = column_dend_height, |
46 | 46 |
show_column_hclust = show_column_dend, |
... | ... |
@@ -7,7 +7,7 @@ Constructor method for HeatmapAnnotation class |
7 | 7 |
Constructor method for HeatmapAnnotation class |
8 | 8 |
} |
9 | 9 |
\usage{ |
10 |
-HeatmapAnnotation(df, name, col, |
|
10 |
+HeatmapAnnotation(df, name, col, na_col = "grey", |
|
11 | 11 |
annotation_legend_param = list(), |
12 | 12 |
show_legend = TRUE, |
13 | 13 |
..., |
... | ... |
@@ -24,6 +24,7 @@ HeatmapAnnotation(df, name, col, |
24 | 24 |
\item{df}{a data frame. Each column will be treated as a simple annotation. The data frame must have column names.} |
25 | 25 |
\item{name}{name of the heatmap annotation, optional.} |
26 | 26 |
\item{col}{a list of colors which contains color mapping to columns in \code{df}. See \code{\link{SingleAnnotation}} for how to set colors.} |
27 |
+ \item{na_col}{color for \code{NA} values in simple annotations.} |
|
27 | 28 |
\item{annotation_legend_param}{a list which contains parameters for annotation legends} |
28 | 29 |
\item{show_legend}{whether show legend for each column in \code{df}.} |
29 | 30 |
\item{...}{functions which define complex annotations. Values should be named arguments.} |
... | ... |
@@ -8,6 +8,7 @@ Constructor method for SingleAnnotation class |
8 | 8 |
} |
9 | 9 |
\usage{ |
10 | 10 |
SingleAnnotation(name, value, col, fun, |
11 |
+ na_col = "grey", |
|
11 | 12 |
which = c("column", "row"), |
12 | 13 |
show_legend = TRUE, |
13 | 14 |
gp = gpar(col = NA), |
... | ... |
@@ -19,6 +20,7 @@ SingleAnnotation(name, value, col, fun, |
19 | 20 |
\item{value}{A vector of discrete or continuous annotation.} |
20 | 21 |
\item{col}{colors corresponding to \code{value}. If the mapping is discrete mapping, the value of \code{col} should be a vector; If the mapping is continuous mapping, the value of \code{col} should be a color mapping function. } |
21 | 22 |
\item{fun}{a self-defined function to add annotation graphics. The argument of this function should only be a vector of index that corresponds to rows or columns.} |
23 |
+ \item{na_col}{color for \code{NA} values in simple annotations.} |
|
22 | 24 |
\item{which}{is the annotation a row annotation or a column annotation?} |
23 | 25 |
\item{show_legend}{if it is a simple annotation, whether show legend when making the complete heatmap.} |
24 | 26 |
\item{gp}{Since simple annotation is represented as a row of grids. This argument controls graphic parameters for the simple annotation.} |
... | ... |
@@ -27,6 +27,9 @@ Sometimes there are many rows or columns in the heatmap and we want to mark some |
27 | 27 |
This annotation function is used to mark these rows and connect labels and corresponding rows |
28 | 28 |
with links. |
29 | 29 |
} |
30 |
+\value{ |
|
31 |
+A graphic function which can be set in \code{\link{HeatmapAnnotation}} constructor method. |
|
32 |
+} |
|
30 | 33 |
\author{ |
31 | 34 |
Zuguang Gu <z.gu@dkfz.de> |
32 | 35 |
} |
... | ... |
@@ -18,8 +18,8 @@ oncoPrint(mat, get_type = function(x) x, |
18 | 18 |
row_barplot_width = unit(2, "cm"), |
19 | 19 |
remove_empty_columns = FALSE, |
20 | 20 |
heatmap_legend_param = list(title = "Alterations"), |
21 |
- top_annotation = HeatmapAnnotation(column_bar = anno_column_bar), |
|
22 |
- top_annotation_height = unit(2, "cm"), |
|
21 |
+ top_annotation = HeatmapAnnotation(column_bar = anno_column_bar, |
|
22 |
+ annotation_height = unit(2, "cm")), |
|
23 | 23 |
barplot_ignore = NULL, |
24 | 24 |
...) |
25 | 25 |
} |
... | ... |
@@ -39,7 +39,6 @@ oncoPrint(mat, get_type = function(x) x, |
39 | 39 |
\item{remove_empty_columns}{if there is no alteration in that sample, whether remove it on the heatmap} |
40 | 40 |
\item{heatmap_legend_param}{pass to \code{\link{Heatmap}}} |
41 | 41 |
\item{top_annotation}{by default the top annotation contains barplots representing frequency of mutations in every sample.} |
42 |
- \item{top_annotation_height}{height of the top annotation, should be a \code{\link[grid]{unit}} object.} |
|
43 | 42 |
\item{barplot_ignore}{alterations that you don't want to put on the barplots.} |
44 | 43 |
\item{...}{pass to \code{\link{Heatmap}}, so can set \code{bottom_annotation} here.} |
45 | 44 |
|
... | ... |
@@ -531,7 +531,7 @@ upViewport(2) |
531 | 531 |
|
532 | 532 |
## Mark some of the rows/columns |
533 | 533 |
|
534 |
-From version 1.7.4, a new annotation function `anno_link()` was added which connects labels and subset of the rows |
|
534 |
+From version 1.8.0, a new annotation function `anno_link()` was added which connects labels and subset of the rows |
|
535 | 535 |
by links. It is helpful when there are many rows/columns and we want to mark some of the rows (e.g. in a gene expression |
536 | 536 |
matrix, we want to mark some important genes of interest.) |
537 | 537 |
|
... | ... |
@@ -133,8 +133,7 @@ decorate_heatmap_body("ht1", { |
133 | 133 |
grid.lines(c(0.5, 0.5), c(0, 1), gp = gpar(lty = 2, lwd = 2)) |
134 | 134 |
}, slice = 2) |
135 | 135 |
|
136 |
-suppressPackageStartupMessages(library(dendextend)) |
|
137 |
-decorate_dend("ht1", { |
|
136 |
+decorate_column_dend("ht1", { |
|
138 | 137 |
tree = column_dend(ht_list)$ht1 |
139 | 138 |
ind = cutree(as.hclust(tree), k = 2)[order.dendrogram(tree)] |
140 | 139 |
|
... | ... |
@@ -144,15 +143,15 @@ decorate_dend("ht1", { |
144 | 143 |
x2 = c(last_index(ind == 1), last_index(ind == 2)) |
145 | 144 |
grid.rect(x = x1/length(ind), width = (x2 - x1)/length(ind), just = "left", |
146 | 145 |
default.units = "npc", gp = gpar(fill = c("#FF000040", "#00FF0040"), col = NA)) |
147 |
-}, which = "column") |
|
146 |
+}) |
|
148 | 147 |
|
149 |
-decorate_dimnames("ht2", { |
|
148 |
+decorate_row_names("ht2", { |
|
150 | 149 |
grid.rect(gp = gpar(fill = "#FF000040")) |
151 |
-}, which = "row", slice = 2) |
|
150 |
+}, slice = 2) |
|
152 | 151 |
|
153 |
-decorate_title("ht1", { |
|
152 |
+decorate_row_title("ht1", { |
|
154 | 153 |
grid.rect(gp = gpar(fill = "#00FF0040")) |
155 |
-}, which = "row", slice = 1) |
|
154 |
+}, slice = 1) |
|
156 | 155 |
|
157 | 156 |
decorate_annotation("points", { |
158 | 157 |
grid.lines(c(0, 1), unit(c(0, 0), "native"), gp = gpar(col = "red")) |