... | ... |
@@ -1,8 +1,8 @@ |
1 | 1 |
Package: ComplexHeatmap |
2 | 2 |
Type: Package |
3 | 3 |
Title: Make Complex Heatmaps |
4 |
-Version: 2.1.1 |
|
5 |
-Date: 2019-10-12 |
|
4 |
+Version: 2.3.1 |
|
5 |
+Date: 2019-10-22 |
|
6 | 6 |
Author: Zuguang Gu |
7 | 7 |
Maintainer: Zuguang Gu <z.gu@dkfz.de> |
8 | 8 |
Depends: R (>= 3.1.2), methods, grid, graphics, stats, grDevices |
... | ... |
@@ -2802,6 +2802,10 @@ anno_mark = function(at, labels, which = c("column", "row"), |
2802 | 2802 |
|
2803 | 2803 |
labels_rot = labels_rot %% 360 |
2804 | 2804 |
|
2805 |
+ if(!inherits(padding, "unit")) { |
|
2806 |
+ padding = convertHeight(padding*grobHeight(textGrob("a", gp = subset_gp(labels_gp, 1))), "mm") |
|
2807 |
+ } |
|
2808 |
+ |
|
2805 | 2809 |
# a map between row index and positions |
2806 | 2810 |
# pos_map = |
2807 | 2811 |
row_fun = function(index) { |
... | ... |
@@ -909,25 +909,25 @@ setMethod(f = "make_layout", |
909 | 909 |
object@heatmap_legend_param$side = heatmap_legend_side |
910 | 910 |
if(show_heatmap_legend) { |
911 | 911 |
if(heatmap_legend_side == "top") { |
912 |
- object@heatmap_legend_param$padding = unit(c(2, 0, 0, 0), "mm") |
|
912 |
+ object@heatmap_legend_param$padding = unit.c(ht_opt$HEATMAP_LEGEND_PADDING, unit(c(0, 0, 0), "mm")) #unit(c(2, 0, 0, 0), "mm") |
|
913 | 913 |
size = heatmap_legend_size(object, legend_list = heatmap_legend_list, max_width = calc_legends_max_width(object)) |
914 | 914 |
object@heatmap_legend_param$size = size |
915 | 915 |
object@layout$layout_heatmap_legend_top_height = size[2] |
916 | 916 |
object@layout$layout_index = rbind(object@layout$layout_index, heatmap_legend_top = heatmap_list_layout_index("heatmap_legend_top")) |
917 | 917 |
} else if(heatmap_legend_side == "bottom") { |
918 |
- object@heatmap_legend_param$padding = unit(c(0, 0, 2, 0), "mm") |
|
918 |
+ object@heatmap_legend_param$padding = unit.c(unit(c(0, 0), "mm"), ht_opt$HEATMAP_LEGEND_PADDING, unit(0, "mm")) # unit(c(0, 0, 2, 0), "mm") |
|
919 | 919 |
size = heatmap_legend_size(object, legend_list = heatmap_legend_list, max_width = calc_legends_max_width(object)) |
920 | 920 |
object@heatmap_legend_param$size = size |
921 | 921 |
object@layout$layout_heatmap_legend_bottom_height = size[2] |
922 | 922 |
object@layout$layout_index = rbind(object@layout$layout_index, heatmap_legend_bottom = heatmap_list_layout_index("heatmap_legend_bottom")) |
923 | 923 |
} else if(heatmap_legend_side == "left") { |
924 |
- object@heatmap_legend_param$padding = unit(c(0, 0, 0, 2), "mm") |
|
924 |
+ object@heatmap_legend_param$padding = unit.c(unit(c(0, 0, 0), "mm"), ht_opt$HEATMAP_LEGEND_PADDING) # unit(c(0, 0, 0, 2), "mm") |
|
925 | 925 |
size = heatmap_legend_size(object, legend_list = heatmap_legend_list, max_height = calc_legends_max_height(object)) |
926 | 926 |
object@heatmap_legend_param$size = size |
927 | 927 |
object@layout$layout_heatmap_legend_left_width = size[1] |
928 | 928 |
object@layout$layout_index = rbind(object@layout$layout_index, heatmap_legend_left = heatmap_list_layout_index("heatmap_legend_left")) |
929 | 929 |
} else if(heatmap_legend_side == "right") { |
930 |
- object@heatmap_legend_param$padding = unit(c(0, 2, 0, 0), "mm") |
|
930 |
+ object@heatmap_legend_param$padding = unit.c(unit(0, "mm"), ht_opt$HEATMAP_LEGEND_PADDING, unit(c(0, 0), "mm")) # unit(c(0, 2, 0, 0), "mm") |
|
931 | 931 |
size = heatmap_legend_size(object, legend_list = heatmap_legend_list, max_height = calc_legends_max_height(object)) |
932 | 932 |
object@heatmap_legend_param$size = size |
933 | 933 |
object@layout$layout_heatmap_legend_right_width = size[1] |
... | ... |
@@ -980,25 +980,25 @@ setMethod(f = "make_layout", |
980 | 980 |
object@annotation_legend_param$side = annotation_legend_side |
981 | 981 |
if(show_annotation_legend) { |
982 | 982 |
if(annotation_legend_side == "top") { |
983 |
- object@annotation_legend_param$padding = unit(c(2, 0, 0, 0), "mm") |
|
983 |
+ object@annotation_legend_param$padding = unit.c(ht_opt$ANNOTATION_LEGEND_PADDING, unit(c(0, 0, 0), "mm")) # unit(c(2, 0, 0, 0), "mm") |
|
984 | 984 |
size = annotation_legend_size(object, legend_list = annotation_legend_list, max_width = calc_legends_max_width(object)) |
985 | 985 |
object@annotation_legend_param$size = size |
986 | 986 |
object@layout$layout_annotation_legend_top_height = size[2] |
987 | 987 |
object@layout$layout_index = rbind(object@layout$layout_index, annotation_legend_top = heatmap_list_layout_index("annotation_legend_top")) |
988 | 988 |
} else if(annotation_legend_side == "bottom") { |
989 |
- object@annotation_legend_param$padding = unit(c(0, 0, 2, 0), "mm") |
|
989 |
+ object@annotation_legend_param$padding = unit.c(unit(c(0, 0), "mm"), ht_opt$ANNOTATION_LEGEND_PADDING, unit(0, "mm")) # unit(c(0, 0, 2, 0), "mm") |
|
990 | 990 |
size = annotation_legend_size(object, legend_list = annotation_legend_list, max_width = calc_legends_max_width(object)) |
991 | 991 |
object@annotation_legend_param$size = size |
992 | 992 |
object@layout$layout_annotation_legend_bottom_height = size[2] |
993 | 993 |
object@layout$layout_index = rbind(object@layout$layout_index, annotation_legend_bottom = heatmap_list_layout_index("annotation_legend_bottom")) |
994 | 994 |
} else if(annotation_legend_side == "left") { |
995 |
- object@annotation_legend_param$padding = unit(c(0, 0, 0, 2), "mm") |
|
995 |
+ object@annotation_legend_param$padding = unit.c(unit(c(0, 0, 0), "mm"), ht_opt$ANNOTATION_LEGEND_PADDING) # unit(c(0, 0, 0, 2), "mm") |
|
996 | 996 |
size = annotation_legend_size(object, legend_list = annotation_legend_list, max_height = calc_legends_max_height(object)) |
997 | 997 |
object@annotation_legend_param$size = size |
998 | 998 |
object@layout$layout_annotation_legend_left_width = size[1] |
999 | 999 |
object@layout$layout_index = rbind(object@layout$layout_index, annotation_legend_left = heatmap_list_layout_index("annotation_legend_left")) |
1000 | 1000 |
} else if(annotation_legend_side == "right") { |
1001 |
- object@annotation_legend_param$padding = unit(c(0, 2, 0, 0), "mm") |
|
1001 |
+ object@annotation_legend_param$padding = unit.c(unit(0, "mm"), ht_opt$ANNOTATION_LEGEND_PADDING, unit(c(0, 0), "mm")) # unit(c(0, 2, 0, 0), "mm") |
|
1002 | 1002 |
size = annotation_legend_size(object, legend_list = annotation_legend_list, max_height = calc_legends_max_height(object)) |
1003 | 1003 |
object@annotation_legend_param$size = size |
1004 | 1004 |
object@layout$layout_annotation_legend_right_width = size[1] |
... | ... |
@@ -40,9 +40,9 @@ make_comb_mat_from_matrix = function(x, mode, top_n_sets = Inf, min_set_size = - |
40 | 40 |
set_size = set_size[l] |
41 | 41 |
x = x[, l, drop = FALSE] |
42 | 42 |
|
43 |
- if(ncol(x) > 15) { |
|
44 |
- stop_wrap("Currently number of sets <= 15 is only supported.") |
|
45 |
- } |
|
43 |
+ # if(ncol(x) > 15) { |
|
44 |
+ # stop_wrap("Currently number of sets <= 15 is only supported.") |
|
45 |
+ # } |
|
46 | 46 |
|
47 | 47 |
if(is.null(rownames(x))) { |
48 | 48 |
x_has_rownames = FALSE |
... | ... |
@@ -44,6 +44,8 @@ |
44 | 44 |
# -TITLE_PADDING space between row/column titles and heatmap body. |
45 | 45 |
# -COLUMN_ANNO_PADDING space between column annotations and heatmap body. |
46 | 46 |
# -ROW_ANNO_PADDING space between row annotations and heatmap body. |
47 |
+# -HEATMAP_LEGEND_PADDING space between heatmap legends and heatmaps |
|
48 |
+# -ANNOTATION_LEGEND_PADDING space between annotation legends and heatmaps |
|
47 | 49 |
# |
48 | 50 |
# Other parameters: |
49 | 51 |
# |
... | ... |
@@ -150,6 +152,14 @@ ht_opt = setGlobalOptions( |
150 | 152 |
ROW_ANNO_PADDING = list( |
151 | 153 |
.value = unit(1, "mm"), |
152 | 154 |
.class = "unit" |
155 |
+ ), |
|
156 |
+ HEATMAP_LEGEND_PADDING = list( |
|
157 |
+ .value = unit(2, "mm"), |
|
158 |
+ .class = "unit" |
|
159 |
+ ), |
|
160 |
+ ANNOTATION_LEGEND_PADDING = list( |
|
161 |
+ .value = unit(2, "mm"), |
|
162 |
+ .class = "unit" |
|
153 | 163 |
) |
154 | 164 |
) |
155 | 165 |
|
... | ... |
@@ -7,11 +7,12 @@ Names of the Combination sets |
7 | 7 |
Names of the Combination sets |
8 | 8 |
} |
9 | 9 |
\usage{ |
10 |
-comb_name(m) |
|
10 |
+comb_name(m, readable = FALSE) |
|
11 | 11 |
} |
12 | 12 |
\arguments{ |
13 | 13 |
|
14 | 14 |
\item{m}{A combination matrix returned by \code{\link{make_comb_mat}}.} |
15 |
+ \item{readable}{Whether the combination represents as e.g. "A&B&C".} |
|
15 | 16 |
|
16 | 17 |
} |
17 | 18 |
\details{ |
... | ... |
@@ -31,4 +32,5 @@ lt = list(a = sample(letters, 10), |
31 | 32 |
c = sample(letters, 20)) |
32 | 33 |
m = make_comb_mat(lt) |
33 | 34 |
comb_name(m) |
35 |
+comb_name(m, readable = TRUE) |
|
34 | 36 |
} |
... | ... |
@@ -59,6 +59,8 @@ Following parameters control the space between heatmap components: |
59 | 59 |
\item{TITLE_PADDING}{space between row/column titles and heatmap body.} |
60 | 60 |
\item{COLUMN_ANNO_PADDING}{space between column annotations and heatmap body.} |
61 | 61 |
\item{ROW_ANNO_PADDING}{space between row annotations and heatmap body.} |
62 |
+ \item{HEATMAP_LEGEND_PADDING}{space between heatmap legends and heatmaps} |
|
63 |
+ \item{ANNOTATION_LEGEND_PADDING}{space between annotation legends and heatmaps} |
|
62 | 64 |
} |
63 | 65 |
|
64 | 66 |
Other parameters: |