Browse code

Commit made by the Bioconductor Git-SVN bridge.

Commit id: ff6ad79beeef75c709dc08588bb942ad86de9761

rotation for heatmap title supported



git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ComplexHeatmap@105315 bc3139a8-67e5-0310-9ffc-ced21a209358

z.gu authored on 22/06/2015 15:09:06
Showing 75 changed files

... ...
@@ -44,6 +44,7 @@ exportMethods(make_row_cluster)
44 44
 export(AdditiveUnit)
45 45
 exportMethods(component_width)
46 46
 exportMethods(draw_heatmap_list)
47
+exportMethods(show)
47 48
 export(grid.dendrogram)
48 49
 export(dist2)
49 50
 export(rowAnnotation)
... ...
@@ -69,9 +69,13 @@ Heatmap = setClass("Heatmap",
69 69
         matrix_color_mapping = "ANY",
70 70
 
71 71
         row_title = "character",
72
+        row_title_rot = "numeric",
73
+        row_title_just = "numeric",
72 74
         row_title_param = "list",
73 75
         column_title = "character",
74 76
         column_title_param = "list",
77
+        column_title_rot = "numeric",
78
+        column_title_just = "numeric",
75 79
 
76 80
         row_hclust_list = "list", # one or more row clusters
77 81
         row_hclust_param = "list", # parameters for row cluster
... ...
@@ -119,9 +123,11 @@ Heatmap = setClass("Heatmap",
119 123
 # -row_title title on row.
120 124
 # -row_title_side will the title be put on the left or right of the heatmap?
121 125
 # -row_title_gp graphic parameters for drawing text.
126
+# -row_title_rot rotation of row titles. Only 0, 90, 270 are allowed to set.
122 127
 # -column_title title on column.
123 128
 # -column_title_side will the title be put on the top or bottom of the heatmap?
124 129
 # -column_title_gp graphic parameters for drawing text.
130
+# -column_title_rot rotation of column titles. Only 0, 90, 270 are allowed to set.
125 131
 # -cluster_rows If the value is a logical, it means whether make cluster on rows. The value can also
126 132
 #               be a `stats::hclust` or a `stats::dendrogram` that already contains clustering information.
127 133
 #               This means you can use any type of clustering methods and render the `stats::dendrogram`
... ...
@@ -194,8 +200,9 @@ Heatmap = setClass("Heatmap",
194 200
 Heatmap = function(matrix, col, name, na_col = "grey", rect_gp = gpar(col = NA), 
195 201
     cell_fun = function(j, i, x, y, width, height, fill) NULL,
196 202
     row_title = character(0), row_title_side = c("left", "right"), 
197
-    row_title_gp = gpar(fontsize = 14), column_title = character(0),
198
-    column_title_side = c("top", "bottom"), column_title_gp = gpar(fontsize = 14),
203
+    row_title_gp = gpar(fontsize = 14), row_title_rot = switch(row_title_side[1], "left" = 90, "right" = 270),
204
+    column_title = character(0), column_title_side = c("top", "bottom"), 
205
+    column_title_gp = gpar(fontsize = 14), column_title_rot = 0,
199 206
     cluster_rows = TRUE, clustering_distance_rows = "euclidean",
200 207
     clustering_method_rows = "complete", row_hclust_side = c("left", "right"),
201 208
     row_hclust_width = unit(10, "mm"), show_row_hclust = TRUE, 
... ...
@@ -313,9 +320,11 @@ Heatmap = function(matrix, col, name, na_col = "grey", rect_gp = gpar(col = NA),
313 320
         row_title = character(0)
314 321
     }
315 322
     .Object@row_title = row_title
323
+    .Object@row_title_rot = row_title_rot %% 360
316 324
     .Object@row_title_param$side = match.arg(row_title_side)[1]
317 325
     .Object@row_title_param$gp = check_gp(row_title_gp)
318 326
     .Object@row_title_param$combined_name_fun = combined_name_fun
327
+    .Object@row_title_just = get_text_just(rot = row_title_rot, side = .Object@row_title_param$side)
319 328
 
320 329
     if(length(column_title) == 0) {
321 330
         column_title = character(0)
... ...
@@ -325,8 +334,10 @@ Heatmap = function(matrix, col, name, na_col = "grey", rect_gp = gpar(col = NA),
325 334
         column_title = character(0)
326 335
     }
327 336
     .Object@column_title = column_title
337
+    .Object@column_title_rot = column_title_rot %% 360
328 338
     .Object@column_title_param$side = match.arg(column_title_side)[1]
329 339
     .Object@column_title_param$gp = check_gp(column_title_gp)
340
+    .Object@column_title_just = get_text_just(rot = column_title_rot, side = .Object@column_title_param$side)
330 341
 
331 342
     if(is.null(rownames(matrix))) {
332 343
         show_row_names = FALSE
... ...
@@ -693,10 +704,18 @@ setMethod(f = "make_layout",
693 704
     column_title_gp = object@column_title_param$gp
694 705
     if(length(column_title) > 0) {
695 706
         if(column_title_side == "top") {
696
-            object@layout$layout_column_title_top_height = grobHeight(textGrob(column_title, gp = column_title_gp)) + title_padding*2
707
+            if(object@column_title_rot %in% c(0, 180)) {
708
+                object@layout$layout_column_title_top_height = grobHeight(textGrob(column_title, gp = column_title_gp)) + title_padding*2
709
+            } else {
710
+                object@layout$layout_column_title_top_height = grobWidth(textGrob(column_title, gp = column_title_gp)) + title_padding*2
711
+            }
697 712
             object@layout$layout_index = rbind(object@layout$layout_index, c(1, 4))
698 713
         } else {
699
-            object@layout$layout_column_title_bottom_height = grobHeight(textGrob(column_title, gp = column_title_gp)) + title_padding*2
714
+            if(object@column_title_rot %in% c(0, 180)) {
715
+                object@layout$layout_column_title_bottom_height = grobHeight(textGrob(column_title, gp = column_title_gp)) + title_padding*2
716
+            } else {
717
+                object@layout$layout_column_title_bottom_height = grobWidth(textGrob(column_title, gp = column_title_gp)) + title_padding*2
718
+            }
700 719
             object@layout$layout_index = rbind(object@layout$layout_index, c(9, 4))
701 720
         }
702 721
         object@layout$graphic_fun_list = c(object@layout$graphic_fun_list, function(object) draw_title(object, which = "column"))
... ...
@@ -709,10 +728,18 @@ setMethod(f = "make_layout",
709 728
     row_title_gp = object@row_title_param$gp
710 729
     if(length(row_title) > 0) {
711 730
         if(row_title_side == "left") {
712
-            object@layout$layout_row_title_left_width = max(grobHeight(textGrob(row_title, gp = row_title_gp))) + title_padding*2
731
+            if(object@row_title_rot %in% c(0, 180)) {
732
+                object@layout$layout_row_title_left_width = max(grobWidth(textGrob(row_title, gp = row_title_gp))) + title_padding*2
733
+            } else {
734
+                object@layout$layout_row_title_left_width = max(grobHeight(textGrob(row_title, gp = row_title_gp))) + title_padding*2
735
+            }
713 736
             object@layout$layout_index = rbind(object@layout$layout_index, c(5, 1))
714 737
         } else {
715
-            object@layout$layout_row_title_right_width = max(grobHeight(textGrob(row_title, gp = row_title_gp))) + title_padding*2
738
+            if(object@row_title_rot %in% c(0, 180)) {
739
+                object@layout$layout_row_title_right_width = max(grobWidth(textGrob(row_title, gp = row_title_gp))) + title_padding*2
740
+            } else {
741
+                object@layout$layout_row_title_right_width = max(grobHeight(textGrob(row_title, gp = row_title_gp))) + title_padding*2
742
+            }
716 743
             object@layout$layout_index = rbind(object@layout$layout_index, c(5, 7))
717 744
         }
718 745
         object@layout$graphic_fun_list = c(object@layout$graphic_fun_list, function(object) {
... ...
@@ -1132,8 +1159,8 @@ setMethod(f = "draw_title",
1132 1159
     which = match.arg(which)[1]
1133 1160
 
1134 1161
     side = switch(which,
1135
-        "row" = object@row_hclust_param$side,
1136
-        "column" = object@column_hclust_param$side)
1162
+        "row" = object@row_title_param$side,
1163
+        "column" = object@column_title_param$side)
1137 1164
 
1138 1165
     gp = switch(which,
1139 1166
         "row" = object@row_title_param$gp,
... ...
@@ -1143,26 +1170,31 @@ setMethod(f = "draw_title",
1143 1170
         "row" = object@row_title[k],
1144 1171
         "column" = object@column_title)
1145 1172
 
1173
+    rot = switch(which,
1174
+        "row" = object@row_title_rot,
1175
+        "column" = object@column_title_rot)
1176
+
1177
+    just = switch(which, 
1178
+        "row" = object@row_title_just,
1179
+        "column" = object@column_title_just)
1180
+
1146 1181
     title_padding = unit(2.5, "mm")
1147 1182
 
1148 1183
     if(which == "row") {
1149
-        rot = switch(side,
1150
-            "left" = 90,
1151
-            "right" = 270)
1152
-
1184
+        
1153 1185
         pushViewport(viewport(name = paste(object@name, "row_title", k, sep = "_"), clip = FALSE, ...))
1154 1186
         if(side == "left") {
1155
-            grid.text(title, x = unit(1, "npc") - title_padding, rot = rot, vjust = 0, gp = gp)
1187
+            grid.text(title, x = unit(1, "npc") - title_padding, rot = rot, just = just, gp = gp)
1156 1188
         } else {
1157
-            grid.text(title, x = title_padding, rot = rot, vjust = 0, gp = gp)
1189
+            grid.text(title, x = title_padding, rot = rot, just = just, gp = gp)
1158 1190
         }
1159 1191
         upViewport()
1160 1192
     } else {
1161 1193
         pushViewport(viewport(name = paste(object@name, "column_title", sep = "_"), clip = FALSE, ...))
1162 1194
         if(side == "top") {
1163
-            grid.text(title, y = title_padding, vjust = 0, gp = gp)
1195
+            grid.text(title, y = title_padding, rot = rot, just = just, gp = gp)
1164 1196
         } else {
1165
-            grid.text(title, y = unit(1, "npc") - title_padding, vjust = 1, gp = gp)
1197
+            grid.text(title, y = unit(1, "npc") - title_padding, rot = rot, just = just, gp = gp)
1166 1198
         }
1167 1199
         upViewport()
1168 1200
     }
... ...
@@ -294,6 +294,15 @@ setMethod(f = "make_layout",
294 294
         }
295 295
     }
296 296
 
297
+    # remote other heatmaps' row titles
298
+    for(i in seq_len(n)) {
299
+        if(inherits(object@ht_list[[i]], "Heatmap")) {
300
+            if(i != i_main) {
301
+                object@ht_list[[i]]@row_title = character(0)
302
+            }
303
+        }
304
+    }
305
+
297 306
     if(row_hclust_side == "left" && i == 1) {
298 307
         object@ht_list[[1]]@row_hclust_list = ht_main@row_hclust_list
299 308
         object@ht_list[[1]]@row_hclust_param = ht_main@row_hclust_param
... ...
@@ -344,3 +344,44 @@ subset_gp = function(gp, k) {
344 344
     class(gp) = "gpar"
345 345
     return(gp)
346 346
 }
347
+
348
+
349
+get_text_just = function(rot, side) {
350
+    rot = rot %% 360
351
+    if(! rot %in% c(0, 90, 270)) {
352
+        stop("Only support horizontal or vertical rotations for text.\n")
353
+    }
354
+    if(side == "left") {
355
+        if(rot == 0) {
356
+            return(c(1, 0.5))
357
+        } else if(rot == 90) {
358
+            return(c(0.5, 0))
359
+        } else if(rot == 270) {
360
+            return(c(0.5, 1))
361
+        }
362
+    } else if(side == "right") {
363
+        if(rot == 0) {
364
+            return(c(0, 0.5))
365
+        } else if(rot == 90) {
366
+            return(c(0.5, 1))
367
+        } else if(rot == 270) {
368
+            return(c(0.5, 0))
369
+        }
370
+    } else if(side == "top") {
371
+        if(rot == 0) {
372
+            return(c(0.5, 0))
373
+        } else if(rot == 90) {
374
+            return(c(0, 0.5))
375
+        } else if(rot == 270) {
376
+            return(c(1, 0.5))
377
+        }
378
+    } else if(side == "bottom") {
379
+        if(rot == 0) {
380
+            return(c(0.5, 1))
381
+        } else if(rot == 90) {
382
+            return(c(1, 0.5))
383
+        } else if(rot == 270) {
384
+            return(c(0, 0.5))
385
+        }
386
+    }
387
+}
347 388
\ No newline at end of file
... ...
@@ -2,18 +2,21 @@
2 2
 \docType{class}
3 3
 \alias{AdditiveUnit-class}
4 4
 \title{
5
-An internal class
5
+An internal class  
6
+
6 7
 
7 8
 }
8 9
 \description{
9
-An internal class
10
+An internal class  
11
+
10 12
 
11 13
 }
12 14
 \details{
13
-This class is a super class for \code{\link{Heatmap-class}}, \code{\link{HeatmapList-class}} and \code{\link{HeatmapAnnotation-class}} classes.
14
-It is only designed for \code{+} generic method so that above three classes can be appended to each other.
15
+This class is a super class for \code{\link{Heatmap-class}}, \code{\link{HeatmapList-class}} and \code{\link{HeatmapAnnotation-class}} classes. It is only designed for \code{+} generic method so that above three classes can be appended to each other.  
16
+
15 17
 
16 18
 }
17 19
 \examples{
18 20
 # no example
19
-NULL}
21
+NULL
22
+}
... ...
@@ -1,31 +1,39 @@
1 1
 \name{AdditiveUnit}
2 2
 \alias{AdditiveUnit}
3 3
 \title{
4
-Constructor method for AdditiveUnit class
4
+Constructor method for AdditiveUnit class  
5
+
5 6
 
6 7
 }
7 8
 \description{
8
-Constructor method for AdditiveUnit class
9
+Constructor method for AdditiveUnit class  
10
+
9 11
 
10 12
 }
11 13
 \usage{
12
-AdditiveUnit(...)}
14
+AdditiveUnit(...)
15
+}
13 16
 \arguments{
14 17
 
15 18
   \item{...}{arguments.}
19
+
16 20
 }
17 21
 \details{
18
-This method is not used in the package.
22
+This method is not used in the package.  
23
+
19 24
 
20 25
 }
21 26
 \value{
22
-No value is returned.
27
+No value is returned.  
28
+
23 29
 
24 30
 }
25 31
 \author{
26
-Zuguang Gu <z.gu@dkfz.de>
32
+Zuguang Gu <z.gu@dkfz.de>  
33
+
27 34
 
28 35
 }
29 36
 \examples{
30 37
 # no example
31
-NULL}
38
+NULL
39
+}
... ...
@@ -2,21 +2,22 @@
2 2
 \docType{class}
3 3
 \alias{ColorMapping-class}
4 4
 \title{
5
-Class to map values to colors
5
+Class to map values to colors  
6
+
6 7
 
7 8
 }
8 9
 \description{
9
-Class to map values to colors
10
+Class to map values to colors  
11
+
10 12
 
11 13
 }
12 14
 \details{
13
-The \code{\link{ColorMapping-class}} handles color mapping with both discrete values and continuous values.
14
-Discrete values are mapped by setting a vector of colors and continuous values are mapped by setting
15
-a color mapping function.
15
+The \code{\link{ColorMapping-class}} handles color mapping with both discrete values and continuous values. Discrete values are mapped by setting a vector of colors and continuous values are mapped by setting a color mapping function.  
16
+
16 17
 
17 18
 }
18 19
 \section{Methods}{
19
-The \code{\link{ColorMapping-class}} provides following methods:
20
+The \code{\link{ColorMapping-class}} provides following methods:  
20 21
 
21 22
 \itemize{
22 23
   \item \code{\link{ColorMapping}}: contructor methods.
... ...
@@ -24,11 +25,14 @@ The \code{\link{ColorMapping-class}} provides following methods:
24 25
   \item \code{\link{color_mapping_legend,ColorMapping-method}}: draw legend or get the size of the legend.
25 26
 }
26 27
 
28
+
27 29
 }
28 30
 \author{
29
-Zuguang Gu <z.gu@dkfz.de>
31
+Zuguang Gu <z.gu@dkfz.de>  
32
+
30 33
 
31 34
 }
32 35
 \examples{
33 36
 # for examples, please go to `ColorMapping` method page
34
-NULL}
37
+NULL
38
+}
... ...
@@ -1,36 +1,42 @@
1 1
 \name{ColorMapping}
2 2
 \alias{ColorMapping}
3 3
 \title{
4
-Constructor methods for ColorMapping class
4
+Constructor methods for ColorMapping class  
5
+
5 6
 
6 7
 }
7 8
 \description{
8
-Constructor methods for ColorMapping class
9
+Constructor methods for ColorMapping class  
10
+
9 11
 
10 12
 }
11 13
 \usage{
12 14
 ColorMapping(name, colors = NULL, levels = NULL,
13
-    col_fun = NULL, breaks = NULL, na_col = "#FFFFFF")}
15
+    col_fun = NULL, breaks = NULL, na_col = "#FFFFFF")
16
+}
14 17
 \arguments{
15 18
 
16 19
   \item{name}{name for this color mapping. It is used for drawing the title of the legend.}
17 20
   \item{colors}{discrete colors.}
18
-  \item{levels}{levels that correspond to \code{colors}. If \code{colors} is name indexed, \code{levels} can be ignored.}
21
+  \item{levels}{levels that correspond to \code{colors}. If \code{colors} is name indexed,  \code{levels} can be ignored.}
19 22
   \item{col_fun}{color mapping function that maps continuous values to colors.}
20
-  \item{breaks}{breaks for the continuous color mapping. If \code{col_fun} isgenerated by \code{\link[circlize]{colorRamp2}}, \code{breaks} can be ignored.}
23
+  \item{breaks}{breaks for the continuous color mapping. If \code{col_fun} is generated by \code{\link[circlize]{colorRamp2}}, \code{breaks} can be ignored.}
21 24
   \item{na_col}{colors for \code{NA} values.}
25
+
22 26
 }
23 27
 \details{
24
-\code{colors} and \code{levels} are used for discrete color mapping, \code{col_fun} and 
25
-\code{breaks} are used for continuous color mapping.
28
+\code{colors} and \code{levels} are used for discrete color mapping, \code{col_fun} and  \code{breaks} are used for continuous color mapping.  
29
+
26 30
 
27 31
 }
28 32
 \value{
29
-A \code{\link{ColorMapping-class}} object.
33
+A \code{\link{ColorMapping-class}} object.  
34
+
30 35
 
31 36
 }
32 37
 \author{
33
-Zuguang Gu <z.gu@dkfz.de>
38
+Zuguang Gu <z.gu@dkfz.de>  
39
+
34 40
 
35 41
 }
36 42
 \examples{
... ...
@@ -50,4 +56,5 @@ cm
50 56
 require(circlize)
51 57
 cm = ColorMapping(name = "test",
52 58
     col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red")))
53
-cm}
59
+cm
60
+}
... ...
@@ -2,19 +2,19 @@
2 2
 \docType{package}
3 3
 \alias{ComplexHeatmap-package}
4 4
 \title{
5
-Making complex heatmap
5
+Making complex heatmap  
6
+
6 7
 
7 8
 }
8 9
 \description{
9
-Making complex heatmap
10
+Making complex heatmap  
11
+
10 12
 
11 13
 }
12 14
 \details{
13
-This package aims to provide a simple and flexible way to arrange
14
-multiple heatmaps as well as self-defining annotation graphics.
15
+This package aims to provide a simple and flexible way to arrange multiple heatmaps as well as self-defining annotation graphics.  
15 16
 
16
-The package is implemented in an object oriented way. 
17
-Components of heatmap lists are abstracted into several classes.
17
+The package is implemented in an object oriented way.  Components of heatmap lists are abstracted into several classes.  
18 18
 
19 19
 \itemize{
20 20
   \item \code{\link{Heatmap-class}}: a single heatmap containing heatmap body, row/column names, titles, dendrograms and column annotations.
... ...
@@ -22,16 +22,16 @@ Components of heatmap lists are abstracted into several classes.
22 22
   \item \code{\link{HeatmapAnnotation-class}}: a list of row annotations or column annotations.
23 23
 }
24 24
 
25
-There are also several internal classes:
25
+There are also several internal classes:  
26 26
 
27 27
 \itemize{
28 28
   \item \code{\link{SingleAnnotation-class}}: a single row annotation or column annotation.
29 29
   \item \code{\link{ColorMapping-class}}: mapping from values to colors.
30 30
 }
31 31
 
32
-For plotting one single heatmap, please go to the documentation page of \code{\link{Heatmap}}.
33
-For plotting multiple heatmaps, please go to \code{\link{HeatmapList-class}} and \code{+.AdditiveUnit}.
32
+For plotting one single heatmap, please go to the documentation page of \code{\link{Heatmap}}. For plotting multiple heatmaps, please go to \code{\link{HeatmapList-class}} and \code{+.AdditiveUnit}.  
33
+
34
+The vignette provides detailed explanation of how to use this package.  
34 35
 
35
-The vignette provides detailed explanation of how to use this package.
36 36
 
37 37
 }
... ...
@@ -2,15 +2,17 @@
2 2
 \docType{class}
3 3
 \alias{Heatmap-class}
4 4
 \title{
5
-Class for a single heatmap
5
+Class for a single heatmap  
6
+
6 7
 
7 8
 }
8 9
 \description{
9
-Class for a single heatmap
10
+Class for a single heatmap  
11
+
10 12
 
11 13
 }
12 14
 \details{
13
-The components for a single heamtap are placed into a 9 x 7 layout:
15
+The components for a single heamtap are placed into a 9 x 7 layout:  
14 16
 
15 17
   \preformatted{
16 18
          +------+ (1)
... ...
@@ -26,7 +28,7 @@ The components for a single heamtap are placed into a 9 x 7 layout:
26 28
          +------+ (9)
27 29
   }
28 30
 
29
-From top to bottom in column 4, the regions are:
31
+From top to bottom in column 4, the regions are:  
30 32
 
31 33
 \itemize{
32 34
   \item title which is put on the top of the heatmap, graphics are drawn by \code{\link{draw_title,Heatmap-method}}.
... ...
@@ -40,7 +42,7 @@ From top to bottom in column 4, the regions are:
40 42
   \item title on the bottom, graphics are drawn by \code{\link{draw_title,Heatmap-method}}.
41 43
 }
42 44
 
43
-From left to right in row 5, the regions are:
45
+From left to right in row 5, the regions are:  
44 46
 
45 47
 \itemize{
46 48
   \item title which is put in the left of the heatmap, graphics are drawn by \code{\link{draw_title,Heatmap-method}}.
... ...
@@ -52,13 +54,12 @@ From left to right in row 5, the regions are:
52 54
   \item title on the right, graphics are drawn by \code{\link{draw_title,Heatmap-method}}.
53 55
 }
54 56
 
55
-The \code{\link{Heatmap-class}} is not responsible for heatmap legend and annotation legends. The \code{\link{draw,Heatmap-method}} method
56
-will construct a \code{\link{HeatmapList-class}} object which only contains one single heatmap
57
-and call \code{\link{draw,HeatmapList-method}} to make a complete heatmap.
57
+The \code{\link{Heatmap-class}} is not responsible for heatmap legend and annotation legends. The \code{\link{draw,Heatmap-method}} method will construct a \code{\link{HeatmapList-class}} object which only contains one single heatmap and call \code{\link{draw,HeatmapList-method}} to make a complete heatmap.  
58
+
58 59
 
59 60
 }
60 61
 \section{Methods}{
61
-The \code{\link{Heatmap-class}} provides following methods:
62
+The \code{\link{Heatmap-class}} provides following methods:  
62 63
 
63 64
 \itemize{
64 65
   \item \code{\link{Heatmap}}: constructor method.
... ...
@@ -66,11 +67,14 @@ The \code{\link{Heatmap-class}} provides following methods:
66 67
   \item \code{\link{add_heatmap,Heatmap-method}} append heatmaps and row annotations to a list of heatmaps.
67 68
 }
68 69
 
70
+
69 71
 }
70 72
 \author{
71
-Zuguang Gu <z.gu@dkfz.de>
73
+Zuguang Gu <z.gu@dkfz.de>  
74
+
72 75
 
73 76
 }
74 77
 \examples{
75 78
 # for examples, please go to `Heatmap` method page
76
-NULL}
79
+NULL
80
+}
... ...
@@ -1,19 +1,22 @@
1 1
 \name{Heatmap}
2 2
 \alias{Heatmap}
3 3
 \title{
4
-Constructor method for Heatmap class
4
+Constructor method for Heatmap class  
5
+
5 6
 
6 7
 }
7 8
 \description{
8
-Constructor method for Heatmap class
9
+Constructor method for Heatmap class  
10
+
9 11
 
10 12
 }
11 13
 \usage{
12 14
 Heatmap(matrix, col, name, na_col = "grey", rect_gp = gpar(col = NA),
13 15
     cell_fun = function(j, i, x, y, width, height, fill) NULL,
14 16
     row_title = character(0), row_title_side = c("left", "right"),
15
-    row_title_gp = gpar(fontsize = 14), column_title = character(0),
16
-    column_title_side = c("top", "bottom"), column_title_gp = gpar(fontsize = 14),
17
+    row_title_gp = gpar(fontsize = 14), row_title_rot = switch(row_title_side[1], "left" = 90, "right" = 270),
18
+    column_title = character(0), column_title_side = c("top", "bottom"),
19
+    column_title_gp = gpar(fontsize = 14), column_title_rot = 0,
17 20
     cluster_rows = TRUE, clustering_distance_rows = "euclidean",
18 21
     clustering_method_rows = "complete", row_hclust_side = c("left", "right"),
19 22
     row_hclust_width = unit(10, "mm"), show_row_hclust = TRUE,
... ...
@@ -33,28 +36,31 @@ Heatmap(matrix, col, name, na_col = "grey", rect_gp = gpar(col = NA),
33 36
     bottom_annotation_height = unit(5*length(bottom_annotation@anno_list), "mm"),
34 37
     km = 1, split = NULL, gap = unit(1, "mm"),
35 38
     combined_name_fun = function(x) paste(x, collapse = "/"),
36
-    width = NULL, show_heatmap_legend = TRUE)}
39
+    width = NULL, show_heatmap_legend = TRUE)
40
+}
37 41
 \arguments{
38 42
 
39
-  \item{matrix}{a matrix. Either numeric or character. If it is a simple vector, it will beconverted to a one-column matrix.}
40
-  \item{col}{a vector of colors if the color mapping is discrete or a color mapping function if the matrix is continuous numbers. If the matrix is continuous,the value can also be a vector of colors so that colors will be interpolated. Pass to \code{\link{ColorMapping}}.}
43
+  \item{matrix}{a matrix. Either numeric or character. If it is a simple vector, it will be converted to a one-column matrix.}
44
+  \item{col}{a vector of colors if the color mapping is discrete or a color mapping  function if the matrix is continuous numbers. If the matrix is continuous, the value can also be a vector of colors so that colors will be interpolated. Pass to \code{\link{ColorMapping}}.}
41 45
   \item{name}{name of the heatmap. The name is used as the title of the heatmap legend.}
42 46
   \item{na_col}{color for \code{NA} values.}
43 47
   \item{rect_gp}{graphic parameters for drawing rectangles (for heatmap body).}
44
-  \item{cell_fun}{self-defined function to add graphics on each cell. Seven parameters will be passed into this function: \code{i}, \code{j}, \code{x}, \code{y}, \code{width}, \code{height}, \code{fill} which are row index,column index in \code{matrix}, coordinate of the middle points in the heatmap body viewport,the width and height of the cell and the filled color. }
48
+  \item{cell_fun}{self-defined function to add graphics on each cell. Seven parameters will be passed into  this function: \code{i}, \code{j}, \code{x}, \code{y}, \code{width}, \code{height}, \code{fill} which are row index, column index in \code{matrix}, coordinate of the middle points in the heatmap body viewport, the width and height of the cell and the filled color. }
45 49
   \item{row_title}{title on row.}
46 50
   \item{row_title_side}{will the title be put on the left or right of the heatmap?}
47 51
   \item{row_title_gp}{graphic parameters for drawing text.}
52
+  \item{row_title_rot}{rotation of row titles. Only 0, 90, 270 are allowed to set.}
48 53
   \item{column_title}{title on column.}
49 54
   \item{column_title_side}{will the title be put on the top or bottom of the heatmap?}
50 55
   \item{column_title_gp}{graphic parameters for drawing text.}
51
-  \item{cluster_rows}{If the value is a logical, it means whether make cluster on rows. The value can alsobe a \code{\link[stats]{hclust}} or a \code{\link[stats]{dendrogram}} that already contains clustering information.This means you can use any type of clustering methods and render the \code{\link[stats]{dendrogram}}object with self-defined graphic settings.}
52
-  \item{clustering_distance_rows}{it can be a pre-defined character which is in ("euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski", "pearson", "spearman", "kendall"). It can also be a function.If the function has one argument, the input argument should be a matrix and the returned value should be a \code{\link[stats]{dist}} object. If the function has two arguments,the input arguments are two vectors and the function calculates distance between thesetwo vectors.}
56
+  \item{column_title_rot}{rotation of column titles. Only 0, 90, 270 are allowed to set.}
57
+  \item{cluster_rows}{If the value is a logical, it means whether make cluster on rows. The value can also be a \code{\link[stats]{hclust}} or a \code{\link[stats]{dendrogram}} that already contains clustering information. This means you can use any type of clustering methods and render the \code{\link[stats]{dendrogram}} object with self-defined graphic settings.}
58
+  \item{clustering_distance_rows}{it can be a pre-defined character which is in  ("euclidean", "maximum", "manhattan", "canberra", "binary",  "minkowski", "pearson", "spearman", "kendall"). It can also be a function. If the function has one argument, the input argument should be a matrix and  the returned value should be a \code{\link[stats]{dist}} object. If the function has two arguments, the input arguments are two vectors and the function calculates distance between these two vectors.}
53 59
   \item{clustering_method_rows}{method to make cluster, pass to \code{\link[stats]{hclust}}.}
54 60
   \item{row_hclust_side}{should the row cluster be put on the left or right of the heatmap?}
55 61
   \item{row_hclust_width}{width of the row cluster, should be a \code{\link[grid]{unit}} object.}
56 62
   \item{show_row_hclust}{whether show row clusters. }
57
-  \item{row_hclust_gp}{graphics parameters for drawing lines. If users already provide a \code{\link[stats]{dendrogram}}object with edges rendered, this argument will be ignored.}
63
+  \item{row_hclust_gp}{graphics parameters for drawing lines. If users already provide a \code{\link[stats]{dendrogram}} object with edges rendered, this argument will be ignored.}
58 64
   \item{cluster_columns}{whether make cluster on columns. Same settings as \code{cluster_rows}.}
59 65
   \item{clustering_distance_columns}{same setting as \code{clustering_distance_rows}.}
60 66
   \item{clustering_method_columns}{method to make cluster, pass to \code{\link[stats]{hclust}}.}
... ...
@@ -62,11 +68,11 @@ Heatmap(matrix, col, name, na_col = "grey", rect_gp = gpar(col = NA),
62 68
   \item{column_hclust_height}{height of the column cluster, should be a \code{\link[grid]{unit}} object.}
63 69
   \item{show_column_hclust}{whether show column clusters.}
64 70
   \item{column_hclust_gp}{graphic parameters for drawling lines. Same settings as \code{row_hclust_gp}.}
65
-  \item{row_order}{order of rows. It makes it easy to adjust row order for a list of heatmaps if this heatmap is selected as the main heatmap. Manually setting row order should turn off clustering}
71
+  \item{row_order}{order of rows. It makes it easy to adjust row order for a list of heatmaps if this heatmap  is selected as the main heatmap. Manually setting row order should turn off clustering}
66 72
   \item{column_order}{order of column. It makes it easy to adjust column order for both matrix and column annotations.}
67 73
   \item{row_names_side}{should the row names be put on the left or right of the heatmap?}
68 74
   \item{show_row_names}{whether show row names.}
69
-  \item{row_names_max_width}{maximum width of row names viewport. Because some times row names can be very long, it is not reasonableto show them all.}
75
+  \item{row_names_max_width}{maximum width of row names viewport. Because some times row names can be very long, it is not reasonable to show them all.}
70 76
   \item{row_names_gp}{graphic parameters for drawing text.}
71 77
   \item{column_names_side}{should the column names be put on the top or bottom of the heatmap?}
72 78
   \item{column_names_max_height}{maximum height of column names viewport.}
... ...
@@ -76,18 +82,18 @@ Heatmap(matrix, col, name, na_col = "grey", rect_gp = gpar(col = NA),
76 82
   \item{top_annotation_height}{total height of the column annotations on the top.}
77 83
   \item{bottom_annotation}{a \code{\link{HeatmapAnnotation}} object.}
78 84
   \item{bottom_annotation_height}{total height of the column annotations on the bottom.}
79
-  \item{km}{do k-means clustering on rows. If the value is larger than 1, the heatmap will be split by rows according to the k-means clustering.For each row-clusters, hierarchical clustering is still applied with parameters above.}
85
+  \item{km}{do k-means clustering on rows. If the value is larger than 1, the heatmap will be split by rows according to the k-means clustering. For each row-clusters, hierarchical clustering is still applied with parameters above.}
80 86
   \item{split}{a vector or a data frame by which the rows are split.}
81 87
   \item{gap}{gap between row-slices if the heatmap is split by rows, should be \code{\link[grid]{unit}} object.}
82
-  \item{combined_name_fun}{if the heatmap is split by rows, how to make a combined row title for each slice?The input parameter for this function is a vector which contains level names under each column in \code{split}.}
83
-  \item{width}{the width of the single heatmap, should be a fixed \code{\link[grid]{unit}} object. It is used for the layout when the heatmapis appended to a list of heatmaps.}
88
+  \item{combined_name_fun}{if the heatmap is split by rows, how to make a combined row title for each slice? The input parameter for this function is a vector which contains level names under each column in \code{split}.}
89
+  \item{width}{the width of the single heatmap, should be a fixed \code{\link[grid]{unit}} object. It is used for the layout when the heatmap is appended to a list of heatmaps.}
84 90
   \item{show_heatmap_legend}{whether show heatmap legend?}
91
+
85 92
 }
86 93
 \details{
87
-The initialization function only applies parameter checking and fill values to each slot with proper ones.
88
-Then it will be ready for clustering and layout.
94
+The initialization function only applies parameter checking and fill values to each slot with proper ones. Then it will be ready for clustering and layout.  
89 95
 
90
-Following methods can be applied on the \code{\link{Heatmap-class}} object:
96
+Following methods can be applied on the \code{\link{Heatmap-class}} object:  
91 97
 
92 98
 \itemize{
93 99
   \item \code{\link{show,Heatmap-method}}: draw a single heatmap with default parameters
... ...
@@ -95,16 +101,18 @@ Following methods can be applied on the \code{\link{Heatmap-class}} object:
95 101
   \item \code{\link{add_heatmap,Heatmap-method}} append heatmaps and row annotations to a list of heatmaps.
96 102
 }
97 103
 
98
-The constructor function pretends to be a high-level graphic function because the \code{show} method
99
-of the \code{\link{Heatmap-class}} object actually plots the graphics.
104
+The constructor function pretends to be a high-level graphic function because the \code{show} method of the \code{\link{Heatmap-class}} object actually plots the graphics.  
105
+
100 106
 
101 107
 }
102 108
 \value{
103
-A \code{\link{Heatmap-class}} object.
109
+A \code{\link{Heatmap-class}} object.  
110
+
104 111
 
105 112
 }
106 113
 \author{
107
-Zuguang Gu <z.gu@dkfz.de>
114
+Zuguang Gu <z.gu@dkfz.de>  
115
+
108 116
 
109 117
 }
110 118
 \examples{
... ...
@@ -178,4 +186,5 @@ Heatmap(mat, rect_gp = gpar(col = "white"),
178 186
         grid.text(mat[i, j], x = x, y = y)
179 187
     },
180 188
     cluster_rows = FALSE, cluster_columns = FALSE, row_names_side = "left", 
181
-    column_names_side = "top")}
189
+    column_names_side = "top")
190
+}
... ...
@@ -2,32 +2,36 @@
2 2
 \docType{class}
3 3
 \alias{HeatmapAnnotation-class}
4 4
 \title{
5
-Class for heatmap annotations
5
+Class for heatmap annotations  
6
+
6 7
 
7 8
 }
8 9
 \description{
9
-Class for heatmap annotations
10
+Class for heatmap annotations  
11
+
10 12
 
11 13
 }
12 14
 \details{
13
-A complex heatmap contains a list of annotations which represent as different graphics
14
-placed on rows and columns. The \code{\link{HeatmapAnnotation-class}} is a category of single annotations which are
15
-by a list of \code{\link{SingleAnnotation-class}} objects with same number of rows or columns.
15
+A complex heatmap contains a list of annotations which represent as different graphics placed on rows and columns. The \code{\link{HeatmapAnnotation-class}} is a category of single annotations which are by a list of \code{\link{SingleAnnotation-class}} objects with same number of rows or columns.  
16
+
16 17
 
17 18
 }
18 19
 \section{Methods}{
19
-The \code{\link{HeatmapAnnotation-class}} provides following methods:
20
+The \code{\link{HeatmapAnnotation-class}} provides following methods:  
20 21
 
21 22
 \itemize{
22 23
   \item \code{\link{HeatmapAnnotation}}: constructor method
23 24
   \item \code{\link{draw,HeatmapAnnotation-method}}: draw the annotations
24 25
 }
25 26
 
27
+
26 28
 }
27 29
 \author{
28
-Zuguang Gu <z.gu@dkfz.de>
30
+Zuguang Gu <z.gu@dkfz.de>  
31
+
29 32
 
30 33
 }
31 34
 \examples{
32 35
 # for examples, please go to `HeatmapAnnotation` method page
33
-NULL}
36
+NULL
37
+}
... ...
@@ -1,18 +1,21 @@
1 1
 \name{HeatmapAnnotation}
2 2
 \alias{HeatmapAnnotation}
3 3
 \title{
4
-Constructor method for HeatmapAnnotation class
4
+Constructor method for HeatmapAnnotation class  
5
+
5 6
 
6 7
 }
7 8
 \description{
8
-Constructor method for HeatmapAnnotation class
9
+Constructor method for HeatmapAnnotation class  
10
+
9 11
 
10 12
 }
11 13
 \usage{
12 14
 HeatmapAnnotation(df, name, col, show_legend = rep(TRUE, n_anno), ...,
13 15
     which = c("column", "row"), annotation_height = 1, annotation_width = 1,
14 16
     height = unit(1, "cm"), width = unit(1, "cm"), gp = gpar(col = NA),
15
-    gap = unit(0, "null"))}
17
+    gap = unit(0, "null"))
18
+}
16 19
 \arguments{
17 20
 
18 21
   \item{df}{a data frame. Each column will be treated as a simple annotation. The data frame must have column names.}
... ...
@@ -27,22 +30,26 @@ HeatmapAnnotation(df, name, col, show_legend = rep(TRUE, n_anno), ...,
27 30
   \item{width}{width of the whole heatmap annotations, only used for row annotation when appending to the list of heatmaps.}
28 31
   \item{gp}{graphic parameters for simple annotations.}
29 32
   \item{gap}{gap between each annotation}
33
+
30 34
 }
31 35
 \details{
32
-The simple annotations are defined by \code{df} and \code{col} arguments. Complex annotations are
33
-defined by the function list. So you need to at least to define \code{df} or a annotation function.
36
+The simple annotations are defined by \code{df} and \code{col} arguments. Complex annotations are defined by the function list. So you need to at least to define \code{df} or a annotation function.  
37
+
34 38
 
35 39
 }
36 40
 \value{
37
-A \code{\link{HeatmapAnnotation-class}} object.
41
+A \code{\link{HeatmapAnnotation-class}} object.  
42
+
38 43
 
39 44
 }
40 45
 \seealso{
41
-There are two shortcut functions: \code{\link{rowAnnotation}} and \code{\link{columnAnnotation}}.
46
+There are two shortcut functions: \code{\link{rowAnnotation}} and \code{\link{columnAnnotation}}.  
47
+
42 48
 
43 49
 }
44 50
 \author{
45
-Zuguang Gu <z.gu@dkfz.de>
51
+Zuguang Gu <z.gu@dkfz.de>  
52
+
46 53
 
47 54
 }
48 55
 \examples{
... ...
@@ -59,4 +66,5 @@ ha = HeatmapAnnotation(points = anno_points(1:6))
59 66
 ha = HeatmapAnnotation(histogram = anno_points(1:6))
60 67
 
61 68
 mat = matrix(rnorm(36), 6)
62
-ha = HeatmapAnnotation(boxplot = anno_boxplot(mat))}
69
+ha = HeatmapAnnotation(boxplot = anno_boxplot(mat))
70
+}
... ...
@@ -2,17 +2,19 @@
2 2
 \docType{class}
3 3
 \alias{HeatmapList-class}
4 4
 \title{
5
-Class for a list of heatmaps
5
+Class for a list of heatmaps  
6
+
6 7
 
7 8
 }
8 9
 \description{
9
-Class for a list of heatmaps
10
+Class for a list of heatmaps  
11
+
10 12
 
11 13
 }
12 14
 \details{
13
-A heatmap list is defined as a list of heatmaps and row annotations.
15
+A heatmap list is defined as a list of heatmaps and row annotations.  
14 16
 
15
-The components for the heamtap list are placed into a 7 x 7 layout:
17
+The components for the heamtap list are placed into a 7 x 7 layout:  
16 18
 
17 19
   \preformatted{
18 20
          +------+(1)
... ...
@@ -26,7 +28,7 @@ The components for the heamtap list are placed into a 7 x 7 layout:
26 28
          +------+(7)
27 29
   }
28 30
 
29
-From top to bottom in column 4, the regions are:
31
+From top to bottom in column 4, the regions are:  
30 32
 
31 33
 \itemize{
32 34
   \item annotation legend on the top, graphics are drawn by \code{\link{draw_annotation_legend,HeatmapList-method}}.
... ...
@@ -38,7 +40,7 @@ From top to bottom in column 4, the regions are:
38 40
   \item annotation legend on the bottom, graphics are drawn by \code{\link{draw_annotation_legend,HeatmapList-method}}.
39 41
 }
40 42
 
41
-From left to right in row 4, the regions are:
43
+From left to right in row 4, the regions are:  
42 44
 
43 45
 \itemize{
44 46
   \item annotation legend on the left, graphics are drawn by \code{\link{draw_annotation_legend,HeatmapList-method}}.
... ...
@@ -50,21 +52,23 @@ From left to right in row 4, the regions are:
50 52
   \item annotation legend on the right, graphics are drawn by \code{\link{draw_annotation_legend,HeatmapList-method}}.
51 53
 }
52 54
 
53
-For the list of heatmaps which are placed at (5, 5) in the layout, the heatmaps and row annotations
54
-are placed one after the other.
55
+For the list of heatmaps which are placed at (5, 5) in the layout, the heatmaps and row annotations are placed one after the other.  
56
+
55 57
 
56 58
 }
57 59
 \section{Methods}{
58
-The \code{\link{HeatmapList-class}} provides following methods:
60
+The \code{\link{HeatmapList-class}} provides following methods:  
59 61
 
60 62
 \itemize{
61 63
   \item \code{\link{draw,HeatmapList-method}}: draw the list of heatmaps and row annotations.
62 64
   \item \code{\link{add_heatmap,HeatmapList-method}} add heatmaps to the list of heatmaps.
63 65
 }
64 66
 
67
+
65 68
 }
66 69
 \author{
67
-Zuguang Gu <z.gu@dkfz.de>
70
+Zuguang Gu <z.gu@dkfz.de>  
71
+
68 72
 
69 73
 }
70 74
 \examples{
... ...
@@ -83,4 +87,5 @@ ht + ht_list
83 87
 ha = HeatmapAnnotation(points = anno_points(1:12, which = "row"), 
84 88
     which = "row")
85 89
 ht + ha
86
-ht_list + ha}
90
+ht_list + ha
91
+}
... ...
@@ -1,33 +1,42 @@
1 1
 \name{HeatmapList}
