... | ... |
@@ -28,6 +28,14 @@ S3method("height<-", "HeatmapAnnotation") |
28 | 28 |
export("height<-.HeatmapAnnotation") |
29 | 29 |
S3method("height<-", "SingleAnnotation") |
30 | 30 |
export("height<-.SingleAnnotation") |
31 |
+S3method("heightDetails", "annotation_axis") |
|
32 |
+export("heightDetails.annotation_axis") |
|
33 |
+S3method("heightDetails", "legend") |
|
34 |
+export("heightDetails.legend") |
|
35 |
+S3method("heightDetails", "legend_body") |
|
36 |
+export("heightDetails.legend_body") |
|
37 |
+S3method("heightDetails", "packed_legends") |
|
38 |
+export("heightDetails.packed_legends") |
|
31 | 39 |
S3method("length", "HeatmapAnnotation") |
32 | 40 |
export("length.HeatmapAnnotation") |
33 | 41 |
S3method("merge", "dendrogram") |
... | ... |
@@ -74,6 +82,14 @@ S3method("width<-", "HeatmapAnnotation") |
74 | 82 |
export("width<-.HeatmapAnnotation") |
75 | 83 |
S3method("width<-", "SingleAnnotation") |
76 | 84 |
export("width<-.SingleAnnotation") |
85 |
+S3method("widthDetails", "annotation_axis") |
|
86 |
+export("widthDetails.annotation_axis") |
|
87 |
+S3method("widthDetails", "legend") |
|
88 |
+export("widthDetails.legend") |
|
89 |
+S3method("widthDetails", "legend_body") |
|
90 |
+export("widthDetails.legend_body") |
|
91 |
+S3method("widthDetails", "packed_legends") |
|
92 |
+export("widthDetails.packed_legends") |
|
77 | 93 |
export("%v%") |
78 | 94 |
export("AdditiveUnit") |
79 | 95 |
export("AnnotationFunction") |
... | ... |
@@ -373,7 +373,6 @@ size.HeatmapAnnotation = function(x, ...) { |
373 | 373 |
} |
374 | 374 |
|
375 | 375 |
|
376 |
- |
|
377 | 376 |
# == title |
378 | 377 |
# Width of the Legends |
379 | 378 |
# |
... | ... |
@@ -385,9 +384,11 @@ size.HeatmapAnnotation = function(x, ...) { |
385 | 384 |
# The returned unit x is in ``mm``. |
386 | 385 |
# |
387 | 386 |
width.Legends = function(x, ...) { |
388 |
- attr(x@grob, "width") |
|
387 |
+ s = attr(x@grob, "width") |
|
388 |
+ s |
|
389 | 389 |
} |
390 | 390 |
|
391 |
+ |
|
391 | 392 |
# == title |
392 | 393 |
# Height of the Legends |
393 | 394 |
# |
... | ... |
@@ -399,6 +400,7 @@ width.Legends = function(x, ...) { |
399 | 400 |
# The returned unit x is in ``mm``. |
400 | 401 |
# |
401 | 402 |
height.Legends = function(x, ...) { |
402 |
- attr(x@grob, "height") |
|
403 |
+ s = attr(x@grob, "height") |
|
404 |
+ s |
|
403 | 405 |
} |
404 | 406 |
|
... | ... |
@@ -2607,3 +2607,24 @@ row_anno_link = function(...) { |
2607 | 2607 |
anno_link(..., which = "row") |
2608 | 2608 |
} |
2609 | 2609 |
|
2610 |
+anno_summarize = function(which = c("column", "row"), |
|
2611 |
+ width = NULL, height = NULL, border = FALSE, ...) { |
|
2612 |
+ |
|
2613 |
+ if(is.null(.ENV$current_annotation_which)) { |
|
2614 |
+ which = match.arg(which)[1] |
|
2615 |
+ } else { |
|
2616 |
+ which = .ENV$current_annotation_which |
|
2617 |
+ } |
|
2618 |
+ |
|
2619 |
+ if(which == "column") { |
|
2620 |
+ stop("`anno_summarize()` is only allowed as a column annotation.") |
|
2621 |
+ } |
|
2622 |
+ |
|
2623 |
+ anno_size = anno_width_and_height(which, width, height, unit(2, "cm")) |
|
2624 |
+ |
|
2625 |
+ # get variables fron oncoPrint() function |
|
2626 |
+ pf = parent.frame() |
|
2627 |
+ # find where the heatmap object is. |
|
2628 |
+ |
|
2629 |
+} |
|
2630 |
+ |
... | ... |
@@ -123,7 +123,7 @@ HeatmapAnnotation = function(..., |
123 | 123 |
sc = sys.calls() |
124 | 124 |
for(i in seq_along(sc)) { |
125 | 125 |
scl = as.list(sc[[i]]) |
126 |
- if(as.character(scl[[1]]) %in% c("HeatmapAnnotation", "rowAnnotation", "columnAnnotation")) { |
|
126 |
+ if(any(as.character(scl[[1]]) %in% c("HeatmapAnnotation", "rowAnnotation", "columnAnnotation"))) { |
|
127 | 127 |
arg_list = scl[-1] |
128 | 128 |
break |
129 | 129 |
} |
... | ... |
@@ -309,7 +309,7 @@ HeatmapAnnotation = function(..., |
309 | 309 |
if(!missing(col)) { |
310 | 310 |
unused_col_name = setdiff(names(col), col_name_defined) |
311 | 311 |
if(length(unused_col_name)) { |
312 |
- warning(paste0("Following are defined in `col` while have no corresponding annotations:\n", paste(unused_col_name, collapse = ", "))) |
|
312 |
+ # warning(paste0("Following are defined in `col` while have no corresponding annotations:\n", paste(unused_col_name, collapse = ", "))) |
|
313 | 313 |
} |
314 | 314 |
} |
315 | 315 |
|
... | ... |
@@ -120,10 +120,23 @@ annotation_axis_grob = function(at = NULL, labels = at, labels_rot = 0, gp = gpa |
120 | 120 |
return(gb) |
121 | 121 |
} |
122 | 122 |
|
123 |
+ |
|
124 |
+# == title |
|
125 |
+# Grob width for annotation_axis |
|
126 |
+# |
|
127 |
+# == param |
|
128 |
+# -x legend body |
|
129 |
+# |
|
123 | 130 |
widthDetails.annotation_axis = function(x) { |
124 | 131 |
attr(x, "width") |
125 | 132 |
} |
126 | 133 |
|
134 |
+# == title |
|
135 |
+# Grob width for annotation_axis |
|
136 |
+# |
|
137 |
+# == param |
|
138 |
+# -x legend body |
|
139 |
+# |
|
127 | 140 |
heightDetails.annotation_axis = function(x) { |
128 | 141 |
attr(x, "height") |
129 | 142 |
} |
... | ... |
@@ -4,7 +4,6 @@ |
4 | 4 |
# |
5 | 5 |
# == details |
6 | 6 |
# This is a very simple class for legends that it only has one slot which is the real `grid::grob` of the legends. |
7 |
-# The design of the ``Legends`` class is to support more helper functions such as `width.Legends` to get |
|
8 | 7 |
# more information of the legends grob. |
9 | 8 |
# |
10 | 9 |
# == example |
... | ... |
@@ -218,7 +217,7 @@ Legend = function(at, labels = at, col_fun, nrow = NULL, ncol = 1, by_row = FALS |
218 | 217 |
textGrob(title, x = title_x, y = unit(1, "npc"), just = title_just, gp = title_gp), |
219 | 218 |
edit_vp_in_legend_grob(legend_body, x = unit(0, "npc"), y = unit(0, "npc"), valid.just = c(0, 0)), |
220 | 219 |
vp = viewport(width = total_width, height = total_height), |
221 |
- cl = "Legend" |
|
220 |
+ cl = "legend" |
|
222 | 221 |
) |
223 | 222 |
attr(gf, "width") = total_width |
224 | 223 |
attr(gf, "height") = total_height |
... | ... |
@@ -273,7 +272,7 @@ Legend = function(at, labels = at, col_fun, nrow = NULL, ncol = 1, by_row = FALS |
273 | 272 |
edit_vp_in_legend_grob(legend_body, x = unit(1, "npc"), y = unit(1, "npc"), |
274 | 273 |
valid.just = c(1, 1)), |
275 | 274 |
vp = viewport(width = total_width, height = total_height), |
276 |
- cl = "Legend" |
|
275 |
+ cl = "legend" |
|
277 | 276 |
) |
278 | 277 |
attr(gf, "width") = total_width |
279 | 278 |
attr(gf, "height") = total_height |
... | ... |
@@ -761,6 +760,10 @@ packLegend = function(..., gap = unit(2, "mm"), direction = c("vertical", "horiz |
761 | 760 |
} else { |
762 | 761 |
legend_list = list(...) |
763 | 762 |
} |
763 |
+ if(length(legend_list) == 1) { |
|
764 |
+ return(legend_list[[1]]) |
|
765 |
+ } |
|
766 |
+ |
|
764 | 767 |
legend_list = lapply(legend_list, function(x) { |
765 | 768 |
lgd = x@grob |
766 | 769 |
lgd$name = legend_grob_name() |
... | ... |
@@ -809,7 +812,6 @@ packLegend = function(..., gap = unit(2, "mm"), direction = c("vertical", "horiz |
809 | 812 |
|
810 | 813 |
## pack_width is the width for each column |
811 | 814 |
## pack_height is the total height of the packed legends |
812 |
- |
|
813 | 815 |
gl = list() |
814 | 816 |
for(i in 1:nc) { |
815 | 817 |
ind = ind_list[[i]] |
... | ... |
@@ -1036,22 +1038,67 @@ grid.draw.Legends = function(x, recording = TRUE) { |
1036 | 1038 |
grid.draw(x@grob, recording = recording) |
1037 | 1039 |
} |
1038 | 1040 |
|
1041 |
+# == title |
|
1042 |
+# Grob width for legend_body |
|
1043 |
+# |
|
1044 |
+# == param |
|
1045 |
+# -x legend body |
|
1046 |
+# |
|
1039 | 1047 |
widthDetails.legend_body = function(x) { |
1040 | 1048 |
attr(x, "width") |
1041 | 1049 |
} |
1042 | 1050 |
|
1051 |
+# == title |
|
1052 |
+# Grob height for legend_body |
|
1053 |
+# |
|
1054 |
+# == param |
|
1055 |
+# -x legend body |
|
1056 |
+# |
|
1043 | 1057 |
heightDetails.legend_body = function(x) { |
1044 | 1058 |
attr(x, "height") |
1045 | 1059 |
} |
1046 | 1060 |
|
1061 |
+# == title |
|
1062 |
+# Grob width for packed_legends |
|
1063 |
+# |
|
1064 |
+# == param |
|
1065 |
+# -x legend body |
|
1066 |
+# |
|
1067 |
+widthDetails.legend = function(x) { |
|
1068 |
+ attr(x, "width") |
|
1069 |
+} |
|
1070 |
+ |
|
1071 |
+# == title |
|
1072 |
+# Grob height for packed_legends |
|
1073 |
+# |
|
1074 |
+# == param |
|
1075 |
+# -x legend body |
|
1076 |
+# |
|
1077 |
+heightDetails.legend = function(x) { |
|
1078 |
+ attr(x, "height") |
|
1079 |
+} |
|
1080 |
+ |
|
1081 |
+# == title |
|
1082 |
+# Grob width for packed_legends |
|
1083 |
+# |
|
1084 |
+# == param |
|
1085 |
+# -x legend body |
|
1086 |
+# |
|
1047 | 1087 |
widthDetails.packed_legends = function(x) { |
1048 | 1088 |
attr(x, "width") |
1049 | 1089 |
} |
1050 | 1090 |
|
1091 |
+# == title |
|
1092 |
+# Grob height for packed_legends |
|
1093 |
+# |
|
1094 |
+# == param |
|
1095 |
+# -x legend body |
|
1096 |
+# |
|
1051 | 1097 |
heightDetails.packed_legends = function(x) { |
1052 | 1098 |
attr(x, "height") |
1053 | 1099 |
} |
1054 | 1100 |
|
1101 |
+ |
|
1055 | 1102 |
# assume x is ordered |
1056 | 1103 |
is_diff_equal = function(x) { |
1057 | 1104 |
all(abs(diff(diff(x)))/mean(diff(x)) < 1e-4) |
... | ... |
@@ -9,7 +9,6 @@ The Class for Legends |
9 | 9 |
} |
10 | 10 |
\details{ |
11 | 11 |
This is a very simple class for legends that it only has one slot which is the real \code{\link[grid]{grob}} of the legends. |
12 |
-The design of the \code{Legends} class is to support more helper functions such as \code{\link{width.Legends}} to get |
|
13 | 12 |
more information of the legends grob. |
14 | 13 |
} |
15 | 14 |
\examples{ |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{+.AdditiveUnit} |
2 | 2 |
\alias{+.AdditiveUnit} |
3 |
+\alias{add.AdditiveUnit} |
|
3 | 4 |
\title{ |
4 | 5 |
Horizontally Add Heatmaps or Annotations to a Heatmap List |
5 | 6 |
} |
... | ... |
@@ -25,7 +26,7 @@ The \code{\link{HeatmapAnnotation-class}} object to be added should only be row |
25 | 26 |
A \code{\link{HeatmapList-class}} object. |
26 | 27 |
} |
27 | 28 |
\seealso{ |
28 |
-\code{\link{\%v\%}} operator is used for vertical heatmap list. |
|
29 |
+\code{\link[=pct_v_pct]{\%v\%}} operator is used for vertical heatmap list. |
|
29 | 30 |
} |
30 | 31 |
\author{ |
31 | 32 |
Zuguang Gu <z.gu@dkfz.de> |
... | ... |
@@ -33,4 +34,5 @@ Zuguang Gu <z.gu@dkfz.de> |
33 | 34 |
\examples{ |
34 | 35 |
# There is no example |
35 | 36 |
NULL |
37 |
+ |
|
36 | 38 |
} |
... | ... |
@@ -17,7 +17,7 @@ Add row annotations or heatmaps as a heatmap list |
17 | 17 |
|
18 | 18 |
} |
19 | 19 |
\details{ |
20 |
-There is a helper function \code{+.AdditiveUnit} for horizontal add or \code{\link{\%v\%}} for vertical add. |
|
20 |
+There is a helper function \code{+.AdditiveUnit} for horizontal add or \code{\link[=pct_v_pct]{\%v\%}} for vertical add. |
|
21 | 21 |
} |
22 | 22 |
\value{ |
23 | 23 |
A \code{\link{HeatmapList-class}} object. |
... | ... |
@@ -28,4 +28,5 @@ Zuguang Gu <z.gu@dkfz.de> |
28 | 28 |
\examples{ |
29 | 29 |
# There is no example |
30 | 30 |
NULL |
31 |
+ |
|
31 | 32 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{adjust_heatmap_list-HeatmapList-method} |
2 | 2 |
\alias{adjust_heatmap_list,HeatmapList-method} |
3 |
+\alias{adjust_heatmap_list} |
|
3 | 4 |
\title{ |
4 | 5 |
Adjust heatmap list |
5 | 6 |
} |
... | ... |
@@ -14,8 +15,8 @@ Adjust heatmap list |
14 | 15 |
\item{object}{A \code{\link{HeatmapList-class}} object} |
15 | 16 |
|
16 | 17 |
} |
17 |
-\alias{adjust_heatmap_list} |
|
18 | 18 |
\examples{ |
19 | 19 |
# There is no example |
20 | 20 |
NULL |
21 |
+ |
|
21 | 22 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{annotation_legend_size-HeatmapList-method} |
2 | 2 |
\alias{annotation_legend_size,HeatmapList-method} |
3 |
+\alias{annotation_legend_size} |
|
3 | 4 |
\title{ |
4 | 5 |
Size of the annotation legend viewport |
5 | 6 |
} |
... | ... |
@@ -28,8 +29,8 @@ A \code{\link[grid]{unit}} object. |
28 | 29 |
\author{ |
29 | 30 |
Zuguang Gu <z.gu@dkfz.de> |
30 | 31 |
} |
31 |
-\alias{annotation_legend_size} |
|
32 | 32 |
\examples{ |
33 | 33 |
# There is no example |
34 | 34 |
NULL |
35 |
+ |
|
35 | 36 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{color_mapping_legend-ColorMapping-method} |
2 | 2 |
\alias{color_mapping_legend,ColorMapping-method} |
3 |
+\alias{color_mapping_legend} |
|
3 | 4 |
\title{ |
4 | 5 |
Draw Legend Based on Color Mapping |
5 | 6 |
} |
... | ... |
@@ -65,8 +66,8 @@ A \code{\link{Legends-class}} object. |
65 | 66 |
\author{ |
66 | 67 |
Zuguang Gu <z.gu@dkfz.de> |
67 | 68 |
} |
68 |
-\alias{color_mapping_legend} |
|
69 | 69 |
\examples{ |
70 | 70 |
# There is no example |
71 | 71 |
NULL |
72 |
+ |
|
72 | 73 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{draw_annotation-Heatmap-method} |
2 | 2 |
\alias{draw_annotation,Heatmap-method} |
3 |
+\alias{draw_annotation} |
|
3 | 4 |
\title{ |
4 | 5 |
Draw Heatmap Annotations on the Heatmap |
5 | 6 |
} |
... | ... |
@@ -30,8 +31,8 @@ This function returns no value. |
30 | 31 |
\author{ |
31 | 32 |
Zuguang Gu <z.gu@dkfz.de> |
32 | 33 |
} |
33 |
-\alias{draw_annotation} |
|
34 | 34 |
\examples{ |
35 | 35 |
# There is no example |
36 | 36 |
NULL |
37 |
+ |
|
37 | 38 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{draw_annotation_legend-HeatmapList-method} |
2 | 2 |
\alias{draw_annotation_legend,HeatmapList-method} |
3 |
+\alias{draw_annotation_legend} |
|
3 | 4 |
\title{ |
4 | 5 |
Draw legends for all column annotations |
5 | 6 |
} |
... | ... |
@@ -27,8 +28,8 @@ This function returns no value. |
27 | 28 |
\author{ |
28 | 29 |
Zuguang Gu <z.gu@dkfz.de> |
29 | 30 |
} |
30 |
-\alias{draw_annotation_legend} |
|
31 | 31 |
\examples{ |
32 | 32 |
# There is no example |
33 | 33 |
NULL |
34 |
+ |
|
34 | 35 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{draw_dend-Heatmap-method} |
2 | 2 |
\alias{draw_dend,Heatmap-method} |
3 |
+\alias{draw_dend} |
|
3 | 4 |
\title{ |
4 | 5 |
Draw Heatmap Dendrograms |
5 | 6 |
} |
... | ... |
@@ -33,8 +34,8 @@ This function returns no value. |
33 | 34 |
\author{ |
34 | 35 |
Zuguang Gu <z.gu@dkfz.de> |
35 | 36 |
} |
36 |
-\alias{draw_dend} |
|
37 | 37 |
\examples{ |
38 | 38 |
# There is no example |
39 | 39 |
NULL |
40 |
+ |
|
40 | 41 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{draw_dimnames-Heatmap-method} |
2 | 2 |
\alias{draw_dimnames,Heatmap-method} |
3 |
+\alias{draw_dimnames} |
|
3 | 4 |
\title{ |
4 | 5 |
Draw row names or column names |
5 | 6 |
} |
... | ... |
@@ -29,8 +30,8 @@ This function returns no value. |
29 | 30 |
\author{ |
30 | 31 |
Zuguang Gu <z.gu@dkfz.de> |
31 | 32 |
} |
32 |
-\alias{draw_dimnames} |
|
33 | 33 |
\examples{ |
34 | 34 |
# There is no example |
35 | 35 |
NULL |
36 |
+ |
|
36 | 37 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{draw_heatmap_body-Heatmap-method} |
2 | 2 |
\alias{draw_heatmap_body,Heatmap-method} |
3 |
+\alias{draw_heatmap_body} |
|
3 | 4 |
\title{ |
4 | 5 |
Draw the heatmap body |
5 | 6 |
} |
... | ... |
@@ -28,8 +29,8 @@ This function returns no value. |
28 | 29 |
\author{ |
29 | 30 |
Zuguang Gu <z.gu@dkfz.de> |
30 | 31 |
} |
31 |
-\alias{draw_heatmap_body} |
|
32 | 32 |
\examples{ |
33 | 33 |
# There is no example |
34 | 34 |
NULL |
35 |
+ |
|
35 | 36 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{draw_heatmap_legend-HeatmapList-method} |
2 | 2 |
\alias{draw_heatmap_legend,HeatmapList-method} |
3 |
+\alias{draw_heatmap_legend} |
|
3 | 4 |
\title{ |
4 | 5 |
Draw legends for all heatmaps |
5 | 6 |
} |
... | ... |
@@ -27,8 +28,8 @@ This function returns no value. |
27 | 28 |
\author{ |
28 | 29 |
Zuguang Gu <z.gu@dkfz.de> |
29 | 30 |
} |
30 |
-\alias{draw_heatmap_legend} |
|
31 | 31 |
\examples{ |
32 | 32 |
# There is no example |
33 | 33 |
NULL |
34 |
+ |
|
34 | 35 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{draw_heatmap_list-HeatmapList-method} |
2 | 2 |
\alias{draw_heatmap_list,HeatmapList-method} |
3 |
+\alias{draw_heatmap_list} |
|
3 | 4 |
\title{ |
4 | 5 |
Draw the list of heatmaps |
5 | 6 |
} |
... | ... |
@@ -25,8 +26,8 @@ This function returns no value. |
25 | 26 |
\author{ |
26 | 27 |
Zuguang Gu <z.gu@dkfz.de> |
27 | 28 |
} |
28 |
-\alias{draw_heatmap_list} |
|
29 | 29 |
\examples{ |
30 | 30 |
# There is no example |
31 | 31 |
NULL |
32 |
+ |
|
32 | 33 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{get_color_mapping_list-HeatmapAnnotation-method} |
2 | 2 |
\alias{get_color_mapping_list,HeatmapAnnotation-method} |
3 |
+\alias{get_color_mapping_list} |
|
3 | 4 |
\title{ |
4 | 5 |
Get a List of ColorMapping objects |
5 | 6 |
} |
... | ... |
@@ -25,8 +26,8 @@ A list of \code{\link{ColorMapping-class}} objects or an empty list. |
25 | 26 |
\author{ |
26 | 27 |
Zuguang Gu <z.gu@dkfz.de> |
27 | 28 |
} |
28 |
-\alias{get_color_mapping_list} |
|
29 | 29 |
\examples{ |
30 | 30 |
# There is no example |
31 | 31 |
NULL |
32 |
+ |
|
32 | 33 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{get_legend_param_list-HeatmapAnnotation-method} |
2 | 2 |
\alias{get_legend_param_list,HeatmapAnnotation-method} |
3 |
+\alias{get_legend_param_list} |
|
3 | 4 |
\title{ |
4 | 5 |
Get a List of Annotation Legend Parameters |
5 | 6 |
} |
... | ... |
@@ -25,8 +26,8 @@ A list. |
25 | 26 |
\author{ |
26 | 27 |
Zuguang Gu <z.gu@dkfz.de> |
27 | 28 |
} |
28 |
-\alias{get_legend_param_list} |
|
29 | 29 |
\examples{ |
30 | 30 |
# There is no example |
31 | 31 |
NULL |
32 |
+ |
|
32 | 33 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{heatmap_legend_size-HeatmapList-method} |
2 | 2 |
\alias{heatmap_legend_size,HeatmapList-method} |
3 |
+\alias{heatmap_legend_size} |
|
3 | 4 |
\title{ |
4 | 5 |
Size of the heatmap legend viewport |
5 | 6 |
} |
... | ... |
@@ -25,8 +26,8 @@ A \code{\link[grid]{unit}} object. |
25 | 26 |
\author{ |
26 | 27 |
Zuguang Gu <z.gu@dkfz.de> |
27 | 28 |
} |
28 |
-\alias{heatmap_legend_size} |
|
29 | 29 |
\examples{ |
30 | 30 |
# There is no example |
31 | 31 |
NULL |
32 |
+ |
|
32 | 33 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{height<-.AnnotationFunction} |
2 | 2 |
\alias{height<-.AnnotationFunction} |
3 |
+\alias{heightAssign.AnnotationFunction} |
|
3 | 4 |
\title{ |
4 | 5 |
Assign the Height to the AnnotationFunction x |
5 | 6 |
} |
... | ... |
@@ -19,4 +20,5 @@ Assign the Height to the AnnotationFunction x |
19 | 20 |
\examples{ |
20 | 21 |
# There is no example |
21 | 22 |
NULL |
23 |
+ |
|
22 | 24 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{height<-.HeatmapAnnotation} |
2 | 2 |
\alias{height<-.HeatmapAnnotation} |
3 |
+\alias{heightAssign.HeatmapAnnotation} |
|
3 | 4 |
\title{ |
4 | 5 |
Assign the Height to the HeatmapAnnotation x |
5 | 6 |
} |
... | ... |
@@ -19,4 +20,5 @@ Assign the Height to the HeatmapAnnotation x |
19 | 20 |
\examples{ |
20 | 21 |
# There is no example |
21 | 22 |
NULL |
23 |
+ |
|
22 | 24 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{height<-.SingleAnnotation} |
2 | 2 |
\alias{height<-.SingleAnnotation} |
3 |
+\alias{heightAssign.SingleAnnotation} |
|
3 | 4 |
\title{ |
4 | 5 |
Assign the Height to the SingleAnnotation x |
5 | 6 |
} |
... | ... |
@@ -19,4 +20,5 @@ Assign the Height to the SingleAnnotation x |
19 | 20 |
\examples{ |
20 | 21 |
# There is no example |
21 | 22 |
NULL |
23 |
+ |
|
22 | 24 |
} |
23 | 25 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+\name{heightDetails.legend} |
|
2 |
+\alias{heightDetails.legend} |
|
3 |
+\title{ |
|
4 |
+Grob height for packed_legends |
|
5 |
+} |
|
6 |
+\description{ |
|
7 |
+Grob height for packed_legends |
|
8 |
+} |
|
9 |
+\usage{ |
|
10 |
+\method{heightDetails}{legend}(x) |
|
11 |
+} |
|
12 |
+\arguments{ |
|
13 |
+ |
|
14 |
+ \item{x}{legend body} |
|
15 |
+ |
|
16 |
+} |
|
17 |
+\examples{ |
|
18 |
+# There is no example |
|
19 |
+NULL |
|
20 |
+ |
|
21 |
+} |
0 | 22 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+\name{heightDetails.annotation_axis} |
|
2 |
+\alias{heightDetails.annotation_axis} |
|
3 |
+\title{ |
|
4 |
+Grob width for annotation_axis |
|
5 |
+} |
|
6 |
+\description{ |
|
7 |
+Grob width for annotation_axis |
|
8 |
+} |
|
9 |
+\usage{ |
|
10 |
+\method{heightDetails}{annotation_axis}(x) |
|
11 |
+} |
|
12 |
+\arguments{ |
|
13 |
+ |
|
14 |
+ \item{x}{legend body} |
|
15 |
+ |
|
16 |
+} |
|
17 |
+\examples{ |
|
18 |
+# There is no example |
|
19 |
+NULL |
|
20 |
+ |
|
21 |
+} |
0 | 22 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+\name{heightDetails.legend_body} |
|
2 |
+\alias{heightDetails.legend_body} |
|
3 |
+\title{ |
|
4 |
+Grob height for legend_body |
|
5 |
+} |
|
6 |
+\description{ |
|
7 |
+Grob height for legend_body |
|
8 |
+} |
|
9 |
+\usage{ |
|
10 |
+\method{heightDetails}{legend_body}(x) |
|
11 |
+} |
|
12 |
+\arguments{ |
|
13 |
+ |
|
14 |
+ \item{x}{legend body} |
|
15 |
+ |
|
16 |
+} |
|
17 |
+\examples{ |
|
18 |
+# There is no example |
|
19 |
+NULL |
|
20 |
+ |
|
21 |
+} |
0 | 22 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+\name{heightDetails.packed_legends} |
|
2 |
+\alias{heightDetails.packed_legends} |
|
3 |
+\title{ |
|
4 |
+Grob height for packed_legends |
|
5 |
+} |
|
6 |
+\description{ |
|
7 |
+Grob height for packed_legends |
|
8 |
+} |
|
9 |
+\usage{ |
|
10 |
+\method{heightDetails}{packed_legends}(x) |
|
11 |
+} |
|
12 |
+\arguments{ |
|
13 |
+ |
|
14 |
+ \item{x}{legend body} |
|
15 |
+ |
|
16 |
+} |
|
17 |
+\examples{ |
|
18 |
+# There is no example |
|
19 |
+NULL |
|
20 |
+ |
|
21 |
+} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{make_column_cluster-Heatmap-method} |
2 | 2 |
\alias{make_column_cluster,Heatmap-method} |
3 |
+\alias{make_column_cluster} |
|
3 | 4 |
\title{ |
4 | 5 |
Make Cluster on Columns |
5 | 6 |
} |
... | ... |
@@ -27,8 +28,8 @@ A \code{\link{Heatmap-class}} object. |
27 | 28 |
\author{ |
28 | 29 |
Zuguang Gu <z.gu@dkfz.de> |
29 | 30 |
} |
30 |
-\alias{make_column_cluster} |
|
31 | 31 |
\examples{ |
32 | 32 |
# There is no example |
33 | 33 |
NULL |
34 |
+ |
|
34 | 35 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{make_row_cluster-Heatmap-method} |
2 | 2 |
\alias{make_row_cluster,Heatmap-method} |
3 |
+\alias{make_row_cluster} |
|
3 | 4 |
\title{ |
4 | 5 |
Make Cluster on Rows |
5 | 6 |
} |
... | ... |
@@ -27,8 +28,8 @@ A \code{\link{Heatmap-class}} object. |
27 | 28 |
\author{ |
28 | 29 |
Zuguang Gu <z.gu@dkfz.de> |
29 | 30 |
} |
30 |
-\alias{make_row_cluster} |
|
31 | 31 |
\examples{ |
32 | 32 |
# There is no example |
33 | 33 |
NULL |
34 |
+ |
|
34 | 35 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{map_to_colors-ColorMapping-method} |
2 | 2 |
\alias{map_to_colors,ColorMapping-method} |
3 |
+\alias{map_to_colors} |
|
3 | 4 |
\title{ |
4 | 5 |
Map Values to Colors |
5 | 6 |
} |
... | ... |
@@ -34,4 +35,3 @@ col_fun = colorRamp2(c(0, 1), c("white", "red")) |
34 | 35 |
cm = ColorMapping(col_fun = col_fun) |
35 | 36 |
map_to_colors(cm, runif(10)) |
36 | 37 |
} |
37 |
-\alias{map_to_colors} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{\%v\%} |
2 | 2 |
\alias{\%v\%} |
3 |
+\alias{pct_v_pct} |
|
3 | 4 |
\title{ |
4 | 5 |
Vertically Add Heatmaps or Annotations to a Heatmap List |
5 | 6 |
} |
... | ... |
@@ -25,7 +26,7 @@ The \code{\link{HeatmapAnnotation-class}} object to be added should only be colu |
25 | 26 |
A \code{\link{HeatmapList-class}} object. |
26 | 27 |
} |
27 | 28 |
\seealso{ |
28 |
-\code{\link{+.AdditiveUnit}} operator is used for vertical heatmap list. |
|
29 |
+\code{\link[=add.AdditiveUnit]{+.AdditiveUnit}} operator is used for vertical heatmap list. |
|
29 | 30 |
} |
30 | 31 |
\author{ |
31 | 32 |
Zuguang Gu <z.gu@dkfz.de> |
... | ... |
@@ -33,4 +34,5 @@ Zuguang Gu <z.gu@dkfz.de> |
33 | 34 |
\examples{ |
34 | 35 |
# There is no example |
35 | 36 |
NULL |
37 |
+ |
|
36 | 38 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{prepare-Heatmap-method} |
2 | 2 |
\alias{prepare,Heatmap-method} |
3 |
+\alias{prepare} |
|
3 | 4 |
\title{ |
4 | 5 |
Prepare the Heatmap |
5 | 6 |
} |
... | ... |
@@ -33,8 +34,8 @@ The \code{\link{Heatmap-class}} object. |
33 | 34 |
\author{ |
34 | 35 |
Zuguang Gu <z.gu@dkfz.de> |
35 | 36 |
} |
36 |
-\alias{prepare} |
|
37 | 37 |
\examples{ |
38 | 38 |
# There is no example |
39 | 39 |
NULL |
40 |
+ |
|
40 | 41 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{resize-HeatmapAnnotation-method} |
2 | 2 |
\alias{resize,HeatmapAnnotation-method} |
3 |
+\alias{resize} |
|
3 | 4 |
\title{ |
4 | 5 |
Resize the Width or Height of Heatmap Annotations |
5 | 6 |
} |
... | ... |
@@ -40,8 +41,8 @@ the basic rule is: |
40 | 41 |
and \code{anno_simple_row_size} is disabled. |
41 | 42 |
6. If \code{simple_anno_size_adjust} is \code{FALSE}, the size of the simple annotations will not change. |
42 | 43 |
} |
43 |
-\alias{resize} |
|
44 | 44 |
\examples{ |
45 | 45 |
# There is no example |
46 | 46 |
NULL |
47 |
+ |
|
47 | 48 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{set_component_height-Heatmap-method} |
2 | 2 |
\alias{set_component_height,Heatmap-method} |
3 |
+\alias{set_component_height} |
|
3 | 4 |
\title{ |
4 | 5 |
Set Height of Heatmap Component |
5 | 6 |
} |
... | ... |
@@ -29,8 +30,8 @@ The \code{\link{Heatmap-class}} object. |
29 | 30 |
\author{ |
30 | 31 |
Zuguang Gu <z.gu@dkfz.de> |
31 | 32 |
} |
32 |
-\alias{set_component_height} |
|
33 | 33 |
\examples{ |
34 | 34 |
# There is no example |
35 | 35 |
NULL |
36 |
+ |
|
36 | 37 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{set_component_width-Heatmap-method} |
2 | 2 |
\alias{set_component_width,Heatmap-method} |
3 |
+\alias{set_component_width} |
|
3 | 4 |
\title{ |
4 | 5 |
Set Width of Heatmap Component |
5 | 6 |
} |
... | ... |
@@ -28,8 +29,8 @@ The \code{\link{Heatmap-class}} object. |
28 | 29 |
\author{ |
29 | 30 |
Zuguang Gu <z.gu@dkfz.de> |
30 | 31 |
} |
31 |
-\alias{set_component_width} |
|
32 | 32 |
\examples{ |
33 | 33 |
# There is no example |
34 | 34 |
NULL |
35 |
+ |
|
35 | 36 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{size<-.HeatmapAnnotation} |
2 | 2 |
\alias{size<-.HeatmapAnnotation} |
3 |
+\alias{sizeAssign.HeatmapAnnotation} |
|
3 | 4 |
\title{ |
4 | 5 |
Assign the Size to the HeatmapAnnotation x |
5 | 6 |
} |
... | ... |
@@ -22,4 +23,5 @@ It assigns the width if it is a row annotation and the height if it is a column |
22 | 23 |
\examples{ |
23 | 24 |
# There is no example |
24 | 25 |
NULL |
26 |
+ |
|
25 | 27 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{size<-.SingleAnnotation} |
2 | 2 |
\alias{size<-.SingleAnnotation} |
3 |
+\alias{sizeAssign.SingleAnnotation} |
|
3 | 4 |
\title{ |
4 | 5 |
Assign the Size of the SingleAnnotation x |
5 | 6 |
} |
... | ... |
@@ -22,4 +23,5 @@ It assigns the width if it is a row annotation and the height if it is a column |
22 | 23 |
\examples{ |
23 | 24 |
# There is no example |
24 | 25 |
NULL |
26 |
+ |
|
25 | 27 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{width<-.AnnotationFunction} |
2 | 2 |
\alias{width<-.AnnotationFunction} |
3 |
+\alias{widthAssign.AnnotationFunction} |
|
3 | 4 |
\title{ |
4 | 5 |
Assign the Width to the AnnotationFunction x |
5 | 6 |
} |
... | ... |
@@ -19,4 +20,5 @@ Assign the Width to the AnnotationFunction x |
19 | 20 |
\examples{ |
20 | 21 |
# There is no example |
21 | 22 |
NULL |
23 |
+ |
|
22 | 24 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{width<-.HeatmapAnnotation} |
2 | 2 |
\alias{width<-.HeatmapAnnotation} |
3 |
+\alias{widthAssign.HeatmapAnnotation} |
|
3 | 4 |
\title{ |
4 | 5 |
Assign the Width to the HeatmapAnnotation x |
5 | 6 |
} |
... | ... |
@@ -19,4 +20,5 @@ Assign the Width to the HeatmapAnnotation x |
19 | 20 |
\examples{ |
20 | 21 |
# There is no example |
21 | 22 |
NULL |
23 |
+ |
|
22 | 24 |
} |
... | ... |
@@ -1,5 +1,6 @@ |
1 | 1 |
\name{width<-.SingleAnnotation} |
2 | 2 |
\alias{width<-.SingleAnnotation} |
3 |
+\alias{widthAssign.SingleAnnotation} |
|
3 | 4 |
\title{ |
4 | 5 |
Assign the Width to the SingleAnnotation x |
5 | 6 |
} |
... | ... |
@@ -19,4 +20,5 @@ Assign the Width to the SingleAnnotation x |
19 | 20 |
\examples{ |
20 | 21 |
# There is no example |
21 | 22 |
NULL |
23 |
+ |
|
22 | 24 |
} |
23 | 25 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+\name{widthDetails.legend} |
|
2 |
+\alias{widthDetails.legend} |
|
3 |
+\title{ |
|
4 |
+Grob width for packed_legends |
|
5 |
+} |
|
6 |
+\description{ |
|
7 |
+Grob width for packed_legends |
|
8 |
+} |
|
9 |
+\usage{ |
|
10 |
+\method{widthDetails}{legend}(x) |
|
11 |
+} |
|
12 |
+\arguments{ |
|
13 |
+ |
|
14 |
+ \item{x}{legend body} |
|
15 |
+ |
|
16 |
+} |
|
17 |
+\examples{ |
|
18 |
+# There is no example |
|
19 |
+NULL |
|
20 |
+ |
|
21 |
+} |
0 | 22 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+\name{widthDetails.annotation_axis} |
|
2 |
+\alias{widthDetails.annotation_axis} |
|
3 |
+\title{ |
|
4 |
+Grob width for annotation_axis |
|
5 |
+} |
|
6 |
+\description{ |
|
7 |
+Grob width for annotation_axis |
|
8 |
+} |
|
9 |
+\usage{ |
|
10 |
+\method{widthDetails}{annotation_axis}(x) |
|
11 |
+} |
|
12 |
+\arguments{ |
|
13 |
+ |
|
14 |
+ \item{x}{legend body} |
|
15 |
+ |
|
16 |
+} |
|
17 |
+\examples{ |
|
18 |
+# There is no example |
|
19 |
+NULL |
|
20 |
+ |
|
21 |
+} |
0 | 22 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+\name{widthDetails.legend_body} |
|
2 |
+\alias{widthDetails.legend_body} |
|
3 |
+\title{ |
|
4 |
+Grob width for legend_body |
|
5 |
+} |
|
6 |
+\description{ |
|
7 |
+Grob width for legend_body |
|
8 |
+} |
|
9 |
+\usage{ |
|
10 |
+\method{widthDetails}{legend_body}(x) |
|
11 |
+} |
|
12 |
+\arguments{ |
|
13 |
+ |
|
14 |
+ \item{x}{legend body} |
|
15 |
+ |
|
16 |
+} |
|
17 |
+\examples{ |
|
18 |
+# There is no example |
|
19 |
+NULL |
|
20 |
+ |
|
21 |
+} |
0 | 22 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,21 @@ |
1 |
+\name{widthDetails.packed_legends} |
|
2 |
+\alias{widthDetails.packed_legends} |
|
3 |
+\title{ |
|
4 |
+Grob width for packed_legends |
|
5 |
+} |
|
6 |
+\description{ |
|
7 |
+Grob width for packed_legends |
|
8 |
+} |
|
9 |
+\usage{ |
|
10 |
+\method{widthDetails}{packed_legends}(x) |
|
11 |
+} |
|
12 |
+\arguments{ |
|
13 |
+ |
|
14 |
+ \item{x}{legend body} |
|
15 |
+ |
|
16 |
+} |
|
17 |
+\examples{ |
|
18 |
+# There is no example |
|
19 |
+NULL |
|
20 |
+ |
|
21 |
+} |
0 | 22 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,167 @@ |
1 |
+#toc { |
|
2 |
+ position: fixed; |
|
3 |
+ left: 0; |
|
4 |
+ top: 20px; |
|
5 |
+ width: 200px; |
|
6 |
+ height: 100%; |
|
7 |
+ overflow:auto; |
|
8 |
+ padding: 0px 10px 0px 10px; |
|
9 |
+} |
|
10 |
+#toc_header { |
|
11 |
+ display: none; |
|
12 |
+} |
|
13 |
+#toc ul { |
|
14 |
+ margin: 0px; |
|
15 |
+ padding: 0px; |
|
16 |
+} |
|
17 |
+#toc ul li { |
|
18 |
+ list-style-type: none; |
|
19 |
+} |
|
20 |
+ |
|
21 |
+#toc ul li ul li { |
|
22 |
+ margin-left: 15px; |
|
23 |
+ list-style-type: circle; |
|
24 |
+} |
|
25 |
+body, td { |
|
26 |
+ font-family: Arial,Helvetica,sans-serif; |
|
27 |
+ background-color: white; |
|
28 |
+ font-size: 13px; |
|
29 |
+ max-width: 800px; |
|
30 |
+ margin: auto; |
|
31 |
+ margin-left:210px; |
|
32 |
+ padding: 0px 10px 0px 10px; |
|
33 |
+ border-left: 1px solid #EEEEEE; |
|
34 |
+ line-height: 150%; |
|
35 |
+} |
|
36 |
+ |
|
37 |
+tt, code, pre { |
|
38 |
+ font-family: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', Consolas, Monaco, |
|
39 |
+ |
|
40 |
+monospace; |
|
41 |
+} |
|
42 |
+ |
|
43 |
+h1 { |
|
44 |
+ font-size:2.2em; |
|
45 |
+} |
|
46 |
+ |
|
47 |
+h2 { |
|
48 |
+ font-size:1.8em; |
|
49 |
+} |
|
50 |
+ |
|
51 |
+h3 { |
|
52 |
+ font-size:1.4em; |
|
53 |
+} |
|
54 |
+ |
|
55 |
+h4 { |
|
56 |
+ font-size:1.0em; |
|
57 |
+} |
|
58 |
+ |
|
59 |
+h5 { |
|
60 |
+ font-size:0.9em; |
|
61 |
+} |
|
62 |
+ |
|
63 |
+h6 { |
|
64 |
+ font-size:0.8em; |
|
65 |
+} |
|
66 |
+ |
|
67 |
+a { |
|
68 |
+ text-decoration: none; |
|
69 |
+} |
|
70 |
+ |
|
71 |
+a:hover { |
|
72 |
+ text-decoration: underline; |
|
73 |
+} |
|
74 |
+ |
|
75 |
+a:visited { |
|
76 |
+ color: rgb(50%, 0%, 50%); |
|
77 |
+} |
|
78 |
+ |
|
79 |
+pre, img { |
|
80 |
+ max-width: 100%; |
|
81 |
+} |
|
82 |
+pre { |
|
83 |
+ overflow-x: auto; |
|
84 |
+} |
|
85 |
+pre code { |
|
86 |
+ display: block; padding: 0.5em; |
|
87 |
+} |
|
88 |
+ |
|
89 |
+code { |
|
90 |
+ font-size: 92%; |
|
91 |
+ border: 1px solid #ccc; |
|
92 |
+} |
|
93 |
+ |
|
94 |
+code[class] { |
|
95 |
+ background-color: #F8F8F8; |
|
96 |
+} |
|
97 |
+ |
|
98 |
+table, td, th { |
|
99 |
+ border: none; |
|
100 |
+} |
|
101 |
+ |
|
102 |
+blockquote { |
|
103 |
+ color:#666666; |
|
104 |
+ margin:0; |
|
105 |
+ padding-left: 1em; |
|
106 |
+ border-left: 0.5em #EEE solid; |
|
107 |
+} |
|
108 |
+ |
|
109 |
+hr { |
|
110 |
+ height: 0px; |
|
111 |
+ border-bottom: none; |
|
112 |
+ border-top-width: thin; |
|
113 |
+ border-top-style: dotted; |
|
114 |
+ border-top-color: #999999; |
|
115 |
+} |
|
116 |
+ |
|
117 |
+@media print { |
|
118 |
+ * { |
|
119 |
+ background: transparent !important; |
|
120 |
+ color: black !important; |
|
121 |
+ filter:none !important; |
|
122 |
+ -ms-filter: none !important; |
|
123 |
+ } |
|
124 |
+ |
|
125 |
+ body { |
|
126 |
+ font-size:12pt; |
|
127 |
+ max-width:100%; |
|
128 |
+ } |
|
129 |
+ |
|
130 |
+ a, a:visited { |
|
131 |
+ text-decoration: underline; |
|
132 |
+ } |
|
133 |
+ |
|
134 |
+ hr { |
|
135 |
+ visibility: hidden; |
|
136 |
+ page-break-before: always; |
|
137 |
+ } |
|
138 |
+ |
|
139 |
+ pre, blockquote { |
|
140 |
+ padding-right: 1em; |
|
141 |
+ page-break-inside: avoid; |
|
142 |
+ } |
|
143 |
+ |
|
144 |
+ tr, img { |
|
145 |
+ page-break-inside: avoid; |
|
146 |
+ } |
|
147 |
+ |
|
148 |
+ img { |
|
149 |
+ max-width: 100% !important; |
|
150 |
+ } |
|
151 |
+ |
|
152 |
+ @page :left { |
|
153 |
+ margin: 15mm 20mm 15mm 10mm; |
|
154 |
+ } |
|
155 |
+ |
|
156 |
+ @page :right { |
|
157 |
+ margin: 15mm 10mm 15mm 20mm; |
|
158 |
+ } |
|
159 |
+ |
|
160 |
+ p, h2, h3 { |
|
161 |
+ orphans: 3; widows: 3; |
|
162 |
+ } |
|
163 |
+ |
|
164 |
+ h2, h3 { |
|
165 |
+ page-break-after: avoid; |
|
166 |
+ } |
|
167 |
+} |
0 | 168 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,124 @@ |
1 |
+ |
|
2 |
+set.seed(888) |
|
3 |
+ |
|
4 |
+type = c(rep("Tumor", 10), rep("Control", 10)) |
|
5 |
+gender = sample(c("F", "M"), 20, replace = TRUE) |
|
6 |
+gender[sample(1:20, 2)] = NA |
|
7 |
+age = runif(20, min = 30, max = 80) |
|
8 |
+mutation = data.frame(mut1 = sample(c(TRUE, FALSE), 20, p = c(0.2, 0.8), replace = TRUE), |
|
9 |
+ mut2 = sample(c(TRUE, FALSE), 20, p = c(0.3, 0.7), replace = TRUE)) |
|
10 |
+anno = data.frame(type = type, gender = gender, age = age, mutation, stringsAsFactors = FALSE) |
|
11 |
+ |
|
12 |
+anno_col = list(type = c("Tumor" = "red", "Control" = "blue"), |
|
13 |
+ gender = c("F" = "pink", "M" = "darkgreen"), |
|
14 |
+ mutation = c("TRUE" = "black", "FALSE" = "white")) |
|
15 |
+ |
|
16 |
+###################################### |
|
17 |
+# generate methylation matrix |
|
18 |
+rand_meth = function(k, mean) { |
|
19 |
+ (runif(k) - 0.5)*min(c(1-mean), mean) + mean |
|
20 |
+} |
|
21 |
+ |
|
22 |
+mean_meth = c(rand_meth(300, 0.3), rand_meth(700, 0.7)) |
|
23 |
+mat_meth = as.data.frame(lapply(mean_meth, function(m) { |
|
24 |
+ if(m < 0.3) { |
|
25 |
+ c(rand_meth(10, m), rand_meth(10, m + 0.2)) |
|
26 |
+ } else if(m > 0.7) { |
|
27 |
+ c(rand_meth(10, m), rand_meth(10, m - 0.2)) |
|
28 |
+ } else { |
|
29 |
+ c(rand_meth(10, m), rand_meth(10, m + sample(c(1, -1), 1)*0.2)) |
|
30 |
+ } |
|
31 |
+ |
|
32 |
+})) |
|
33 |
+mat_meth = t(mat_meth) |
|
34 |
+rownames(mat_meth) = NULL |
|
35 |
+colnames(mat_meth) = paste0("sample", 1:20) |
|
36 |
+ |
|
37 |
+###################################### |
|
38 |
+# generate directions for methylation |
|
39 |
+direction = rowMeans(mat_meth[, 1:10]) - rowMeans(mat_meth[, 11:20]) |
|
40 |
+direction = ifelse(direction > 0, "hyper", "hypo") |
|
41 |
+library(circlize) |
|
42 |
+ |
|
43 |
+####################################### |
|
44 |
+# generate expression matrix |
|
45 |
+mat_expr = t(apply(mat_meth, 1, function(x) { |
|
46 |
+ x = x + rnorm(length(x), sd = abs(runif(1)-0.5)*0.4 + 0.1) |
|
47 |
+ -scale(x) |
|
48 |
+})) |
|
49 |
+dimnames(mat_expr) = dimnames(mat_meth) |
|
50 |
+ |
|
51 |
+############################################################# |
|
52 |
+# matrix for correlation between methylation and expression |
|
53 |
+cor_pvalue = -log10(sapply(seq_len(nrow(mat_meth)), function(i) { |
|
54 |
+ cor.test(mat_meth[i, ], mat_expr[i, ])$p.value |
|
55 |
+})) |
|
56 |
+ |
|
57 |
+##################################################### |
|
58 |
+# matrix for types of genes |
|
59 |
+gene_type = sample(c("protein_coding", "lincRNA", "microRNA", "psedo-gene", "others"), |
|
60 |
+ nrow(mat_meth), replace = TRUE, prob = c(6, 1, 1, 1, 1)) |
|
61 |
+ |
|
62 |
+################################################# |
|
63 |
+# annotation to genes |
|
64 |
+anno_gene = sapply(mean_meth, function(m) { |
|
65 |
+ if(m > 0.6) { |
|
66 |
+ if(runif(1) < 0.8) return("intragenic") |
|
67 |
+ } |
|
68 |
+ if(m < 0.4) { |
|
69 |
+ if(runif(1) < 0.4) return("TSS") |
|
70 |
+ } |
|
71 |
+ return("intergenic") |
|
72 |
+}) |
|
73 |
+ |
|
74 |
+anno_gene_col = c("intragenic" = "blue", "TSS" = "red", "intergenic" = "grey") |
|
75 |
+ |
|
76 |
+############################################ |
|
77 |
+# distance to genes |
|
78 |
+tss_dist = sapply(mean_meth, function(m) { |
|
79 |
+ if(m < 0.3) { |
|
80 |
+ if(runif(1) < 0.5) { |
|
81 |
+ return(round( (runif(1) - 0.5)*1000 + 500)) |
|
82 |
+ } else { |
|
83 |
+ return(round( (runif(1) - 0.5)*10000 + 500)) |
|
84 |
+ } |
|
85 |
+ } else if(m < 0.6) { |
|
86 |
+ if(runif(1) < 0.8) { |
|
87 |
+ return(round( (runif(1)-0.5)*100000 + 50000 )) |
|
88 |
+ } else { |
|
89 |
+ return(round( (runif(1)-0.5)*1000000 + 500000 )) |
|
90 |
+ } |
|
91 |
+ } |
|
92 |
+ return(round( (runif(1) - 0.5)*1000000 + 500000)) |
|
93 |
+}) |
|
94 |
+ |
|
95 |
+ |
|
96 |
+####################################### |
|
97 |
+# annotation to enhancers |
|
98 |
+rand_tss = function(m) { |
|
99 |
+ if(m < 0.4) { |
|
100 |
+ if(runif(1) < 0.25) return(runif(1)) |
|
101 |
+ } else if (runif(1) < 0.1) { |
|
102 |
+ return(runif(1)) |
|
103 |
+ } |
|
104 |
+ return(0) |
|
105 |
+} |
|
106 |
+rand_enhancer = function(m) { |
|
107 |
+ if(m < 0.4) { |
|
108 |
+ if(runif(1) < 0.6) return(runif(1)) |
|
109 |
+ } else if (runif(1) < 0.1) { |
|
110 |
+ return(runif(1)) |
|
111 |
+ } |
|
112 |
+ return(0) |
|
113 |
+} |
|
114 |
+rand_repressive = function(m) { |
|
115 |
+ if(m > 0.4) { |
|
116 |
+ if(runif(1) < 0.8) return(runif(1)) |
|
117 |
+ } |
|
118 |
+ return(0) |
|
119 |
+} |
|
120 |
+anno_states = data.frame( |
|
121 |
+ tss = sapply(mean_meth, rand_tss), |
|
122 |
+ enhancer = sapply(mean_meth, rand_enhancer), |
|
123 |
+ rand_repressive = sapply(mean_meth, rand_repressive)) |
|
124 |
+ |
0 | 125 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,115 @@ |
1 |
+<!-- |
|
2 |
+%\VignetteEngine{knitr} |
|
3 |
+%\VignetteIndexEntry{Common use of ComplexHeatmap package} |
|
4 |
+--> |
|
5 |
+ |
|
6 |
+Common use of ComplexHeatmap package |
|
7 |
+======================================== |
|
8 |
+ |
|
9 |
+**Author**: Zuguang Gu ( z.gu@dkfz.de ) |
|
10 |
+ |
|
11 |
+**Date**: `r Sys.Date()` |
|
12 |
+ |
|
13 |
+------------------------------------------------------------- |
|
14 |
+ |
|
15 |
+```{r global_settings, echo = FALSE, message = FALSE} |
|
16 |
+library(markdown) |
|
17 |
+options(markdown.HTML.options = c(options('markdown.HTML.options')[[1]], "toc")) |
|
18 |
+ |
|
19 |
+library(knitr) |
|
20 |
+knitr::opts_chunk$set( |
|
21 |
+ error = FALSE, |
|
22 |
+ tidy = FALSE, |
|
23 |
+ message = FALSE, |
|
24 |
+ fig.align = "center" |
|
25 |
+) |
|
26 |
+options(markdown.HTML.stylesheet = "custom.css") |
|
27 |
+ |
|
28 |
+options(width = 100) |
|
29 |
+``` |
|
30 |
+ |
|
31 |
+```{r} |
|
32 |
+library(circlize) |
|
33 |
+library(ComplexHeatmap) |
|
34 |
+ |
|
35 |
+source("generate_random_dataset.R") |
|
36 |
+``` |
|
37 |
+ |
|
38 |
+# A Single Heatmap with annotations |
|
39 |
+ |
|
40 |
+```{r} |
|
41 |
+Heatmap(mat_meth, name = "methylation", |
|
42 |
+ top_annotation = HeatmapAnnotation( |
|
43 |
+ type = anno$type, |
|
44 |
+ gender = anno$gender, |
|
45 |
+ age = anno_points(anno$age, ylim = c(0, 80)), |
|
46 |
+ mutation = as.matrix(anno[, c("mut1", "mut2")]), |
|
47 |
+ col = anno_col |
|
48 |
+ ), column_title = "Differential Methylated Regions") |
|
49 |
+``` |
|
50 |
+ |
|
51 |
+```{r} |
|
52 |
+Heatmap(mat_meth, name = "methylation", |
|
53 |
+ top_annotation = HeatmapAnnotation( |
|
54 |
+ df = anno, |
|
55 |
+ annotation_name_side = "left" |
|
56 |
+ ), column_title = "Differential Methylated Regions") |
|
57 |
+``` |
|
58 |
+ |
|
59 |
+```{r} |
|
60 |
+Heatmap(mat_meth, name = "methylation", |
|
61 |
+ top_annotation = HeatmapAnnotation( |
|
62 |
+ df = anno, |
|
63 |
+ col = anno_col, |
|
64 |
+ annotation_name_side = "left" |
|
65 |
+ ), |
|
66 |
+ right_annotation = rowAnnotation( |
|
67 |
+ anno_gene = anno_gene, |
|
68 |
+ tss_dist = anno_points(tss_dist), |
|
69 |
+ col = list(anno_gene = anno_gene_col) |
|
70 |
+ ), |
|
71 |
+ column_title = "Differential Methylated Regions") |
|
72 |
+``` |
|
73 |
+ |
|
74 |
+ |
|
75 |
+```{r} |
|
76 |
+Heatmap(mat_meth, name = "methylation", |
|
77 |
+ top_annotation = HeatmapAnnotation( |
|
78 |
+ type = anno$type, |
|
79 |
+ gender = anno$gender, |
|
80 |
+ age = anno_points(anno$age, ylim = c(0, 80)), |
|
81 |
+ mutation = as.matrix(anno[, c("mut1", "mut2")]), |
|
82 |
+ col = anno_col |
|
83 |
+ ), |
|
84 |
+ right_annotation = rowAnnotation( |
|
85 |
+ anno_gene = anno_gene, |
|
86 |
+ tss_dist = anno_points(tss_dist), |
|
87 |
+ col = list(anno_gene = anno_gene_col) |
|
88 |
+ ), |
|
89 |
+ show_column_names = FALSE, |
|
90 |
+ column_title = "Differential Methylated Regions", |
|
91 |
+ column_km = 2, row_km = 4) |
|
92 |
+``` |
|
93 |
+ |
|
94 |
+ |
|
95 |
+## Heatmap List |
|
96 |
+ |
|
97 |
+```{r} |
|
98 |
+meth_col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red")) |
|
99 |
+expr_col_fun = colorRamp2(c(-2, 0, 2), c("green", "white", "red")) |
|
100 |
+ht_list = Heatmap(mat_meth, name = "methylation", col = meth_col_fun) + |
|
101 |
+ Heatmap(mat_expr, name = "epxression", col = expr_col_fun) |
|
102 |
+draw(ht_list, row_km = 4) |
|
103 |
+``` |
|
104 |
+ |
|
105 |
+ |
|
106 |
+```{r} |
|
107 |
+ht_list = Heatmap(mat_meth[1:40, ], name = "methylation", col = meth_col_fun) %v% |
|
108 |
+ Heatmap(mat_expr[1:40, ], name = "epxression", col = expr_col_fun) |
|
109 |
+draw(ht_list, column_km = 2) |
|
110 |
+``` |
|
111 |
+ |
|
112 |
+## OncoPrint |
|
113 |
+ |
|
114 |
+## Density as a heatmap |
|
115 |
+ |