... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
Package: mheatmap |
2 | 2 |
Type: Package |
3 |
-Title: plot multiple heatmaps |
|
3 |
+Title: Making Complex Heatmaps |
|
4 | 4 |
Version: 0.0.1 |
5 | 5 |
Date: 2014-10-6 |
6 | 6 |
Author: Zuguang Gu |
... | ... |
@@ -9,7 +9,10 @@ Depends: R (>= 3.1.0), grid |
9 | 9 |
Imports: methods, circlize (>= 0.2.3), GetoptLong, colorspace |
10 | 10 |
Suggests: testthat (>= 0.3), knitr, markdown, cluster, dendextend |
11 | 11 |
VignetteBuilder: knitr |
12 |
-Description: plot multiple heatmaps |
|
12 |
+Description: Complex heatmaps are efficient to visualize associations |
|
13 |
+ between different sources of data sets and reveal potential features. |
|
14 |
+ Here the mheatmap package provides a highly flexible way to arrange |
|
15 |
+ multiple heatmaps and supports self-defined annotation graphics. |
|
13 | 16 |
biocViews: Software, Visualization, Sequencing |
14 | 17 |
URL: https://github.com/jokergoo/mheatmap |
15 | 18 |
License: GPL (>= 2) |
... | ... |
@@ -1,46 +1,51 @@ |
1 |
-export(+.AdditiveUnit) |
|
2 |
-exportMethods(add_heatmap) |
|
3 |
-exportMethods(draw_title) |
|
4 |
-exportMethods(make_row_cluster) |
|
1 |
+exportClasses(AdditiveUnit) |
|
2 |
+export(AdditiveUnit) |
|
3 |
+export(anno_histogram) |
|
4 |
+exportMethods(annotation_legend_size) |
|
5 |
+exportMethods(component_height) |
|
6 |
+exportMethods(draw_hclust) |
|
7 |
+export(HeatmapAnnotation) |
|
8 |
+exportMethods(draw_annotation_legend) |
|
9 |
+exportMethods(draw_heatmap_body) |
|
10 |
+export(AdditiveUnit) |
|
11 |
+export(anno_simple) |
|
12 |
+exportMethods(draw_dimnames) |
|
5 | 13 |
exportClasses(HeatmapList) |
6 | 14 |
export(HeatmapList) |
7 |
-exportMethods(draw_dimnames) |
|
8 |
-exportMethods(component_height) |
|
9 |
-exportMethods(initialize) |
|
10 |
-exportMethods(prepare) |
|
11 |
-exportMethods(make_layout) |
|
12 |
-exportMethods(draw_heatmap_list) |
|
13 |
-exportMethods(component_width) |
|
14 |
-exportMethods(set_component_height) |
|
15 |
-exportMethods(draw_annotation) |
|
16 |
-exportMethods(map) |
|
17 |
-exportMethods(annotation_legend_size) |
|
18 |
-export(anno_points) |
|
19 |
-export(dist2) |
|
20 | 15 |
exportMethods(show) |
21 |
-exportMethods(color_mapping_legend) |
|
22 |
-exportClasses(AdditiveUnit) |
|
23 |
-export(AdditiveUnit) |
|
24 | 16 |
exportMethods(make_column_cluster) |
25 |
-exportMethods(draw_heatmap_body) |
|
17 |
+exportMethods(draw) |
|
18 |
+exportMethods(color_mapping_legend) |
|
26 | 19 |
exportClasses(ColorMapping) |
27 | 20 |
export(ColorMapping) |
21 |
+export(anno_boxplot) |
|
22 |
+exportMethods(add_heatmap) |
|
23 |
+exportMethods(make_row_cluster) |
|
24 |
+exportMethods(make_layout) |
|
25 |
+exportMethods(map) |
|
26 |
+exportMethods(draw_heatmap_list) |
|
27 |
+exportMethods(draw_heatmap_legend) |
|
28 |
+export(Heatmap) |
|
29 |
+exportMethods(heatmap_legend_size) |
|
28 | 30 |
exportMethods(get_color_mapping_list) |
31 |
+export(ColorMapping) |
|
29 | 32 |
exportClasses(Heatmap) |
30 | 33 |
export(Heatmap) |
31 |
-export(anno_histogram) |
|
32 |
-exportMethods(heatmap_legend_size) |
|
33 |
-exportMethods(draw_annotation_legend) |
|
34 |
+export(anno_points) |
|
35 |
+exportMethods(set_component_height) |
|
36 |
+export(+.AdditiveUnit) |
|
37 |
+exportMethods(prepare) |
|
38 |
+exportMethods(component_width) |
|
34 | 39 |
exportClasses(SingleAnnotation) |
35 | 40 |
export(SingleAnnotation) |
36 |
-export(anno_simple) |
|
37 |
-exportMethods(draw_heatmap_legend) |
|
38 |
-export(grid.dendrogram) |
|
39 |
-exportMethods(draw_hclust) |
|
40 |
-exportMethods(draw) |
|
41 |
+export(HeatmapList) |
|
41 | 42 |
exportClasses(HeatmapAnnotation) |
42 | 43 |
export(HeatmapAnnotation) |
43 |
-export(anno_boxplot) |
|
44 |
+export(SingleAnnotation) |
|
45 |
+export(grid.dendrogram) |
|
46 |
+exportMethods(draw_title) |
|
47 |
+exportMethods(draw_annotation) |
|
48 |
+export(dist2) |
|
44 | 49 |
|
45 | 50 |
import(grid) |
46 | 51 |
importFrom("methods", setClass) |
... | ... |
@@ -1,44 +1,44 @@ |
1 | 1 |
|
2 |
-setGeneric('draw_heatmap_body', function(object, ...) standardGeneric('draw_heatmap_body')) |
|
2 |
+setGeneric('make_layout', function(object, ...) standardGeneric('make_layout')) |
|
3 | 3 |
|
4 |
-setGeneric('make_row_cluster', function(object, ...) standardGeneric('make_row_cluster')) |
|
4 |
+setGeneric('draw_title', function(object, ...) standardGeneric('draw_title')) |
|
5 | 5 |
|
6 |
-setGeneric('draw_dimnames', function(object, ...) standardGeneric('draw_dimnames')) |
|
6 |
+setGeneric('annotation_legend_size', function(object, ...) standardGeneric('annotation_legend_size')) |
|
7 | 7 |
|
8 |
-setGeneric('draw', function(object, ...) standardGeneric('draw')) |
|
8 |
+setGeneric('component_width', function(object, ...) standardGeneric('component_width')) |
|
9 | 9 |
|
10 |
-setGeneric('draw_title', function(object, ...) standardGeneric('draw_title')) |
|
10 |
+setGeneric('component_height', function(object, ...) standardGeneric('component_height')) |
|
11 | 11 |
|
12 |
-setGeneric('component_width', function(object, ...) standardGeneric('component_width')) |
|
12 |
+setGeneric('add_heatmap', function(object, ...) standardGeneric('add_heatmap')) |
|
13 | 13 |
|
14 | 14 |
setGeneric('draw_heatmap_legend', function(object, ...) standardGeneric('draw_heatmap_legend')) |
15 | 15 |
|
16 |
-setGeneric('set_component_height', function(object, ...) standardGeneric('set_component_height')) |
|
16 |
+setGeneric('draw_annotation_legend', function(object, ...) standardGeneric('draw_annotation_legend')) |
|
17 | 17 |
|
18 |
-setGeneric('map', function(object, ...) standardGeneric('map')) |
|
18 |
+setGeneric('make_column_cluster', function(object, ...) standardGeneric('make_column_cluster')) |
|
19 | 19 |
|
20 |
-setGeneric('prepare', function(object, ...) standardGeneric('prepare')) |
|
20 |
+setGeneric('heatmap_legend_size', function(object, ...) standardGeneric('heatmap_legend_size')) |
|
21 | 21 |
|
22 |
-setGeneric('get_color_mapping_list', function(object, ...) standardGeneric('get_color_mapping_list')) |
|
22 |
+setGeneric('map', function(object, ...) standardGeneric('map')) |
|
23 | 23 |
|
24 |
-setGeneric('make_layout', function(object, ...) standardGeneric('make_layout')) |
|
24 |
+setGeneric('get_color_mapping_list', function(object, ...) standardGeneric('get_color_mapping_list')) |
|
25 | 25 |
|
26 | 26 |
setGeneric('color_mapping_legend', function(object, ...) standardGeneric('color_mapping_legend')) |
27 | 27 |
|
28 |
-setGeneric('draw_annotation_legend', function(object, ...) standardGeneric('draw_annotation_legend')) |
|
28 |
+setGeneric('draw', function(object, ...) standardGeneric('draw')) |
|
29 | 29 |
|
30 | 30 |
setGeneric('draw_annotation', function(object, ...) standardGeneric('draw_annotation')) |
31 | 31 |
|
32 |
-setGeneric('make_column_cluster', function(object, ...) standardGeneric('make_column_cluster')) |
|
32 |
+setGeneric('make_row_cluster', function(object, ...) standardGeneric('make_row_cluster')) |
|
33 | 33 |
|
34 | 34 |
setGeneric('draw_hclust', function(object, ...) standardGeneric('draw_hclust')) |
35 | 35 |
|
36 |
-setGeneric('heatmap_legend_size', function(object, ...) standardGeneric('heatmap_legend_size')) |
|
36 |
+setGeneric('draw_heatmap_body', function(object, ...) standardGeneric('draw_heatmap_body')) |
|
37 | 37 |
|
38 |
-setGeneric('annotation_legend_size', function(object, ...) standardGeneric('annotation_legend_size')) |
|
38 |
+setGeneric('draw_dimnames', function(object, ...) standardGeneric('draw_dimnames')) |
|
39 | 39 |
|
40 |
-setGeneric('add_heatmap', function(object, ...) standardGeneric('add_heatmap')) |
|
40 |
+setGeneric('set_component_height', function(object, ...) standardGeneric('set_component_height')) |
|
41 | 41 |
|
42 |
-setGeneric('component_height', function(object, ...) standardGeneric('component_height')) |
|
42 |
+setGeneric('prepare', function(object, ...) standardGeneric('prepare')) |
|
43 | 43 |
|
44 | 44 |
setGeneric('draw_heatmap_list', function(object, ...) standardGeneric('draw_heatmap_list')) |
... | ... |
@@ -3,25 +3,38 @@ |
3 | 3 |
# An internal class |
4 | 4 |
# |
5 | 5 |
# == detail |
6 |
-# This class is a super class for `Heatmap`, `HeatmapList` and `HeatmapAnnotation` classes. |
|
7 |
-# And it is only for ``+`` generic method. |
|
6 |
+# This class is a super class for `Heatmap-class`, `HeatmapList-class` and `HeatmapAnnotation-class` classes. |
|
7 |
+# It is only for ``+`` generic method. |
|
8 | 8 |
# |
9 | 9 |
AdditiveUnit = setClass("AdditiveUnit") |
10 | 10 |
|
11 |
+# == title |
|
12 |
+# Constructor method for AdditiveUnit class |
|
13 |
+# |
|
14 |
+# == param |
|
15 |
+# -... arguments. |
|
16 |
+# |
|
17 |
+# == details |
|
18 |
+# This method is not used in the package. |
|
19 |
+# |
|
20 |
+AdditiveUnit = function(...) { |
|
21 |
+ new("AdditiveUnit", ...) |
|
22 |
+} |
|
23 |
+ |
|
11 | 24 |
|
12 | 25 |
# == title |
13 | 26 |
# Add heatmaps or row annotations to a heatmap list |
14 | 27 |
# |
15 | 28 |
# == param |
16 |
-# -x a `Heatmap` object, a `HeatmapAnnotation` object or a `HeatmapList` object. |
|
17 |
-# -y a `Heatmap` object, a `HeatmapAnnotation` object or a `HeatmapList` object. |
|
29 |
+# -x a `Heatmap-class` object, a `HeatmapAnnotation-class` object or a `HeatmapList-class` object. |
|
30 |
+# -y a `Heatmap-class` object, a `HeatmapAnnotation-class` object or a `HeatmapList-class` object. |
|
18 | 31 |
# |
19 | 32 |
# == detail |
20 | 33 |
# It is only a shortcut function. It actually calls `add_heatmap,Heatmap-method`, `add_heatmap,HeatmapList-method` |
21 |
-# or `add_heatmap,HeatmapAnnotation-method` depending on the class of the input values. |
|
34 |
+# or `add_heatmap,HeatmapAnnotation-method` depending on the class of the input objects. |
|
22 | 35 |
# |
23 | 36 |
# == value |
24 |
-# a `HeatmapList` object. |
|
37 |
+# A `HeatmapList-class` object. |
|
25 | 38 |
# |
26 | 39 |
# == author |
27 | 40 |
# Zuguang Gu <z.gu@dkfz.de> |
... | ... |
@@ -7,14 +7,14 @@ |
7 | 7 |
# Class to map values to colors |
8 | 8 |
# |
9 | 9 |
# == details |
10 |
-# The `ColorMapping` class handles color mapping with both discrete values and continuous values. |
|
10 |
+# The `ColorMapping-class` handles color mapping with both discrete values and continuous values. |
|
11 | 11 |
# Discrete values are mapped by setting a vector of colors and continuous values are mapped by setting |
12 | 12 |
# a color mapping function. |
13 | 13 |
# |
14 | 14 |
# == methods |
15 |
-# The `ColorMapping` class provides following methods: |
|
15 |
+# The `ColorMapping-class` provides following methods: |
|
16 | 16 |
# |
17 |
-# - `initialize,ColorMapping-method`: contructor methods |
|
17 |
+# - `ColorMapping`: contructor methods |
|
18 | 18 |
# - `map,ColorMapping-method`: mapping values to colors |
19 | 19 |
# - `color_mapping_legend,ColorMapping-method`: draw legend or get the size of the legend |
20 | 20 |
# |
... | ... |
@@ -35,7 +35,6 @@ ColorMapping = setClass("ColorMapping", |
35 | 35 |
# Constructor methods for ColorMapping class |
36 | 36 |
# |
37 | 37 |
# == param |
38 |
-# -.Object private object |
|
39 | 38 |
# -name name for this color mapping. It is used for drawing the title of the legend. |
40 | 39 |
# -colors discrete colors. |
41 | 40 |
# -levels levels that correspond to ``colors``. If ``colors`` is name indexed, |
... | ... |
@@ -49,16 +48,16 @@ ColorMapping = setClass("ColorMapping", |
49 | 48 |
# ``breaks`` are used for continuous color mapping. |
50 | 49 |
# |
51 | 50 |
# == value |
52 |
-# A `ColorMapping` object. |
|
51 |
+# A `ColorMapping-class` object. |
|
53 | 52 |
# |
54 | 53 |
# == author |
55 | 54 |
# Zuguang Gu <z.gu@dkfz.de> |
56 | 55 |
# |
57 |
-setMethod(f = "initialize", |
|
58 |
- signature = "ColorMapping", |
|
59 |
- definition = function(.Object, name, colors = NULL, levels = NULL, |
|
56 |
+ColorMapping = function(name, colors = NULL, levels = NULL, |
|
60 | 57 |
col_fun = NULL, breaks = NULL) { |
61 | 58 |
|
59 |
+ .Object = new("ColorMapping") |
|
60 |
+ |
|
62 | 61 |
if(is.null(name)) { |
63 | 62 |
stop("You should provide name.") |
64 | 63 |
} |
... | ... |
@@ -106,13 +105,13 @@ setMethod(f = "initialize", |
106 | 105 |
.Object@name = name |
107 | 106 |
|
108 | 107 |
return(.Object) |
109 |
-}) |
|
108 |
+} |
|
110 | 109 |
|
111 | 110 |
# == title |
112 | 111 |
# Print ColorMapping object |
113 | 112 |
# |
114 | 113 |
# == param |
115 |
-# -object a `ColorMapping` object. |
|
114 |
+# -object a `ColorMapping-class` object. |
|
116 | 115 |
# |
117 | 116 |
# == value |
118 | 117 |
# This function returns no value. |
... | ... |
@@ -150,7 +149,7 @@ setMethod(f = "show", |
150 | 149 |
# Map values to colors |
151 | 150 |
# |
152 | 151 |
# == param |
153 |
-# -object a `ColorMapping` object. |
|
152 |
+# -object a `ColorMapping-class` object. |
|
154 | 153 |
# -x input values. |
155 | 154 |
# |
156 | 155 |
# == details |
... | ... |
@@ -189,7 +188,7 @@ setMethod(f = "map", |
189 | 188 |
# Draw legend based on color mapping |
190 | 189 |
# |
191 | 190 |
# == param |
192 |
-# -object a `ColorMapping` object. |
|
191 |
+# -object a `ColorMapping-class` object. |
|
193 | 192 |
# -... pass to `grid::viewport`. |
194 | 193 |
# -plot whether to plot or just return the size of the legend viewport. |
195 | 194 |
# -legend_grid_height height of each legend grid. |
... | ... |
@@ -46,14 +46,14 @@ |
46 | 46 |
# - row cluster on the right, graphics are drawn by `draw_hclust,Heatmap-method`. |
47 | 47 |
# - title on the right, graphics are drawn by `draw_title,Heatmap-method`. |
48 | 48 |
# |
49 |
-# The `Heatmap` class is not responsible for heatmap legend and annotatino legends. The `draw,Heatmap-method` method |
|
50 |
-# will construct a `HeatmapList` object which only contains one single heatmap |
|
49 |
+# The `Heatmap-class` is not responsible for heatmap legend and annotatino legends. The `draw,Heatmap-method` method |
|
50 |
+# will construct a `HeatmapList-class` object which only contains one single heatmap |
|
51 | 51 |
# and call `draw,HeatmapList-method` to make a complete heatmap. |
52 | 52 |
# |
53 | 53 |
# == methods |
54 |
-# The `Heatmap` class provides following methods: |
|
54 |
+# The `Heatmap-class` provides following methods: |
|
55 | 55 |
# |
56 |
-# - `initialize,Heatmap-method`: contructor method. |
|
56 |
+# - `Heatmap`: contructor method. |
|
57 | 57 |
# - `draw,Heatmap-method`: draw a single heatmap. |
58 | 58 |
# - `add_heatmap,Heatmap-method` append heatmaps and row annotations to a list of heatmaps. |
59 | 59 |
# |
... | ... |
@@ -103,11 +103,10 @@ Heatmap = setClass("Heatmap", |
103 | 103 |
# Constructor method for Heatmap class |
104 | 104 |
# |
105 | 105 |
# == param |
106 |
-# -.Object private object. |
|
107 | 106 |
# -matrix a matrix. Either numeric or character. If it is a simple vector, it will be |
108 | 107 |
# converted to a one-column matrix. |
109 | 108 |
# -col a vector of colors if the color mapping is discrete or a color mapping |
110 |
-# function if the matrix is continuous numbers. Pass to `initialize,ColorMapping-method`. |
|
109 |
+# function if the matrix is continuous numbers. Pass to `ColorMapping`. |
|
111 | 110 |
# -name name of the heatmap. The name is used as the title of the heatmap legend. |
112 | 111 |
# -rect_gp graphic parameters for drawing rectangles (for heatmap body). |
113 | 112 |
# -cell_fun self-defined function to add graphics on each cell. Six parameters will be passed into |
... | ... |
@@ -171,24 +170,22 @@ Heatmap = setClass("Heatmap", |
171 | 170 |
# The initialization function only applies parameter checking and fill values to each slot with proper ones. |
172 | 171 |
# Then it will be ready for clustering and layout. |
173 | 172 |
# |
174 |
-# Following methods can be applied on the `Heatmap` object: |
|
173 |
+# Following methods can be applied on the `Heatmap-class` object: |
|
175 | 174 |
# |
176 | 175 |
# - `show,Heatmap-method`: draw a single heatmap with default parameters |
177 | 176 |
# - `draw,Heatmap-method`: draw a single heatmap. |
178 | 177 |
# - `add_heatmap,Heatmap-method` append heatmaps and row annotations to a list of heatmaps. |
179 | 178 |
# |
180 | 179 |
# The constructor function pretends to be a high-level graphic function because the ``show`` method |
181 |
-# of the `Heatmap` object actually plots the graphics. |
|
180 |
+# of the `Heatmap-class` object actually plots the graphics. |
|
182 | 181 |
# |
183 | 182 |
# == value |
184 |
-# A `Heatmap` object. |
|
183 |
+# A `Heatmap-class` object. |
|
185 | 184 |
# |
186 | 185 |
# == author |
187 | 186 |
# Zuguang Gu <z.gu@dkfz.de> |
188 | 187 |
# |
189 |
-setMethod(f = "initialize", |
|
190 |
- signature = "Heatmap", |
|
191 |
- definition = function(.Object, matrix, col, name, rect_gp = gpar(col = NA), |
|
188 |
+Heatmap = function(matrix, col, name, rect_gp = gpar(col = NA), |
|
192 | 189 |
cell_fun = function(i, j, x, y, width, height, fill) NULL, |
193 | 190 |
row_title = character(0), row_title_side = c("left", "right"), |
194 | 191 |
row_title_gp = gpar(fontsize = 14), column_title = character(0), |
... | ... |
@@ -211,6 +208,8 @@ setMethod(f = "initialize", |
211 | 208 |
combined_name_fun = function(x) paste(x, collapse = "/"), |
212 | 209 |
width = NULL, show_heatmap_legend = TRUE) { |
213 | 210 |
|
211 |
+ .Object = new("Heatmap") |
|
212 |
+ |
|
214 | 213 |
.Object@heatmap_param$width = width |
215 | 214 |
.Object@heatmap_param$show_heatmap_legend = show_heatmap_legend |
216 | 215 |
|
... | ... |
@@ -308,7 +307,7 @@ setMethod(f = "initialize", |
308 | 307 |
.Object@row_names_param$side = match.arg(row_names_side)[1] |
309 | 308 |
.Object@row_names_param$show = show_row_names |
310 | 309 |
.Object@row_names_param$gp = row_names_gp |
311 |
- .Object@row_names_param$max_width = row_names_max_width |
|
310 |
+ .Object@row_names_param$max_width = row_names_max_width + unit(2, "mm") |
|
312 | 311 |
|
313 | 312 |
if(is.null(colnames(matrix))) { |
314 | 313 |
show_column_names = FALSE |
... | ... |
@@ -316,7 +315,7 @@ setMethod(f = "initialize", |
316 | 315 |
.Object@column_names_param$side = match.arg(column_names_side)[1] |
317 | 316 |
.Object@column_names_param$show = show_column_names |
318 | 317 |
.Object@column_names_param$gp = column_names_gp |
319 |
- .Object@column_names_param$max_height = column_names_max_height |
|
318 |
+ .Object@column_names_param$max_height = column_names_max_height + unit(2, "mm") |
|
320 | 319 |
|
321 | 320 |
if(inherits(cluster_rows, "dendrogram") || inherits(cluster_rows, "hclust")) { |
322 | 321 |
.Object@row_hclust_param$obj = cluster_rows |
... | ... |
@@ -409,13 +408,13 @@ setMethod(f = "initialize", |
409 | 408 |
|
410 | 409 |
return(.Object) |
411 | 410 |
|
412 |
-}) |
|
411 |
+} |
|
413 | 412 |
|
414 | 413 |
# == title |
415 | 414 |
# Make cluster on columns |
416 | 415 |
# |
417 | 416 |
# == param |
418 |
-# -object a `Heatmap` object. |
|
417 |
+# -object a `Heatmap-class` object. |
|
419 | 418 |
# -order a pre-defined order. |
420 | 419 |
# |
421 | 420 |
# == details |
... | ... |
@@ -424,7 +423,7 @@ setMethod(f = "initialize", |
424 | 423 |
# This function is only for internal use. |
425 | 424 |
# |
426 | 425 |
# == value |
427 |
-# A `Heatmap` object. |
|
426 |
+# A `Heatmap-class` object. |
|
428 | 427 |
# |
429 | 428 |
# == author |
430 | 429 |
# Zuguang Gu <z.gu@dkfz.de> |
... | ... |
@@ -460,7 +459,7 @@ setMethod(f = "make_column_cluster", |
460 | 459 |
# Make cluster on rows |
461 | 460 |
# |
462 | 461 |
# == param |
463 |
-# -object a `Heatmap` object. |
|
462 |
+# -object a `Heatmap-class` object. |
|
464 | 463 |
# -order a pre-defined order. |
465 | 464 |
# -km if apply k-means clustering on rows, number of clusters. |
466 | 465 |
# -split a vector or a data frame by which the rows are be splitted. |
... | ... |
@@ -468,10 +467,12 @@ setMethod(f = "make_column_cluster", |
468 | 467 |
# == details |
469 | 468 |
# The function will fill or adjust ``row_hclust_list``, ``row_order_list``, ``row_title`` and ``matrix_param`` slots. |
470 | 469 |
# |
470 |
+# If ``order`` is defined, no clustering will be applied. |
|
471 |
+# |
|
471 | 472 |
# This function is only for internal use. |
472 | 473 |
# |
473 | 474 |
# == value |
474 |
-# A `Heatmap` object. |
|
475 |
+# A `Heatmap-class` object. |
|
475 | 476 |
# |
476 | 477 |
# == author |
477 | 478 |
# Zuguang Gu <z.gu@dkfz.de> |
... | ... |
@@ -581,7 +582,7 @@ setMethod(f = "make_row_cluster", |
581 | 582 |
# Make the layout of a single heatmap |
582 | 583 |
# |
583 | 584 |
# == param |
584 |
-# -object a `Heatmap` object. |
|
585 |
+# -object a `Heatmap-class` object. |
|
585 | 586 |
# |
586 | 587 |
# == detail |
587 | 588 |
# The layout of the single heatmap will be established by setting the size of each heatmap components. |
... | ... |
@@ -593,7 +594,7 @@ setMethod(f = "make_row_cluster", |
593 | 594 |
# This function is only for internal use. |
594 | 595 |
# |
595 | 596 |
# == value |
596 |
-# A `Heatmap` object. |
|
597 |
+# A `Heatmap-class` object. |
|
597 | 598 |
# |
598 | 599 |
# == author |
599 | 600 |
# Zuguang Gu <z.gu@dkfz.de> |
... | ... |
@@ -786,7 +787,7 @@ setMethod(f = "make_layout", |
786 | 787 |
# Draw the single heatmap with default parameters |
787 | 788 |
# |
788 | 789 |
# == param |
789 |
-# -object a `Heatmap` object. |
|
790 |
+# -object a `Heatmap-class` object. |
|
790 | 791 |
# |
791 | 792 |
# == details |
792 | 793 |
# Actually it calls `draw,Heatmap-method`, but only with default parameters. If users want to customize the heatmap, |
... | ... |
@@ -812,14 +813,14 @@ setMethod(f = "show", |
812 | 813 |
# Add two heatmaps or add row annotations as a heatmap list |
813 | 814 |
# |
814 | 815 |
# == param |
815 |
-# -object a `Heatmap` object. |
|
816 |
-# -x a `Heatmap` object, a `HeatmapAnnotation` object or a `HeatmapList` object. |
|
816 |
+# -object a `Heatmap-class` object. |
|
817 |
+# -x a `Heatmap-class` object, a `HeatmapAnnotation-class` object or a `HeatmapList-class` object. |
|
817 | 818 |
# |
818 | 819 |
# == details |
819 | 820 |
# There is a shortcut function ``+.Heatmap``. |
820 | 821 |
# |
821 | 822 |
# == value |
822 |
-# A `HeatmapList` object. |
|
823 |
+# A `HeatmapList-class` object. |
|
823 | 824 |
# |
824 | 825 |
# == author |
825 | 826 |
# Zuguang Gu <z.gu@dkfz.de> |
... | ... |
@@ -839,7 +840,7 @@ setMethod(f = "add_heatmap", |
839 | 840 |
# Draw the heatmap body |
840 | 841 |
# |
841 | 842 |
# == param |
842 |
-# -object a `Heatmap` object. |
|
843 |
+# -object a `Heatmap-class` object. |
|
843 | 844 |
# -k a matrix may be splitted by rows, the value identifies which row-slice. |
844 | 845 |
# -... pass to `grid::viewport`, basically for defining the position of the viewport. |
845 | 846 |
# |
... | ... |
@@ -905,7 +906,7 @@ setMethod(f = "draw_heatmap_body", |
905 | 906 |
# Draw dendrogram on row or column |
906 | 907 |
# |
907 | 908 |
# == params |
908 |
-# -object a `Heatmap` object. |
|
909 |
+# -object a `Heatmap-class` object. |
|
909 | 910 |
# -which is dendrogram put on the row or on the column of the heatmap? |
910 | 911 |
# -k a matrix may be splitted by rows, the value identifies which row-slice. |
911 | 912 |
# -max_height maximum height of the dendrograms. |
... | ... |
@@ -974,7 +975,7 @@ setMethod(f = "draw_hclust", |
974 | 975 |
# Draw row names or column names |
975 | 976 |
# |
976 | 977 |
# == param |
977 |
-# -object a `Heatmap` object. |
|
978 |
+# -object a `Heatmap-class` object. |
|
978 | 979 |
# -which are names put on the row or on the column of the heatmap? |
979 | 980 |
# -k a matrix may be splitted by rows, the value identifies which row-slice. |
980 | 981 |
# -... pass to `grid::viewport`, basically for defining the position of the viewport. |
... | ... |
@@ -1060,7 +1061,7 @@ setMethod(f = "draw_dimnames", |
1060 | 1061 |
# Draw heatmap title |
1061 | 1062 |
# |
1062 | 1063 |
# == param |
1063 |
-# -object a `Heatmap` object. |
|
1064 |
+# -object a `Heatmap-class` object. |
|
1064 | 1065 |
# -which is title put on the row or on the column of the heatmap? |
1065 | 1066 |
# -k a matrix may be splitted by rows, the value identifies which row-slice. |
1066 | 1067 |
# -... pass to `grid::viewport`, basically for defining the position of the viewport. |
... | ... |
@@ -1114,13 +1115,13 @@ setMethod(f = "draw_title", |
1114 | 1115 |
# Draw column annotations |
1115 | 1116 |
# |
1116 | 1117 |
# == param |
1117 |
-# -object a `Heatmap` object. |
|
1118 |
+# -object a `Heatmap-class` object. |
|
1118 | 1119 |
# -which are the annotations put on the top or bottom of the heatmap. |
1119 | 1120 |
# |
1120 | 1121 |
# == details |
1121 | 1122 |
# A viewport is created which contains column annotations. |
1122 | 1123 |
# |
1123 |
-# Since the column annotations is a `HeatmapAnnotation` object, the function |
|
1124 |
+# Since the column annotations is a `HeatmapAnnotation-class` object, the function |
|
1124 | 1125 |
# calls `draw,HeatmapAnnotation-method` to draw the annotations. |
1125 | 1126 |
# |
1126 | 1127 |
# This function is only for internal use. |
... | ... |
@@ -1153,7 +1154,7 @@ setMethod(f = "draw_annotation", |
1153 | 1154 |
# Width of each heatmap component |
1154 | 1155 |
# |
1155 | 1156 |
# == param |
1156 |
-# -object a `Heatmap` object. |
|
1157 |
+# -object a `Heatmap-class` object. |
|
1157 | 1158 |
# -k which components, see `Heatmap-class`. |
1158 | 1159 |
# |
1159 | 1160 |
# == detials |
... | ... |
@@ -1201,7 +1202,7 @@ setMethod(f = "component_width", |
1201 | 1202 |
# Height of each heatmap component |
1202 | 1203 |
# |
1203 | 1204 |
# == param |
1204 |
-# -object a `Heatmap` object. |
|
1205 |
+# -object a `Heatmap-class` object. |
|
1205 | 1206 |
# -k which components, see `Heatmap-class`. |
1206 | 1207 |
# |
1207 | 1208 |
# == detail |
... | ... |
@@ -1249,7 +1250,7 @@ setMethod(f = "component_height", |
1249 | 1250 |
# Set height of each heatmap component |
1250 | 1251 |
# |
1251 | 1252 |
# == param |
1252 |
-# -object a `Heatmap` object. |
|
1253 |
+# -object a `Heatmap-class` object. |
|
1253 | 1254 |
# -k which components, see `Heatmap-class`. |
1254 | 1255 |
# -v height of the component, a `grid::unit` object. |
1255 | 1256 |
# |
... | ... |
@@ -1294,13 +1295,13 @@ setMethod(f = "set_component_height", |
1294 | 1295 |
# Draw a single heatmap |
1295 | 1296 |
# |
1296 | 1297 |
# == param |
1297 |
-# -object a `Heatmap` object. |
|
1298 |
+# -object a `Heatmap-class` object. |
|
1298 | 1299 |
# -internal only for internal use. |
1299 | 1300 |
# -test only for testing |
1300 | 1301 |
# -... pass to `draw,HeatmapList-method`. |
1301 | 1302 |
# |
1302 | 1303 |
# == detail |
1303 |
-# The function creates a `HeatmapList` object which only contains a single heatmap |
|
1304 |
+# The function creates a `HeatmapList-class` object which only contains a single heatmap |
|
1304 | 1305 |
# and call `draw,HeatmapList-method` to make the final heatmap. |
1305 | 1306 |
# |
1306 | 1307 |
# == value |
... | ... |
@@ -1347,7 +1348,7 @@ setMethod(f = "draw", |
1347 | 1348 |
# Prepare the heatmap |
1348 | 1349 |
# |
1349 | 1350 |
# == param |
1350 |
-# -object a `Heatmap` object. |
|
1351 |
+# -object a `Heatmap-class` object. |
|
1351 | 1352 |
# -row_order orders of rows, pass to `make_row_cluster,Heatmap-method`. Because if more than one heatmaps |
1352 | 1353 |
# are drawn by columns, the order of some heatmap will be adjusted by one certain heatmap, this |
1353 | 1354 |
# argument is used to pass a pre-defined row order. |
... | ... |
@@ -1363,7 +1364,7 @@ setMethod(f = "draw", |
1363 | 1364 |
# This function is only for internal use. |
1364 | 1365 |
# |
1365 | 1366 |
# == value |
1366 |
-# A `Heatmap` object. |
|
1367 |
+# A `Heatmap-class` object. |
|
1367 | 1368 |
# |
1368 | 1369 |
# == author |
1369 | 1370 |
# Zuguang Gu <z.gu@dkfz.de> |
... | ... |
@@ -6,13 +6,13 @@ |
6 | 6 |
# |
7 | 7 |
# == details |
8 | 8 |
# A complex heatmap contains a list of annotations which represente as different graphics |
9 |
-# placed on rows and columns. The `HeatmapAnnotation` class is a category of single annotations |
|
10 |
-# by a list of `SingleAnnotation` objects with same number of rows or columns. |
|
9 |
+# placed on rows and columns. The `HeatmapAnnotation-class` is a category of single annotations |
|
10 |
+# by a list of `SingleAnnotation-class` objects with same number of rows or columns. |
|
11 | 11 |
# |
12 | 12 |
# == methods |
13 |
-# The `HeatmapAnnotation` class provides following methods: |
|
13 |
+# The `HeatmapAnnotation-class` provides following methods: |
|
14 | 14 |
# |
15 |
-# - `initialize,HeatmapAnnotation-method`: constructor method |
|
15 |
+# - `HeatmapAnnotation`: constructor method |
|
16 | 16 |
# - `draw,HeatmapAnnotation-method` |
17 | 17 |
# |
18 | 18 |
# == author |
... | ... |
@@ -38,10 +38,9 @@ HeatmapAnnotation = setClass("HeatmapAnnotation", |
38 | 38 |
# Constructor method for HeatmapAnnotation class |
39 | 39 |
# |
40 | 40 |
# == param |
41 |
-# -.Object a private object. |
|
42 | 41 |
# -df a data frame. Each column will be treated as a simple annotation. The data frame must have column names. |
43 | 42 |
# -name name of the heatmap annotation |
44 |
-# -col a list of colors which contains color mapping to columns in ``df``. See `initialize,SingleAnnotation-method` for how to set colors. |
|
43 |
+# -col a list of colors which contains color mapping to columns in ``df``. See `SingleAnnotation` for how to set colors. |
|
45 | 44 |
# -show_legend whether show legend for each column in ``df``. |
46 | 45 |
# -... functions which define complex annotations. Values should be named arguments. |
47 | 46 |
# -which are the annotations row annotations or column annotations? |
... | ... |
@@ -55,17 +54,17 @@ HeatmapAnnotation = setClass("HeatmapAnnotation", |
55 | 54 |
# defined by the function list. |
56 | 55 |
# |
57 | 56 |
# == value |
58 |
-# A `HeatmapAnnotation` object. |
|
57 |
+# A `HeatmapAnnotation-class` object. |
|
59 | 58 |
# |
60 | 59 |
# == author |
61 | 60 |
# Zuguang Gu <z.gu@dkfz.de> |
62 | 61 |
# |
63 |
-setMethod(f = "initialize", |
|
64 |
- signature = "HeatmapAnnotation", |
|
65 |
- definition = function(.Object, df, name, col, show_legend, ..., |
|
62 |
+HeatmapAnnotation = function(df, name, col, show_legend, ..., |
|
66 | 63 |
which = c("column", "row"), annotation_height = 1, annotation_width = 1, |
67 | 64 |
height = unit(1, "cm"), width = unit(1, "cm")) { |
68 | 65 |
|
66 |
+ .Object = new("HeatmapAnnotation") |
|
67 |
+ |
|
69 | 68 |
anno_list = list() |
70 | 69 |
which = match.arg(which)[1] |
71 | 70 |
|
... | ... |
@@ -154,13 +153,13 @@ setMethod(f = "initialize", |
154 | 153 |
.Object@size = size |
155 | 154 |
|
156 | 155 |
return(.Object) |
157 |
-}) |
|
156 |
+} |
|
158 | 157 |
|
159 | 158 |
# == title |
160 | 159 |
# Get a list of color mapping objects |
161 | 160 |
# |
162 | 161 |
# == param |
163 |
-# -object a `HeatmapAnnotation` object. |
|
162 |
+# -object a `HeatmapAnnotation-class` object. |
|
164 | 163 |
# |
165 | 164 |
# == details |
166 | 165 |
# Color mapping for visible simple annotations are only returned. |
... | ... |
@@ -168,7 +167,7 @@ setMethod(f = "initialize", |
168 | 167 |
# This function is only for internal use. |
169 | 168 |
# |
170 | 169 |
# == values |
171 |
-# A list of `ColorMapping` list or an empty list. |
|
170 |
+# A list of `ColorMapping-class` objects or an empty list. |
|
172 | 171 |
# |
173 | 172 |
# == author |
174 | 173 |
# Zuguang Gu <z.gu@dkfz.de> |
... | ... |
@@ -190,7 +189,7 @@ setMethod(f = "get_color_mapping_list", |
190 | 189 |
# Draw the heatmap annotations |
191 | 190 |
# |
192 | 191 |
# == param |
193 |
-# -object a `HeatmapAnnotation` object. |
|
192 |
+# -object a `HeatmapAnnotation-class` object. |
|
194 | 193 |
# -index a vector of order. |
195 | 194 |
# -... pass to `grid::viewport` which contains all annotations. |
196 | 195 |
# |
... | ... |
@@ -228,7 +227,7 @@ setMethod(f = "draw", |
228 | 227 |
# Print the Heatmap Annotation object |
229 | 228 |
# |
230 | 229 |
# == param |
231 |
-# -object a `HeatmapAnnotation` object. |
|
230 |
+# -object a `HeatmapAnnotation-class` object. |
|
232 | 231 |
# |
233 | 232 |
# == value |
234 | 233 |
# No value is returned. |
... | ... |
@@ -259,14 +258,14 @@ setMethod(f = "show", |
259 | 258 |
# Add two row annotations or add heatmaps as a heatmap list |
260 | 259 |
# |
261 | 260 |
# == param |
262 |
-# -object a `HeatmapAnnotation` object. |
|
263 |
-# -x a `Heatmap` object, a `HeatmapAnnotation` object or a `HeatmapList` object. |
|
261 |
+# -object a `HeatmapAnnotation-class` object. |
|
262 |
+# -x a `Heatmap-class` object, a `HeatmapAnnotation-class` object or a `HeatmapList-class` object. |
|
264 | 263 |
# |
265 | 264 |
# == details |
266 | 265 |
# There is a shortcut function ``+.HeatmapAnnotation``. |
267 | 266 |
# |
268 | 267 |
# == value |
269 |
-# A `HeatmapList` object. |
|
268 |
+# A `HeatmapList-class` object. |
|
270 | 269 |
# |
271 | 270 |
# == author |
272 | 271 |
# Zuguang Gu <z.gu@dkfz.de> |
... | ... |
@@ -41,7 +41,7 @@ |
41 | 41 |
# are placed one after the other. |
42 | 42 |
# |
43 | 43 |
# == methods |
44 |
-# The `HeatmapList` class provides following methods: |
|
44 |
+# The `HeatmapList-class` provides following methods: |
|
45 | 45 |
# |
46 | 46 |
# - `draw,HeatmapList-method`: draw the list of heatmaps and row annotations. |
47 | 47 |
# - `add_heatmap,HeatmapList-method` add heatmaps to the list of heatmaps. |
... | ... |
@@ -87,18 +87,31 @@ HeatmapList = setClass("HeatmapList", |
87 | 87 |
contains = "AdditiveUnit" |
88 | 88 |
) |
89 | 89 |
|
90 |
+# == title |
|
91 |
+# Constructor method for HeatmapList class |
|
92 |
+# |
|
93 |
+# == param |
|
94 |
+# -... arguments |
|
95 |
+# |
|
96 |
+# == detailes |
|
97 |
+# There is no public constructor method for the `HeatmapList-class`. |
|
98 |
+# |
|
99 |
+HeatmapList = function(...) { |
|
100 |
+ new("HeatmapList", ...) |
|
101 |
+} |
|
102 |
+ |
|
90 | 103 |
# == title |
91 | 104 |
# Add heatmaps and row annotations to the heatmap list |
92 | 105 |
# |
93 | 106 |
# == param |
94 |
-# -object a `HeatmapList` object. |
|
95 |
-# -x a `Heatmap` object or a `HeatmapAnnotation` object or a `HeatmapList` object. |
|
107 |
+# -object a `HeatmapList-class` object. |
|
108 |
+# -x a `Heatmap-class` object or a `HeatmapAnnotation-class` object or a `HeatmapList-class` object. |
|
96 | 109 |
# |
97 | 110 |
# == details |
98 | 111 |
# There is a shortcut function ``+.HeatmapList``. |
99 | 112 |
# |
100 | 113 |
# == value |
101 |
-# A `HeatmapList` object. |
|
114 |
+# A `HeatmapList-class` object. |
|
102 | 115 |
# |
103 | 116 |
# == author |
104 | 117 |
# Zuguang Gu <z.gu@dkfz.de> |
... | ... |
@@ -134,7 +147,7 @@ setMethod(f = "add_heatmap", |
134 | 147 |
# Make layout for the complete plot |
135 | 148 |
# |
136 | 149 |
# == param |
137 |
-# -object a `HeatmapList` object. |
|
150 |
+# -object a `HeatmapList-class` object. |
|
138 | 151 |
# -row_title title on the row. |
139 | 152 |
# -row_title_side will the title be put on the left or right of the heatmap. |
140 | 153 |
# -row_title_gp graphic parameters for drawing text. |
... | ... |
@@ -160,7 +173,7 @@ setMethod(f = "add_heatmap", |
160 | 173 |
# This function is only for internal use. |
161 | 174 |
# |
162 | 175 |
# == value |
163 |
-# A `HeatmapList` object in which settings for each heatmap are adjusted. |
|
176 |
+# A `HeatmapList-class` object in which settings for each heatmap are adjusted. |
|
164 | 177 |
# |
165 | 178 |
# == author |
166 | 179 |
# Zuguang Gu <z.gu@dkfz.de> |
... | ... |
@@ -486,7 +499,7 @@ setMethod(f = "make_layout", |
486 | 499 |
# Draw a list of heatmaps |
487 | 500 |
# |
488 | 501 |
# == param |
489 |
-# -object a `HeatmapList` object |
|
502 |
+# -object a `HeatmapList-class` object |
|
490 | 503 |
# -... pass to `make_layout,HeatmapList-method` |
491 | 504 |
# -newpage whether to create a new page |
492 | 505 |
# |
... | ... |
@@ -505,6 +518,10 @@ setMethod(f = "make_layout", |
505 | 518 |
setMethod(f = "draw", |
506 | 519 |
signature = "HeatmapList", |
507 | 520 |
definition = function(object, ..., newpage= TRUE) { |
521 |
+ |
|
522 |
+ if(! any(sapply(object@ht_list, inherits, "Heatmap"))) { |
|
523 |
+ stop("There should be at least one Heatmap in the heatmap list.") |
|
524 |
+ } |
|
508 | 525 |
|
509 | 526 |
if(newpage) { |
510 | 527 |
grid.newpage() |
... | ... |
@@ -530,7 +547,7 @@ setMethod(f = "draw", |
530 | 547 |
# Width of each heatmap list component |
531 | 548 |
# |
532 | 549 |
# == param |
533 |
-# -object a `HeatmapList` object. |
|
550 |
+# -object a `HeatmapList-class` object. |
|
534 | 551 |
# -k which components, see `HeatmapList-class`. |
535 | 552 |
# |
536 | 553 |
# == detail |
... | ... |
@@ -573,7 +590,7 @@ setMethod(f = "component_width", |
573 | 590 |
# Height of each heatmap list component |
574 | 591 |
# |
575 | 592 |
# == param |
576 |
-# -object a `HeatmapList` object. |
|
593 |
+# -object a `HeatmapList-class` object. |
|
577 | 594 |
# -k which components, see `HeatmapList-class`. |
578 | 595 |
# |
579 | 596 |
# == value |
... | ... |
@@ -614,7 +631,7 @@ setMethod(f = "component_height", |
614 | 631 |
# Draw the list of heatmaps |
615 | 632 |
# |
616 | 633 |
# == param |
617 |
-# -object a `HeatmapList` object |
|
634 |
+# -object a `HeatmapList-class` object |
|
618 | 635 |
# |
619 | 636 |
# == details |
620 | 637 |
# A viewport is created which contains heatmaps. |
... | ... |
@@ -750,7 +767,7 @@ setMethod(f = "draw_heatmap_list", |
750 | 767 |
# Draw heatmap list title |
751 | 768 |
# |
752 | 769 |
# == param |
753 |
-# -object a `HeatmapList` object |
|
770 |
+# -object a `HeatmapList-class` object |
|
754 | 771 |
# -which dendrogram on the row or on the column of the heatmap |
755 | 772 |
# |
756 | 773 |
# == details |
... | ... |
@@ -802,7 +819,7 @@ setMethod(f = "draw_title", |
802 | 819 |
# Draw legends for all heatmaps |
803 | 820 |
# |
804 | 821 |
# == param |
805 |
-# -object a `HeatmapList` object |
|
822 |
+# -object a `HeatmapList-class` object |
|
806 | 823 |
# |
807 | 824 |
# == details |
808 | 825 |
# A viewport is created which contains heatmap legends. |
... | ... |
@@ -859,7 +876,7 @@ setMethod(f = "draw_heatmap_legend", |
859 | 876 |
# Draw legends for all column annotations |
860 | 877 |
# |
861 | 878 |
# == param |
862 |
-# -object a `HeatmapList` object |
|
879 |
+# -object a `HeatmapList-class` object |
|
863 | 880 |
# -annotation_legend_list a list of self-defined legend, should be wrapped into `grid::grob` objects. |
864 | 881 |
# |
865 | 882 |
# == details |
... | ... |
@@ -919,7 +936,7 @@ setMethod(f = "draw_annotation_legend", |
919 | 936 |
# Size of the heatmap legend viewprot |
920 | 937 |
# |
921 | 938 |
# == param |
922 |
-# -object a `HeatmapList` object |
|
939 |
+# -object a `HeatmapList-class` object |
|
923 | 940 |
# |
924 | 941 |
# == detail |
925 | 942 |
# This function is only for internal use. |
... | ... |
@@ -957,7 +974,7 @@ setMethod(f = "heatmap_legend_size", |
957 | 974 |
# Size of the annotation legend viewport |
958 | 975 |
# |
959 | 976 |
# == param |
960 |
-# -object a `HeatmapList` object |
|
977 |
+# -object a `HeatmapList-class` object |
|
961 | 978 |
# -annotation_legend_list a list of self-defined legend, should be wrapped into `grid::grob` objects. |
962 | 979 |
# |
963 | 980 |
# == detail |
... | ... |
@@ -1091,7 +1108,7 @@ draw_legend = function(ColorMappingList, side = c("right", "left", "top", "botto |
1091 | 1108 |
# Draw a list of heatmaps with default parameters |
1092 | 1109 |
# |
1093 | 1110 |
# == param |
1094 |
-# -object a `HeatmapList` object. |
|
1111 |
+# -object a `HeatmapList-class` object. |
|
1095 | 1112 |
# |
1096 | 1113 |
# == details |
1097 | 1114 |
# Actually it calls `draw,HeatmapList-method`, but only with default parameters. If users want to customize the heatmap, |
... | ... |
@@ -9,18 +9,18 @@ |
9 | 9 |
# represent different classes of the data. The annotation can also be more complex |
10 | 10 |
# graphics, such as a boxplot that shows data distribution in corresponding row or column. |
11 | 11 |
# |
12 |
-# The `SingleAnnotation` class is used for storing data for a single annotation and provides |
|
12 |
+# The `SingleAnnotation-class` is used for storing data for a single annotation and provides |
|
13 | 13 |
# methods for drawing annotation grahics. |
14 | 14 |
# |
15 | 15 |
# == methods |
16 |
-# The `SingleAnnotation` class provides following methods: |
|
16 |
+# The `SingleAnnotation-class` provides following methods: |
|
17 | 17 |
# |
18 |
-# - `initialize,SingleAnnotation-method`: constructor method |
|
18 |
+# - `SingleAnnotation`: constructor method |
|
19 | 19 |
# - `draw,SingleAnnotation-method`: draw the single annotation. |
20 | 20 |
# |
21 | 21 |
# == seealso |
22 |
-# The `SingleAnnotation` class is always used internally. The public `HeatmapAnnotation` class |
|
23 |
-# contains a list of `SingleAnnotation` objects and is used to add annotation graphics on heatmaps. |
|
22 |
+# The `SingleAnnotation-class` is always used internally. The public `HeatmapAnnotation-class` |
|
23 |
+# contains a list of `SingleAnnotation-class` objects and is used to add annotation graphics on heatmaps. |
|
24 | 24 |
# |
25 | 25 |
# == author |
26 | 26 |
# Zuguang Gu <z.gu@dkfz.de> |
... | ... |
@@ -44,7 +44,6 @@ SingleAnnotation = setClass("SingleAnnotation", |
44 | 44 |
# Constructor method for SingleAnnotation class |
45 | 45 |
# |
46 | 46 |
# == param |
47 |
-# -.Object private object. |
|
48 | 47 |
# -name name for this annotation. |
49 | 48 |
# -value A vector of annotation. |
50 | 49 |
# -col colors corresponding to ``value``. If the mapping is discrete mapping, the value of ``col`` |
... | ... |
@@ -57,9 +56,9 @@ SingleAnnotation = setClass("SingleAnnotation", |
57 | 56 |
# |
58 | 57 |
# == details |
59 | 58 |
# The most simple annotation is one row or one column grids in which different colors |
60 |
-# represent different classes of the data. Here the function use `ColorMapping` class |
|
59 |
+# represent different classes of the data. Here the function use `ColorMapping-class` |
|
61 | 60 |
# to process such simple annotation. ``value`` and ``col`` arguments controls values and colors |
62 |
-# of the simple annotation and a `ColorMapping` object will be constructed based on ``value`` and ``col``. |
|
61 |
+# of the simple annotation and a `ColorMapping-class` object will be constructed based on ``value`` and ``col``. |
|
63 | 62 |
# |
64 | 63 |
# ``fun`` is used to construct a more complex annotation. Users can add any type of annotation graphics |
65 | 64 |
# by implementing a function. The only input argument of ``fun`` is a index |
... | ... |
@@ -70,16 +69,16 @@ SingleAnnotation = setClass("SingleAnnotation", |
70 | 69 |
# annotation or a column annotation. |
71 | 70 |
# |
72 | 71 |
# == value |
73 |
-# A `SingleAnnotation` object. |
|
72 |
+# A `SingleAnnotation-class` object. |
|
74 | 73 |
# |
75 | 74 |
# == author |
76 | 75 |
# Zuguang Gu <z.gu@dkfz.de> |
77 | 76 |
# |
78 |
-setMethod(f = "initialize", |
|
79 |
- signature = "SingleAnnotation", |
|
80 |
- definition = function(.Object, name, value, col, fun, which = c("column", "row"), |
|
77 |
+SingleAnnotation = function(name, value, col, fun, which = c("column", "row"), |
|
81 | 78 |
show_legend = TRUE) { |
82 | 79 |
|
80 |
+ .Object = new("SingleAnnotation") |
|
81 |
+ |
|
83 | 82 |
which = match.arg(which)[1] |
84 | 83 |
.Object@which = which |
85 | 84 |
|
... | ... |
@@ -125,13 +124,13 @@ setMethod(f = "initialize", |
125 | 124 |
} |
126 | 125 |
|
127 | 126 |
return(.Object) |
128 |
-}) |
|
127 |
+} |
|
129 | 128 |
|
130 | 129 |
# == title |
131 | 130 |
# Draw the single annotation |
132 | 131 |
# |
133 | 132 |
# == param |
134 |
-# -object a `SingleAnnotation` object. |
|
133 |
+# -object a `SingleAnnotation-class` object. |
|
135 | 134 |
# -index a vector of orders |
136 | 135 |
# |
137 | 136 |
# == details |
... | ... |
@@ -159,7 +158,7 @@ setMethod(f = "draw", |
159 | 158 |
# Print the SingleAnnotation object |
160 | 159 |
# |
161 | 160 |
# == param |
162 |
-# -object a `SingleAnnotation` object. |
|
161 |
+# -object a `SingleAnnotation-class` object. |
|
163 | 162 |
# |
164 | 163 |
# == value |
165 | 164 |
# No value is returned. |
... | ... |
@@ -1,7 +1,6 @@ |
1 | 1 |
\name{AdditiveUnit-class} |
2 | 2 |
\docType{class} |
3 | 3 |
\alias{AdditiveUnit-class} |
4 |
-\alias{AdditiveUnit} |
|
5 | 4 |
\title{ |
6 | 5 |
An internal class |
7 | 6 |
|
... | ... |
@@ -13,7 +12,7 @@ An internal class |
13 | 12 |
|
14 | 13 |
} |
15 | 14 |
\details{ |
16 |
-This class is a super class for \code{\link{Heatmap}}, \code{\link{HeatmapList}} and \code{\link{HeatmapAnnotation}} classes. And it is only for \code{+} generic method. |
|
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 for \code{+} generic method. |
|
17 | 16 |
|
18 | 17 |
|
19 | 18 |
} |
20 | 19 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,25 @@ |
1 |
+\name{AdditiveUnit} |
|
2 |
+\alias{AdditiveUnit} |
|
3 |
+\title{ |
|
4 |
+Constructor method for AdditiveUnit class |
|
5 |
+ |
|
6 |
+ |
|
7 |
+} |
|
8 |
+\description{ |
|
9 |
+Constructor method for AdditiveUnit class |
|
10 |
+ |
|
11 |
+ |
|
12 |
+} |
|
13 |
+\usage{ |
|
14 |
+AdditiveUnit(...) |
|
15 |
+} |
|
16 |
+\arguments{ |
|
17 |
+ |
|
18 |
+ \item{...}{arguments.} |
|
19 |
+ |
|
20 |
+} |
|
21 |
+\details{ |
|
22 |
+This method is not used in the package. |
|
23 |
+ |
|
24 |
+ |
|
25 |
+} |
... | ... |
@@ -1,7 +1,6 @@ |
1 | 1 |
\name{ColorMapping-class} |
2 | 2 |
\docType{class} |
3 | 3 |
\alias{ColorMapping-class} |
4 |
-\alias{ColorMapping} |
|
5 | 4 |
\title{ |
6 | 5 |
Class to map values to colors |
7 | 6 |
|
... | ... |
@@ -13,15 +12,15 @@ Class to map values to colors |
13 | 12 |
|
14 | 13 |
} |
15 | 14 |
\details{ |
16 |
-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. |
|
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. |
|
17 | 16 |
|
18 | 17 |
|
19 | 18 |
} |
20 | 19 |
\section{Methods}{ |
21 |
-The \code{\link{ColorMapping}} class provides following methods: |
|
20 |
+The \code{\link{ColorMapping-class}} provides following methods: |
|
22 | 21 |
|
23 | 22 |
\itemize{ |
24 |
- \item \code{\link{initialize,ColorMapping-method}}: contructor methods |
|
23 |
+ \item \code{\link{ColorMapping}}: contructor methods |
|
25 | 24 |
\item \code{\link{map,ColorMapping-method}}: mapping values to colors |
26 | 25 |
\item \code{\link{color_mapping_legend,ColorMapping-method}}: draw legend or get the size of the legend |
27 | 26 |
} |
... | ... |
@@ -33,6 +32,3 @@ Zuguang Gu <z.gu@dkfz.de> |
33 | 32 |
|
34 | 33 |
|
35 | 34 |
} |
36 |
-\examples{ |
|
37 |
-# see initialize,ColorMapping-method page |
|
38 |
-} |
39 | 35 |
similarity index 85% |
40 | 36 |
rename from man/initialize-ColorMapping-method.rd |
41 | 37 |
rename to man/ColorMapping.rd |
... | ... |
@@ -1,5 +1,5 @@ |
1 |
-\name{initialize-ColorMapping-method} |
|
2 |
-\alias{initialize,ColorMapping-method} |
|
1 |
+\name{ColorMapping} |
|
2 |
+\alias{ColorMapping} |
|
3 | 3 |
\title{ |
4 | 4 |
Constructor methods for ColorMapping class |
5 | 5 |
|
... | ... |
@@ -11,12 +11,11 @@ Constructor methods for ColorMapping class |
11 | 11 |
|
12 | 12 |
} |
13 | 13 |
\usage{ |
14 |
-\S4method{initialize}{ColorMapping}(.Object, name, colors = NULL, levels = NULL, |
|
14 |
+ColorMapping(name, colors = NULL, levels = NULL, |
|
15 | 15 |
col_fun = NULL, breaks = NULL) |
16 | 16 |
} |
17 | 17 |
\arguments{ |
18 | 18 |
|
19 |
- \item{.Object}{private object} |
|
20 | 19 |
\item{name}{name for this color mapping. It is used for drawing the title of the legend.} |
21 | 20 |
\item{colors}{discrete colors.} |
22 | 21 |
\item{levels}{levels that correspond to \code{colors}. If \code{colors} is name indexed, \code{levels} can be ignored.} |
... | ... |
@@ -30,7 +29,7 @@ Constructor methods for ColorMapping class |
30 | 29 |
|
31 | 30 |
} |
32 | 31 |
\value{ |
33 |
-A \code{\link{ColorMapping}} object. |
|
32 |
+A \code{\link{ColorMapping-class}} object. |
|
34 | 33 |
|
35 | 34 |
|
36 | 35 |
} |
... | ... |
@@ -1,7 +1,6 @@ |
1 | 1 |
\name{Heatmap-class} |
2 | 2 |
\docType{class} |
3 | 3 |
\alias{Heatmap-class} |
4 |
-\alias{Heatmap} |
|
5 | 4 |
\title{ |
6 | 5 |
Class for a single heatmap |
7 | 6 |
|
... | ... |
@@ -55,15 +54,15 @@ From left to right in row 5, the regions are: |
55 | 54 |
\item title on the right, graphics are drawn by \code{\link{draw_title,Heatmap-method}}. |
56 | 55 |
} |
57 | 56 |
|
58 |
-The \code{\link{Heatmap}} class is not responsible for heatmap legend and annotatino legends. The \code{\link{draw,Heatmap-method}} method will construct a \code{\link{HeatmapList}} object which only contains one single heatmap 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 annotatino 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. |
|
59 | 58 |
|
60 | 59 |
|
61 | 60 |
} |
62 | 61 |
\section{Methods}{ |
63 |
-The \code{\link{Heatmap}} class provides following methods: |
|
62 |
+The \code{\link{Heatmap-class}} provides following methods: |
|
64 | 63 |
|
65 | 64 |
\itemize{ |
66 |
- \item \code{\link{initialize,Heatmap-method}}: contructor method. |
|
65 |
+ \item \code{\link{Heatmap}}: contructor method. |
|
67 | 66 |
\item \code{\link{draw,Heatmap-method}}: draw a single heatmap. |
68 | 67 |
\item \code{\link{add_heatmap,Heatmap-method}} append heatmaps and row annotations to a list of heatmaps. |
69 | 68 |
} |
... | ... |
@@ -75,6 +74,3 @@ Zuguang Gu <z.gu@dkfz.de> |
75 | 74 |
|
76 | 75 |
|
77 | 76 |
} |
78 |
-\examples{ |
|
79 |
-# see initialize,Heatmap-method page |
|
80 |
-} |
81 | 77 |
similarity index 94% |
82 | 78 |
rename from man/initialize-Heatmap-method.rd |
83 | 79 |
rename to man/Heatmap.rd |
... | ... |
@@ -1,5 +1,5 @@ |
1 |
-\name{initialize-Heatmap-method} |
|
2 |
-\alias{initialize,Heatmap-method} |
|
1 |
+\name{Heatmap} |
|
2 |
+\alias{Heatmap} |
|
3 | 3 |
\title{ |
4 | 4 |
Constructor method for Heatmap class |
5 | 5 |
|
... | ... |
@@ -11,7 +11,7 @@ Constructor method for Heatmap class |
11 | 11 |
|
12 | 12 |
} |
13 | 13 |
\usage{ |
14 |
-\S4method{initialize}{Heatmap}(.Object, matrix, col, name, rect_gp = gpar(col = NA), |
|
14 |
+Heatmap(matrix, col, name, rect_gp = gpar(col = NA), |
|
15 | 15 |
cell_fun = function(i, j, x, y, width, height, fill) NULL, |
16 | 16 |
row_title = character(0), row_title_side = c("left", "right"), |
17 | 17 |
row_title_gp = gpar(fontsize = 14), column_title = character(0), |
... | ... |
@@ -24,9 +24,9 @@ Constructor method for Heatmap class |
24 | 24 |
column_hclust_side = c("top", "bottom"), column_hclust_height = unit(10, "mm"), |
25 | 25 |
show_column_hclust = TRUE, column_hclust_gp = gpar(), |
26 | 26 |
row_names_side = c("right", "left"), show_row_names = TRUE, |
27 |
- row_names_max_width = unit(2, "cm"), row_names_gp = gpar(fontsize = 12), |
|
27 |
+ row_names_max_width = unit(4, "cm"), row_names_gp = gpar(fontsize = 12), |
|
28 | 28 |
column_names_side = c("bottom", "top"), |
29 |
- show_column_names = TRUE, column_names_max_height = unit(2, "cm"), |
|
29 |
+ show_column_names = TRUE, column_names_max_height = unit(4, "cm"), |
|
30 | 30 |
column_names_gp = gpar(fontsize = 12), |
31 | 31 |
top_annotation = NULL, top_annotation_height = unit(1, "cm"), |
32 | 32 |
bottom_annotation = NULL, bottom_annotation_height = unit(1, "cm"), |
... | ... |
@@ -36,9 +36,8 @@ Constructor method for Heatmap class |
36 | 36 |
} |
37 | 37 |
\arguments{ |
38 | 38 |
|
39 |
- \item{.Object}{private object.} |
|
40 | 39 |
\item{matrix}{a matrix. Either numeric or character. If it is a simple vector, it will be converted to a one-column matrix.} |
41 |
- \item{col}{a vector of colors if the color mapping is discrete or a color mapping function if the matrix is continuous numbers. Pass to \code{\link{initialize,ColorMapping-method}}.} |
|
40 |
+ \item{col}{a vector of colors if the color mapping is discrete or a color mapping function if the matrix is continuous numbers. Pass to \code{\link{ColorMapping}}.} |
|
42 | 41 |
\item{name}{name of the heatmap. The name is used as the title of the heatmap legend.} |
43 | 42 |
\item{rect_gp}{graphic parameters for drawing rectangles (for heatmap body).} |
44 | 43 |
\item{cell_fun}{self-defined function to add graphics on each cell. Six parameters will be passed into this function: \code{i}, \code{j}, \code{x}, \code{y}, \code{width}, \code{height} which are row index, column index in \code{matrix}, coordinate of the middle points in the heatmap body viewport, and the width and height of the cell. } |
... | ... |
@@ -85,7 +84,7 @@ Constructor method for Heatmap class |
85 | 84 |
\details{ |
86 | 85 |
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. |
87 | 86 |
|
88 |
-Following methods can be applied on the \code{\link{Heatmap}} object: |
|
87 |
+Following methods can be applied on the \code{\link{Heatmap-class}} object: |
|
89 | 88 |
|
90 | 89 |
\itemize{ |
91 | 90 |
\item \code{\link{show,Heatmap-method}}: draw a single heatmap with default parameters |
... | ... |
@@ -93,12 +92,12 @@ Following methods can be applied on the \code{\link{Heatmap}} object: |
93 | 92 |
\item \code{\link{add_heatmap,Heatmap-method}} append heatmaps and row annotations to a list of heatmaps. |
94 | 93 |
} |
95 | 94 |
|
96 |
-The constructor function pretends to be a high-level graphic function because the \code{show} method of the \code{\link{Heatmap}} object actually plots the graphics. |
|
95 |
+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. |
|
97 | 96 |
|
98 | 97 |
|
99 | 98 |
} |
100 | 99 |
\value{ |
101 |
-A \code{\link{Heatmap}} object. |
|
100 |
+A \code{\link{Heatmap-class}} object. |
|
102 | 101 |
|
103 | 102 |
|
104 | 103 |
} |
... | ... |
@@ -1,7 +1,6 @@ |
1 | 1 |
\name{HeatmapAnnotation-class} |
2 | 2 |
\docType{class} |
3 | 3 |
\alias{HeatmapAnnotation-class} |
4 |
-\alias{HeatmapAnnotation} |
|
5 | 4 |
\title{ |
6 | 5 |
Class for heatmap annotations |
7 | 6 |
|
... | ... |
@@ -13,15 +12,15 @@ Class for heatmap annotations |
13 | 12 |
|
14 | 13 |
} |
15 | 14 |
\details{ |
16 |
-A complex heatmap contains a list of annotations which represente as different graphics placed on rows and columns. The \code{\link{HeatmapAnnotation}} class is a category of single annotations by a list of \code{\link{SingleAnnotation}} objects with same number of rows or columns. |
|
15 |
+A complex heatmap contains a list of annotations which represente as different graphics placed on rows and columns. The \code{\link{HeatmapAnnotation-class}} is a category of single annotations by a list of \code{\link{SingleAnnotation-class}} objects with same number of rows or columns. |
|
17 | 16 |
|
18 | 17 |
|
19 | 18 |
} |
20 | 19 |
\section{Methods}{ |
21 |
-The \code{\link{HeatmapAnnotation}} class provides following methods: |
|
20 |
+The \code{\link{HeatmapAnnotation-class}} provides following methods: |
|
22 | 21 |
|
23 | 22 |
\itemize{ |
24 |
- \item \code{\link{initialize,HeatmapAnnotation-method}}: constructor method |
|
23 |
+ \item \code{\link{HeatmapAnnotation}}: constructor method |
|
25 | 24 |
\item \code{\link{draw,HeatmapAnnotation-method}} |
26 | 25 |
} |
27 | 26 |
|
28 | 27 |
similarity index 83% |
29 | 28 |
rename from man/initialize-HeatmapAnnotation-method.rd |
30 | 29 |
rename to man/HeatmapAnnotation.rd |
... | ... |
@@ -1,5 +1,5 @@ |
1 |
-\name{initialize-HeatmapAnnotation-method} |
|
2 |
-\alias{initialize,HeatmapAnnotation-method} |
|
1 |
+\name{HeatmapAnnotation} |
|
2 |
+\alias{HeatmapAnnotation} |
|
3 | 3 |
\title{ |
4 | 4 |
Constructor method for HeatmapAnnotation class |
5 | 5 |
|
... | ... |
@@ -11,16 +11,15 @@ Constructor method for HeatmapAnnotation class |
11 | 11 |
|
12 | 12 |
} |
13 | 13 |
\usage{ |
14 |
-\S4method{initialize}{HeatmapAnnotation}(.Object, df, name, col, show_legend, ..., |
|
14 |
+HeatmapAnnotation(df, name, col, show_legend, ..., |
|
15 | 15 |
which = c("column", "row"), annotation_height = 1, annotation_width = 1, |
16 | 16 |
height = unit(1, "cm"), width = unit(1, "cm")) |
17 | 17 |
} |
18 | 18 |
\arguments{ |
19 | 19 |
|
20 |
- \item{.Object}{a private object.} |
|
21 | 20 |
\item{df}{a data frame. Each column will be treated as a simple annotation. The data frame must have column names.} |
22 | 21 |
\item{name}{name of the heatmap annotation} |
23 |
- \item{col}{a list of colors which contains color mapping to columns in \code{df}. See \code{\link{initialize,SingleAnnotation-method}} for how to set colors.} |
|
22 |
+ \item{col}{a list of colors which contains color mapping to columns in \code{df}. See \code{\link{SingleAnnotation}} for how to set colors.} |
|
24 | 23 |
\item{show_legend}{whether show legend for each column in \code{df}.} |
25 | 24 |
\item{...}{functions which define complex annotations. Values should be named arguments.} |
26 | 25 |
\item{which}{are the annotations row annotations or column annotations?} |
... | ... |
@@ -36,7 +35,7 @@ The simple annotations are defined by \code{df} and \code{col} arguments. Comple |
36 | 35 |
|
37 | 36 |
} |
38 | 37 |
\value{ |
39 |
-A \code{\link{HeatmapAnnotation}} object. |
|
38 |
+A \code{\link{HeatmapAnnotation-class}} object. |
|
40 | 39 |
|
41 | 40 |
|
42 | 41 |
} |
... | ... |
@@ -1,7 +1,6 @@ |
1 | 1 |
\name{HeatmapList-class} |
2 | 2 |
\docType{class} |
3 | 3 |
\alias{HeatmapList-class} |
4 |
-\alias{HeatmapList} |
|
5 | 4 |
\title{ |
6 | 5 |
Class for a list of heatmaps |
7 | 6 |
|
... | ... |
@@ -58,7 +57,7 @@ For the list of heatmaps which are placed at (5, 5) in the layout, the heatmaps |
58 | 57 |
|
59 | 58 |
} |
60 | 59 |
\section{Methods}{ |
61 |
-The \code{\link{HeatmapList}} class provides following methods: |
|
60 |
+The \code{\link{HeatmapList-class}} provides following methods: |
|
62 | 61 |
|
63 | 62 |
\itemize{ |
64 | 63 |
\item \code{\link{draw,HeatmapList-method}}: draw the list of heatmaps and row annotations. |
... | ... |
@@ -73,5 +72,20 @@ Zuguang Gu <z.gu@dkfz.de> |
73 | 72 |
|
74 | 73 |
} |
75 | 74 |
\examples{ |
76 |
-# see initialize,HeatmapList-method page |
|
75 |
+mat = matrix(rnorm(80, 2), 8, 10) |
|
76 |
+mat = rbind(mat, matrix(rnorm(40, -2), 4, 10)) |
|
77 |
+rownames(mat) = letters[1:12] |
|
78 |
+colnames(mat) = letters[1:10] |
|
79 |
+ |
|
80 |
+ht = Heatmap(mat) |
|
81 |
+ht + ht |
|
82 |
+ht + ht + ht |
|
83 |
+ |
|
84 |
+ht_list = ht + ht |
|
85 |
+ht + ht_list |
|
86 |
+ |
|
87 |
+ha = HeatmapAnnotation(points = anno_simple(1:12, type = "p", which = "row"), |
|
88 |
+ which = "row") |
|
89 |
+ht + ha |
|
90 |
+ht_list + ha |
|
77 | 91 |
} |
78 | 92 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,25 @@ |
1 |
+\name{HeatmapList} |
|
2 |
+\alias{HeatmapList} |
|
3 |
+\title{ |
|
4 |
+Constructor method for HeatmapList class |
|
5 |
+ |
|
6 |
+ |
|
7 |
+} |
|
8 |
+\description{ |
|
9 |
+Constructor method for HeatmapList class |
|
10 |
+ |
|
11 |
+ |
|
12 |
+} |
|
13 |
+\usage{ |
|
14 |
+HeatmapList(...) |
|
15 |
+} |
|
16 |
+\arguments{ |
|
17 |
+ |
|
18 |
+ \item{...}{arguments} |
|
19 |
+ |
|
20 |
+} |
|
21 |
+\section{Detailes}{ |
|
22 |
+There is no public constructor method for the \code{\link{HeatmapList-class}}. |
|
23 |
+ |
|
24 |
+ |
|
25 |
+} |
... | ... |
@@ -1,7 +1,6 @@ |
1 | 1 |
\name{SingleAnnotation-class} |
2 | 2 |
\docType{class} |
3 | 3 |
\alias{SingleAnnotation-class} |
4 |
-\alias{SingleAnnotation} |
|
5 | 4 |
\title{ |
6 | 5 |
Class for a single annotation |
7 | 6 |
|
... | ... |
@@ -15,22 +14,22 @@ Class for a single annotation |
15 | 14 |
\details{ |
16 | 15 |
A complex heatmap always has more than one annotations on rows and columns. 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. |
17 | 16 |
|
18 |
-The \code{\link{SingleAnnotation}} class is used for storing data for a single annotation and provides methods for drawing annotation grahics. |
|
17 |
+The \code{\link{SingleAnnotation-class}} is used for storing data for a single annotation and provides methods for drawing annotation grahics. |
|
19 | 18 |
|
20 | 19 |
|
21 | 20 |
} |
22 | 21 |
\section{Methods}{ |
23 |
-The \code{\link{SingleAnnotation}} class provides following methods: |
|
22 |
+The \code{\link{SingleAnnotation-class}} provides following methods: |
|
24 | 23 |
|
25 | 24 |
\itemize{ |
26 |
- \item \code{\link{initialize,SingleAnnotation-method}}: constructor method |
|
25 |
+ \item \code{\link{SingleAnnotation}}: constructor method |
|
27 | 26 |
\item \code{\link{draw,SingleAnnotation-method}}: draw the single annotation. |
28 | 27 |
} |
29 | 28 |
|
30 | 29 |
|
31 | 30 |
} |
32 | 31 |
\seealso{ |
33 |
-The \code{\link{SingleAnnotation}} class is always used internally. The public \code{\link{HeatmapAnnotation}} class contains a list of \code{\link{SingleAnnotation}} 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. |
|
34 | 33 |
|
35 | 34 |
|
36 | 35 |
} |
37 | 36 |
similarity index 84% |
38 | 37 |
rename from man/initialize-SingleAnnotation-method.rd |
39 | 38 |
rename to man/SingleAnnotation.rd |
... | ... |
@@ -1,5 +1,5 @@ |
1 |
-\name{initialize-SingleAnnotation-method} |
|
2 |
-\alias{initialize,SingleAnnotation-method} |
|
1 |
+\name{SingleAnnotation} |
|
2 |
+\alias{SingleAnnotation} |
|
3 | 3 |
\title{ |
4 | 4 |
Constructor method for SingleAnnotation class |
5 | 5 |
|
... | ... |
@@ -11,12 +11,11 @@ Constructor method for SingleAnnotation class |
11 | 11 |
|
12 | 12 |
} |
13 | 13 |
\usage{ |
14 |
-\S4method{initialize}{SingleAnnotation}(.Object, name, value, col, fun, which = c("column", "row"), |
|
14 |
+SingleAnnotation(name, value, col, fun, which = c("column", "row"), |
|
15 | 15 |
show_legend = TRUE) |
16 | 16 |
} |
17 | 17 |
\arguments{ |
18 | 18 |
|
19 |
- \item{.Object}{private object.} |
|
20 | 19 |
\item{name}{name for this annotation.} |
21 | 20 |
\item{value}{A vector of annotation.} |
22 | 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. } |
... | ... |
@@ -26,7 +25,7 @@ Constructor method for SingleAnnotation class |
26 | 25 |
|
27 | 26 |
} |
28 | 27 |
\details{ |
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}} object will be constructed based on \code{value} and \code{col}. |
|
28 |
+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}. |
|
30 | 29 |
|
31 | 30 |
\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 packcage, there are already several annotation graphic function generators: \code{\link{anno_points}}, \code{\link{anno_histogram}} and \code{\link{anno_boxplot}}. |
32 | 31 |
|
... | ... |
@@ -35,7 +34,7 @@ One thing that users should be careful is the difference of coordinates when the |
35 | 34 |
|
36 | 35 |
} |
37 | 36 |
\value{ |
38 |
-A \code{\link{SingleAnnotation}} object. |
|
37 |
+A \code{\link{SingleAnnotation-class}} object. |
|
39 | 38 |
|
40 | 39 |
|
41 | 40 |
} |
... | ... |
@@ -15,17 +15,17 @@ Add heatmaps or row annotations to a heatmap list |
15 | 15 |
} |
16 | 16 |
\arguments{ |
17 | 17 |
|
18 |
- \item{x}{a \code{\link{Heatmap}} object, a \code{\link{HeatmapAnnotation}} object or a \code{\link{HeatmapList}} object.} |
|
19 |
- \item{y}{a \code{\link{Heatmap}} object, a \code{\link{HeatmapAnnotation}} object or a \code{\link{HeatmapList}} object.} |
|
18 |
+ \item{x}{a \code{\link{Heatmap-class}} object, a \code{\link{HeatmapAnnotation-class}} object or a \code{\link{HeatmapList-class}} object.} |
|
19 |
+ \item{y}{a \code{\link{Heatmap-class}} object, a \code{\link{HeatmapAnnotation-class}} object or a \code{\link{HeatmapList-class}} object.} |
|
20 | 20 |
|
21 | 21 |
} |
22 | 22 |
\details{ |
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 values. |
|
23 |