2 2
 \alias{HeatmapList}
3 3
 \title{
4
-Constructor method for HeatmapList class
4
+Constructor method for HeatmapList class  
5
+
5 6
 
6 7
 }
7 8
 \description{
8
-Constructor method for HeatmapList class
9
+Constructor method for HeatmapList class  
10
+
9 11
 
10 12
 }
11 13
 \usage{
12
-HeatmapList(...)}
14
+HeatmapList(...)
15
+}
13 16
 \arguments{
14 17
 
15 18
   \item{...}{arguments}
19
+
16 20
 }
17 21
 \details{
18
-There is no public constructor method for the \code{\link{HeatmapList-class}}.
22
+There is no public constructor method for the \code{\link{HeatmapList-class}}.  
23
+
19 24
 
20 25
 }
21 26
 \value{
22
-No value is returned.
27
+No value is returned.  
28
+
23 29
 
24 30
 }
25 31
 \author{
26
-Zuguang Gu <z.gu@dkfz.de>
32
+Zuguang Gu <z.gu@dkfz.de>  
33
+
27 34
 
28 35
 }
29 36
 \section{Detailes}{
30
-There is no public constructor method for the \code{\link{HeatmapList-class}}.}
37
+There is no public constructor method for the \code{\link{HeatmapList-class}}.
38
+}
31 39
 \examples{
32 40
 # no example
33
-NULL}
41
+NULL
42
+}
... ...
@@ -2,42 +2,43 @@
2 2
 \docType{class}
3 3
 \alias{SingleAnnotation-class}
4 4
 \title{
5
-Class for a single annotation
5
+Class for a single annotation  
6
+
6 7
 
7 8
 }
8 9
 \description{
9
-Class for a single annotation
10
+Class for a single annotation  
11
+
10 12
 
11 13
 }
12 14
 \details{
13
-A complex heatmap always has more than one annotations on rows and columns. Here
14
-the \code{\link{SingleAnnotation-class}} defines the basic unit of annotations.
15
-The most simple annotation is one row or one column grids in which different colors
16
-represent different classes of the data. The annotation can also be more complex
17
-graphics, such as a boxplot that shows data distribution in corresponding row or column.
15
+A complex heatmap always has more than one annotations on rows and columns. Here the \code{\link{SingleAnnotation-class}} defines the basic unit of annotations. The most simple annotation is one row or one column grids in which different colors represent different classes of the data. The annotation can also be more complex graphics, such as a boxplot that shows data distribution in corresponding row or column.  
16
+
17
+The \code{\link{SingleAnnotation-class}} is used for storing data for a single annotation and provides methods for drawing annotation graphics.  
18 18
 
19
-The \code{\link{SingleAnnotation-class}} is used for storing data for a single annotation and provides
20
-methods for drawing annotation graphics.
21 19
 
22 20
 }
23 21
 \section{Methods}{
24
-The \code{\link{SingleAnnotation-class}} provides following methods:
22
+The \code{\link{SingleAnnotation-class}} provides following methods:  
25 23
 
26 24
 \itemize{
27 25
   \item \code{\link{SingleAnnotation}}: constructor method
28 26
   \item \code{\link{draw,SingleAnnotation-method}}: draw the single annotation.
29 27
 }
30 28
 
29
+
31 30
 }
32 31
 \seealso{
33
-The \code{\link{SingleAnnotation-class}} is always used internally. The public \code{\link{HeatmapAnnotation-class}}
34
-contains a list of \code{\link{SingleAnnotation-class}} objects and is used to add annotation graphics on heatmaps.
32
+The \code{\link{SingleAnnotation-class}} is always used internally. The public \code{\link{HeatmapAnnotation-class}} contains a list of \code{\link{SingleAnnotation-class}} objects and is used to add annotation graphics on heatmaps.  
33
+
35 34
 
36 35
 }
37 36
 \author{
38
-Zuguang Gu <z.gu@dkfz.de>
37
+Zuguang Gu <z.gu@dkfz.de>  
38
+
39 39
 
40 40
 }
41 41
 \examples{
42 42
 # for examples, please go to `SingleAnnotation` method page
43
-NULL}
43
+NULL
44
+}
... ...
@@ -1,50 +1,49 @@
1 1
 \name{SingleAnnotation}
2 2
 \alias{SingleAnnotation}
3 3
 \title{
4
-Constructor method for SingleAnnotation class
4
+Constructor method for SingleAnnotation class  
5
+
5 6
 
6 7
 }
7 8
 \description{
8
-Constructor method for SingleAnnotation class
9
+Constructor method for SingleAnnotation class  
10
+
9 11
 
10 12
 }
11 13
 \usage{
12 14
 SingleAnnotation(name, value, col, fun, which = c("column", "row"),
13
-    show_legend = TRUE, gp = gpar(col = NA))}
15
+    show_legend = TRUE, gp = gpar(col = NA))
16
+}
14 17
 \arguments{
15 18
 
16 19
   \item{name}{name for this annotation.}
17 20
   \item{value}{A vector of annotation.}
18
-  \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. }
19
-  \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.}
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. }
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.}
20 23
   \item{which}{is the annotation a row annotation or a column annotation?}
21 24
   \item{show_legend}{if it is a simple annotation, whether show legend when making the complete heatmap.}
22 25
   \item{gp}{graphic parameters for simple annotations.}
26
+
23 27
 }
24 28
 \details{
25
-The most simple annotation is one row or one column grids in which different colors
26
-represent different classes of the data. Here the function use \code{\link{ColorMapping-class}}
27
-to process such simple annotation. \code{value} and \code{col} arguments controls values and colors
28
-of the simple annotation and a \code{\link{ColorMapping-class}} object will be constructed based on \code{value} and \code{col}.
29
+The most simple annotation is one row or one column grids in which different colors represent different classes of the data. Here the function use \code{\link{ColorMapping-class}} to process such simple annotation. \code{value} and \code{col} arguments controls values and colors of the simple annotation and a \code{\link{ColorMapping-class}} object will be constructed based on \code{value} and \code{col}.  
29 30
 
30
-\code{fun} is used to construct a more complex annotation. Users can add any type of annotation graphics
31
-by implementing a function. The only input argument of \code{fun} is a index
32
-of rows or columns which is already adjusted by the clustering. In the package, there are already
33
-several annotation graphic function generators: \code{\link{anno_points}}, \code{\link{anno_histogram}} and \code{\link{anno_boxplot}}.
31
+\code{fun} is used to construct a more complex annotation. Users can add any type of annotation graphics by implementing a function. The only input argument of \code{fun} is a index of rows or columns which is already adjusted by the clustering. In the package, there are already several annotation graphic function generators: \code{\link{anno_points}}, \code{\link{anno_histogram}} and \code{\link{anno_boxplot}}.  
34 32
 
35
-In the case that row annotations are splitted by rows, \code{index} corresponding to row orders in each row-slice
36
-and \code{fun} will be applied on each of the row slices.
33
+In the case that row annotations are splitted by rows, \code{index} corresponding to row orders in each row-slice and \code{fun} will be applied on each of the row slices.  
34
+
35
+One thing that users should be careful is the difference of coordinates when the annotation is a row annotation or a column annotation.   
37 36
 
38
-One thing that users should be careful is the difference of coordinates when the annotation is a row
39
-annotation or a column annotation. 
40 37
 
41 38
 }
42 39
 \value{
43
-A \code{\link{SingleAnnotation-class}} object.
40
+A \code{\link{SingleAnnotation-class}} object.  
41
+
44 42
 
45 43
 }
46 44
 \author{
47
-Zuguang Gu <z.gu@dkfz.de>
45
+Zuguang Gu <z.gu@dkfz.de>  
46
+
48 47
 
49 48
 }
50 49
 \examples{
... ...
@@ -63,4 +62,5 @@ SingleAnnotation(value = 1:10)
63 62
 SingleAnnotation(value = 1:10, col = colorRamp2(c(1, 10), c("blue", "red")))
64 63
 
65 64
 # self-defined graphic function
66
-SingleAnnotation(fun = anno_points(1:10))}
65
+SingleAnnotation(fun = anno_points(1:10))
66
+}
... ...
@@ -1,33 +1,39 @@
1 1
 \name{+.AdditiveUnit}
2 2
 \alias{+.AdditiveUnit}
3 3
 \title{
4
-Add heatmaps or row annotations to a heatmap list
4
+Add heatmaps or row annotations to a heatmap list  
5
+
5 6
 
6 7
 }
7 8
 \description{
8
-Add heatmaps or row annotations to a heatmap list
9
+Add heatmaps or row annotations to a heatmap list  
10
+
9 11
 
10 12
 }
11 13
 \usage{
12
-\method{+}{AdditiveUnit}(x, y)}
14
+\method{+}{AdditiveUnit}(x, y)
15
+}
13 16
 \arguments{
14 17
 
15 18
   \item{x}{a \code{\link{Heatmap-class}} object, a \code{\link{HeatmapAnnotation-class}} object or a \code{\link{HeatmapList-class}} object.}
16 19
   \item{y}{a \code{\link{Heatmap-class}} object, a \code{\link{HeatmapAnnotation-class}} object or a \code{\link{HeatmapList-class}} object.}
20
+
17 21
 }
18 22
 \details{
19
-It is only a shortcut function. It actually calls \code{\link{add_heatmap,Heatmap-method}}, \code{\link{add_heatmap,HeatmapList-method}}
20
-or \code{\link{add_heatmap,HeatmapAnnotation-method}} depending on the class of the input objects.
23
+It is only a shortcut function. It actually calls \code{\link{add_heatmap,Heatmap-method}}, \code{\link{add_heatmap,HeatmapList-method}} or \code{\link{add_heatmap,HeatmapAnnotation-method}} depending on the class of the input objects.  
24
+
25
+The \code{\link{HeatmapAnnotation-class}} object to be added should only be row annotations.  
21 26
 
22
-The \code{\link{HeatmapAnnotation-class}} object to be added should only be row annotations.
23 27
 
24 28
 }
25 29
 \value{
26
-A \code{\link{HeatmapList-class}} object.
30
+A \code{\link{HeatmapList-class}} object.  
31
+
27 32
 
28 33
 }
29 34
 \author{
30
-Zuguang Gu <z.gu@dkfz.de>
35
+Zuguang Gu <z.gu@dkfz.de>  
36
+
31 37
 
32 38
 }
33 39
 \examples{
... ...
@@ -48,4 +54,5 @@ ha = HeatmapAnnotation(points = anno_points(1:12, which = "row"),
48 54
 ht + ha
49 55
 ht_list + ha
50 56
 
51
-ha + ha + ht}
57
+ha + ha + ht
58
+}
... ...
@@ -1,30 +1,37 @@
1 1
 \name{add_heatmap-Heatmap-method}
2 2
 \alias{add_heatmap,Heatmap-method}
3 3
 \title{
4
-Add heatmaps or row annotations as a heatmap list
4
+Add heatmaps or row annotations as a heatmap list  
5
+
5 6
 
6 7
 }
7 8
 \description{
8
-Add heatmaps or row annotations as a heatmap list
9
+Add heatmaps or row annotations as a heatmap list  
10
+
9 11
 
10 12
 }
11 13
 \usage{
12
-\S4method{add_heatmap}{Heatmap}(object, x)}
14
+\S4method{add_heatmap}{Heatmap}(object, x)
15
+}
13 16
 \arguments{
14 17
 
15 18
   \item{object}{a \code{\link{Heatmap-class}} object.}
16 19
   \item{x}{a \code{\link{Heatmap-class}} object, a \code{\link{HeatmapAnnotation-class}} object or a \code{\link{HeatmapList-class}} object.}
20
+
17 21
 }
18 22
 \details{
19
-There is a shortcut function \code{+.AdditiveUnit}.
23
+There is a shortcut function \code{+.AdditiveUnit}.  
24
+
20 25
 
21 26
 }
22 27
 \value{
23
-A \code{\link{HeatmapList-class}} object.
28
+A \code{\link{HeatmapList-class}} object.  
29
+
24 30
 
25 31
 }
26 32
 \author{
27
-Zuguang Gu <z.gu@dkfz.de>
33
+Zuguang Gu <z.gu@dkfz.de>  
34
+
28 35
 
29 36
 }
30 37
 \examples{
... ...
@@ -38,4 +45,5 @@ add_heatmap(ht, ht)
38 45
 
39 46
 ha = HeatmapAnnotation(points = anno_points(1:12, which = "row"), 
40 47
     which = "row")
41
-add_heatmap(ht, ha)}
48
+add_heatmap(ht, ha)
49
+}
... ...
@@ -1,30 +1,37 @@
1 1
 \name{add_heatmap-HeatmapAnnotation-method}
2 2
 \alias{add_heatmap,HeatmapAnnotation-method}
3 3
 \title{
4
-Add row annotations or heatmaps as a heatmap list
4
+Add row annotations or heatmaps as a heatmap list  
5
+
5 6
 
6 7
 }
7 8
 \description{
8
-Add row annotations or heatmaps as a heatmap list
9
+Add row annotations or heatmaps as a heatmap list  
10
+
9 11
 
10 12
 }
11 13
 \usage{
12
-\S4method{add_heatmap}{HeatmapAnnotation}(object, x)}
14
+\S4method{add_heatmap}{HeatmapAnnotation}(object, x)
15
+}
13 16
 \arguments{
14 17
 
15 18
   \item{object}{a \code{\link{HeatmapAnnotation-class}} object.}
16 19
   \item{x}{a \code{\link{Heatmap-class}} object, a \code{\link{HeatmapAnnotation-class}} object or a \code{\link{HeatmapList-class}} object.}
20
+
17 21
 }
18 22
 \details{
19
-There is a shortcut function \code{+.AdditiveUnit}.
23
+There is a shortcut function \code{+.AdditiveUnit}.  
24
+
20 25
 
21 26
 }
22 27
 \value{
23
-A \code{\link{HeatmapList-class}} object.
28
+A \code{\link{HeatmapList-class}} object.  
29
+
24 30
 
25 31
 }
26 32
 \author{
27
-Zuguang Gu <z.gu@dkfz.de>
33
+Zuguang Gu <z.gu@dkfz.de>  
34
+
28 35
 
29 36
 }
30 37
 \examples{
... ...
@@ -37,4 +44,5 @@ ht = Heatmap(mat)
37 44
 
38 45
 ha = HeatmapAnnotation(points = anno_points(1:12, which = "row"), 
39 46
     which = "row")
40
-add_heatmap(ha, ht)}
47
+add_heatmap(ha, ht)
48
+}
... ...
@@ -1,30 +1,37 @@
1 1
 \name{add_heatmap-HeatmapList-method}
2 2
 \alias{add_heatmap,HeatmapList-method}
3 3
 \title{
4
-Add heatmaps and row annotations to the heatmap list
4
+Add heatmaps and row annotations to the heatmap list  
5
+
5 6
 
6 7
 }
7 8
 \description{
8
-Add heatmaps and row annotations to the heatmap list
9
+Add heatmaps and row annotations to the heatmap list  
10
+
9 11
 
10 12
 }
11 13
 \usage{
12
-\S4method{add_heatmap}{HeatmapList}(object, x)}
14
+\S4method{add_heatmap}{HeatmapList}(object, x)
15
+}
13 16
 \arguments{
14 17
 
15 18
   \item{object}{a \code{\link{HeatmapList-class}} object.}
16 19
   \item{x}{a \code{\link{Heatmap-class}} object or a \code{\link{HeatmapAnnotation-class}} object or a \code{\link{HeatmapList-class}} object.}
20
+
17 21
 }
18 22
 \details{
19
-There is a shortcut function \code{+.AdditiveUnit}.
23
+There is a shortcut function \code{+.AdditiveUnit}.  
24
+
20 25
 
21 26
 }
22 27
 \value{
23
-A \code{\link{HeatmapList-class}} object.
28
+A \code{\link{HeatmapList-class}} object.  
29
+
24 30
 
25 31
 }
26 32
 \author{
27
-Zuguang Gu <z.gu@dkfz.de>
33
+Zuguang Gu <z.gu@dkfz.de>  
34
+
28 35
 
29 36
 }
30 37
 \examples{
... ...
@@ -39,4 +46,5 @@ add_heatmap(ht_list, ht)
39 46
 
40 47
 ha = HeatmapAnnotation(points = anno_points(1:12, which = "row"), 
41 48
     which = "row")
42
-add_heatmap(ht_list, ha)}
49
+add_heatmap(ht_list, ha)
50
+}
... ...
@@ -1,17 +1,20 @@
1 1
 \name{add_heatmap-dispatch}
2 2
 \alias{add_heatmap}
3 3
 \title{
4
-Method dispatch page for add_heatmap}
4
+Method dispatch page for add_heatmap
5
+}
5 6
 \description{
6
-Method dispatch page for \code{add_heatmap}.}
7
+Method dispatch page for \code{add_heatmap}.
8
+}
7 9
 \section{Dispatch}{
8 10
 \code{add_heatmap} can be dispatched on following classes:
9 11
 
10 12
 \itemize{
11
-\item \code{\link{add_heatmap,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
12
-\item \code{\link{add_heatmap,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
13
-\item \code{\link{add_heatmap,Heatmap-method}}, \code{\link{Heatmap-class}} class method
13
+\item \code{\link{add_heatmap,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation}} class method
14
+\item \code{\link{add_heatmap,HeatmapList-method}}, \code{\link{HeatmapList}} class method
15
+\item \code{\link{add_heatmap,Heatmap-method}}, \code{\link{Heatmap}} class method
14 16
 }
17
+
15 18
 }
16 19
 \section{Example}{
17 20
 # no example
... ...
@@ -19,4 +22,5 @@ NULL
19 22
 }
20 23
 \examples{
21 24
 # no example
22
-NULL}
25
+NULL
26
+}
... ...
@@ -1,17 +1,20 @@
1 1
 \name{anno_barplot}
2 2
 \alias{anno_barplot}
3 3
 \title{
4
-Using barplot as annotation
4
+Using barplot as annotation  
5
+
5 6
 
6 7
 }
7 8
 \description{
8
-Using barplot as annotation
9
+Using barplot as annotation  
10
+
9 11
 
10 12
 }
11 13
 \usage{
12 14
 anno_barplot(x, which = c("column", "row"),
13 15
     gp = gpar(fill = "#CCCCCC"), axis = FALSE, axis_side = NULL,
14
-    axis_gp = gpar(fontsize = 8), ...)}
16
+    axis_gp = gpar(fontsize = 8), ...)
17
+}
15 18
 \arguments{
16 19
 
17 20
   \item{x}{a vector of values.}
... ...
@@ -21,13 +24,16 @@ anno_barplot(x, which = c("column", "row"),
21 24
   \item{axis_side}{value in "left", "right", "bottom" and "top"}
22 25
   \item{axis_gp}{graphic parameters for axis}
23 26
   \item{...}{for future use.}
27
+
24 28
 }
25 29
 \value{
26
-A graphic function which can be set in \code{\link{HeatmapAnnotation}} constructor method.
30
+A graphic function which can be set in \code{\link{HeatmapAnnotation}} constructor method.  
31
+
27 32
 
28 33
 }
29 34
 \author{
30
-Zuguang Gu <z.gu@dkfz.de>
35
+Zuguang Gu <z.gu@dkfz.de>  
36
+
31 37
 
32 38
 }
33 39
 \examples{
... ...
@@ -35,4 +41,5 @@ f = anno_barplot(rnorm(10))
35 41
 grid.newpage(); f(1:10)
36 42
 
37 43
 f = anno_barplot(rnorm(10), which = "row")
38
-grid.newpage(); f(1:10)}
44
+grid.newpage(); f(1:10)
45
+}
... ...
@@ -1,20 +1,23 @@
1 1
 \name{anno_boxplot}
2 2
 \alias{anno_boxplot}
3 3
 \title{
4
-Using boxplot as annotation
4
+Using boxplot as annotation  
5
+
5 6
 
6 7
 }
7 8
 \description{
8
-Using boxplot as annotation
9
+Using boxplot as annotation  
10
+
9 11
 
10 12
 }
11 13
 \usage{
12 14
 anno_boxplot(x, which = c("column", "row"), gp = gpar(fill = "#CCCCCC"),
13 15
     pch = 16, size = unit(2, "mm"), axis = FALSE, axis_side = NULL,
14
-    axis_gp = gpar(fontsize = 8))}
16
+    axis_gp = gpar(fontsize = 8))
17
+}
15 18
 \arguments{
16 19
 
17
-  \item{x}{a matrix or a list. If \code{x} is a matrix and if \code{which} is \code{column}, statistics for boxplotis calculated by columns, if \code{which} is \code{row}, the calculation is by rows.}
20
+  \item{x}{a matrix or a list. If \code{x} is a matrix and if \code{which} is \code{column}, statistics for boxplot is calculated by columns, if \code{which} is \code{row}, the calculation is by rows.}
18 21
   \item{which}{is the annotation a column annotation or a row annotation?}
19 22
   \item{gp}{graphic parameters}
20 23
   \item{pch}{point type}
... ...
@@ -22,13 +25,16 @@ anno_boxplot(x, which = c("column", "row"), gp = gpar(fill = "#CCCCCC"),
22 25
   \item{axis}{whether add axis}
23 26
   \item{axis_side}{value in "left", "right", "bottom" and "top"}
24 27
   \item{axis_gp}{graphic parameters for axis}
28
+
25 29
 }
26 30
 \value{
27
-A graphic function which can be set in \code{\link{HeatmapAnnotation}} constructor method.
31
+A graphic function which can be set in \code{\link{HeatmapAnnotation}} constructor method.  
32
+
28 33
 
29 34
 }
30 35
 \author{
31
-Zuguang Gu <z.gu@dkfz.de>
36
+Zuguang Gu <z.gu@dkfz.de>  
37
+
32 38
 
33 39
 }
34 40
 \examples{
... ...
@@ -41,4 +47,5 @@ grid.newpage(); f(1:4)
41 47
 
42 48
 lt = lapply(1:4, function(i) rnorm(8))
43 49
 f = anno_boxplot(lt)
44
-grid.newpage(); f(1:4)}
50
+grid.newpage(); f(1:4)
51
+}
... ...
@@ -1,30 +1,36 @@
1 1
 \name{anno_density}
2 2
 \alias{anno_density}
3 3
 \title{
4
-Using kernel density as annotation
4
+Using kernel density as annotation  
5
+
5 6
 
6 7
 }
7 8
 \description{
8
-Using kernel density as annotation
9
+Using kernel density as annotation  
10
+
9 11
 
10 12
 }
11 13
 \usage{
12 14
 anno_density(x, which = c("column", "row"), gp = gpar(fill = "#CCCCCC"),
13
-    type = c("lines", "violin", "heatmap"), ...)}