Browse code

generate documentations by pkgdown

Zuguang Gu authored on 18/10/2019 11:34:02
Showing1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,210 +0,0 @@
1
-\name{Heatmap}
2
-\alias{Heatmap}
3
-\title{
4
-Constructor method for Heatmap class
5
-}
6
-\description{
7
-Constructor method for Heatmap class
8
-}
9
-\usage{
10
-Heatmap(matrix, col, name,
11
-    na_col = "grey",
12
-    color_space = "LAB",
13
-    rect_gp = gpar(col = NA),
14
-    border = NA,
15
-    cell_fun = NULL,
16
-    layer_fun = NULL,
17
-    jitter = FALSE,
18
-    
19
-    row_title = character(0),
20
-    row_title_side = c("left", "right"),
21
-    row_title_gp = gpar(fontsize = 14),
22
-    row_title_rot = switch(row_title_side[1], "left" = 90, "right" = 270),
23
-    column_title = character(0),
24
-    column_title_side = c("top", "bottom"),
25
-    column_title_gp = gpar(fontsize = 14),
26
-    column_title_rot = 0,
27
-    
28
-    cluster_rows = TRUE,
29
-    cluster_row_slices = TRUE,
30
-    clustering_distance_rows = "euclidean",
31
-    clustering_method_rows = "complete",
32
-    row_dend_side = c("left", "right"),
33
-    row_dend_width = unit(10, "mm"),
34
-    show_row_dend = TRUE,
35
-    row_dend_reorder = is.logical(cluster_rows) || is.function(cluster_rows),
36
-    row_dend_gp = gpar(),
37
-    cluster_columns = TRUE,
38
-    cluster_column_slices = TRUE,
39
-    clustering_distance_columns = "euclidean",
40
-    clustering_method_columns = "complete",
41
-    column_dend_side = c("top", "bottom"),
42
-    column_dend_height = unit(10, "mm"),
43
-    show_column_dend = TRUE,
44
-    column_dend_gp = gpar(),
45
-    column_dend_reorder = is.logical(cluster_columns) || is.function(cluster_columns),
46
-    
47
-    row_order = NULL,
48
-    column_order = NULL,
49
-    
50
-    row_labels = rownames(matrix),
51
-    row_names_side = c("right", "left"),
52
-    show_row_names = TRUE,
53
-    row_names_max_width = unit(6, "cm"),
54
-    row_names_gp = gpar(fontsize = 12),
55
-    row_names_rot = 0,
56
-    row_names_centered = FALSE,
57
-    column_labels = colnames(matrix),
58
-    column_names_side = c("bottom", "top"),
59
-    show_column_names = TRUE,
60
-    column_names_max_height = unit(6, "cm"),
61
-    column_names_gp = gpar(fontsize = 12),
62
-    column_names_rot = 90,
63
-    column_names_centered = FALSE,
64
-    
65
-    top_annotation = NULL,
66
-    bottom_annotation = NULL,
67
-    left_annotation = NULL,
68
-    right_annotation = NULL,
69
-    
70
-    km = 1,
71
-    split = NULL,
72
-    row_km = km,
73
-    row_km_repeats = 1,
74
-    row_split = split,
75
-    column_km = 1,
76
-    column_km_repeats = 1,
77
-    column_split = NULL,
78
-    gap = unit(1, "mm"),
79
-    row_gap = unit(1, "mm"),
80
-    column_gap = unit(1, "mm"),
81
-    show_parent_dend_line = ht_opt$show_parent_dend_line,
82
-    
83
-    heatmap_width = unit(1, "npc"),
84
-    width = NULL,
85
-    heatmap_height = unit(1, "npc"),
86
-    height = NULL,
87
-    
88
-    show_heatmap_legend = TRUE,
89
-    heatmap_legend_param = list(title = name),
90
-    
91
-    use_raster = (nrow(matrix) > 2000 && ncol(matrix) > 1) || (ncol(matrix) > 2000 && nrow(matrix) > 1),
92
-    raster_device = c("png", "jpeg", "tiff", "CairoPNG", "CairoJPEG", "CairoTIFF"),
93
-    raster_quality = 2,
94
-    raster_device_param = list(),
95
-    raster_resize = FALSE,
96
-    
97
-    post_fun = NULL)
98
-}
99
-\arguments{
100
-
101
-  \item{matrix}{A matrix. Either numeric or character. If it is a simple vector, it will be converted to a one-column matrix.}
102
-  \item{col}{A vector of colors if the color mapping is discrete or a color mapping  function if the matrix is continuous numbers (should be generated by \code{\link[circlize]{colorRamp2}}). If the matrix is continuous, the value can also be a vector of colors so that colors can be interpolated. Pass to \code{\link{ColorMapping}}. For more details and examples, please refer to \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#colors} .}
103
-  \item{name}{Name of the heatmap. By default the heatmap name is used as the title of the heatmap legend.}
104
-  \item{na_col}{Color for \code{NA} values.}
105
-  \item{rect_gp}{Graphic parameters for drawing rectangles (for heatmap body). The value should be specified by \code{\link[grid]{gpar}} and \code{fill} parameter is ignored.}
106
-  \item{color_space}{The color space in which colors are interpolated. Only used if \code{matrix} is numeric and  \code{col} is a vector of colors. Pass to \code{\link[circlize]{colorRamp2}}.}
107
-  \item{border}{Whether draw border. The value can be logical or a string of color.}
108
-  \item{cell_fun}{Self-defined function to add graphics on each cell. Seven parameters will be passed into  this function: \code{j}, \code{i}, \code{x}, \code{y}, \code{width}, \code{height}, \code{fill} which are column index, row index in \code{matrix}, coordinate of the cell, the width and height of the cell and the filled color. \code{x}, \code{y}, \code{width} and \code{height} are all \code{\link[grid]{unit}} objects.}
109
-  \item{layer_fun}{Similar as \code{cell_fun}, but is vectorized. Check \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#customize-the-heatmap-body} .}
110
-  \item{jitter}{Random shifts added to the matrix. The value can be logical or a single numeric value. It it is \code{TRUE}, random  values from uniform distribution between 0 and 1e-10 are generated. If it is a numeric value, the range for the uniform distribution is (0, \code{jitter}). It is mainly to solve the problem of "Error: node stack overflow" when there are too many identical rows/columns for plotting the dendrograms.}
111
-  \item{row_title}{Title on the row.}
112
-  \item{row_title_side}{Will the title be put on the left or right of the heatmap?}
113
-  \item{row_title_gp}{Graphic parameters for row title.}
114
-  \item{row_title_rot}{Rotation of row title. Only 0, 90, 270 are allowed to set.}
115
-  \item{column_title}{Title on the column.}
116
-  \item{column_title_side}{Will the title be put on the top or bottom of the heatmap?}
117
-  \item{column_title_gp}{Graphic parameters for column title.}
118
-  \item{column_title_rot}{Rotation of column titles. Only 0, 90, 270 are allowed to set.}
119
-  \item{cluster_rows}{If the value is a logical, it controls whether to make cluster on rows. The value can also be a \code{\link[stats]{hclust}} or a \code{\link[stats]{dendrogram}} which already contains clustering. Check \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#clustering} .}
120
-  \item{cluster_row_slices}{If rows are split into slices, whether perform clustering on the slice means?}
121
-  \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.}
122
-  \item{clustering_method_rows}{Method to perform hierarchical clustering, pass to \code{\link[stats]{hclust}}.}
123
-  \item{row_dend_side}{Should the row dendrogram be put on the left or right of the heatmap?}
124
-  \item{row_dend_width}{Width of the row dendrogram, should be a \code{\link[grid]{unit}} object.}
125
-  \item{show_row_dend}{Whether show row dendrogram?}
126
-  \item{row_dend_gp}{Graphic parameters for the dendrogram segments. If users already provide a \code{\link[stats]{dendrogram}} object with edges rendered, this argument will be ignored.}
127
-  \item{row_dend_reorder}{Apply reordering on row dendrograms. The value can be a logical value or a vector which contains weight  which is used to reorder rows. The reordering is applied by \code{\link[stats]{reorder.dendrogram}}.}
128
-  \item{cluster_columns}{Whether make cluster on columns? Same settings as \code{cluster_rows}.}
129
-  \item{cluster_column_slices}{If columns are split into slices, whether perform clustering on the slice means?}
130
-  \item{clustering_distance_columns}{Same setting as \code{clustering_distance_rows}.}
131
-  \item{clustering_method_columns}{Method to perform hierarchical clustering, pass to \code{\link[stats]{hclust}}.}
132
-  \item{column_dend_side}{Should the column dendrogram be put on the top or bottom of the heatmap?}
133
-  \item{column_dend_height}{height of the column cluster, should be a \code{\link[grid]{unit}} object.}
134
-  \item{show_column_dend}{Whether show column dendrogram?}
135
-  \item{column_dend_gp}{Graphic parameters for dendrogram segments. Same settings as \code{row_dend_gp}.}
136
-  \item{column_dend_reorder}{Apply reordering on column dendrograms. Same settings as \code{row_dend_reorder}.}
137
-  \item{row_order}{Order of rows. Manually setting row order turns off clustering.}
138
-  \item{column_order}{Order of column.}
139
-  \item{row_labels}{Optional row labels which are put as row names in the heatmap.}
140
-  \item{row_names_side}{Should the row names be put on the left or right of the heatmap?}
141
-  \item{show_row_names}{Whether show row names.}
142
-  \item{row_names_max_width}{Maximum width of row names viewport.}
143
-  \item{row_names_gp}{Graphic parameters for row names.}
144
-  \item{row_names_rot}{Rotation of row names.}
145
-  \item{row_names_centered}{Should row names put centered?}
146
-  \item{column_labels}{Optional column labels which are put as column names in the heatmap.}
147
-  \item{column_names_side}{Should the column names be put on the top or bottom of the heatmap?}
148
-  \item{column_names_max_height}{Maximum height of column names viewport.}
149
-  \item{show_column_names}{Whether show column names.}
150
-  \item{column_names_gp}{Graphic parameters for drawing text.}
151
-  \item{column_names_rot}{Rotation of column names.}
152
-  \item{column_names_centered}{Should column names put centered?}
153
-  \item{top_annotation}{A \code{\link{HeatmapAnnotation}} object.}
154
-  \item{bottom_annotation}{A \code{\link{HeatmapAnnotation}} object.}
155
-  \item{left_annotation}{It should be specified by \code{\link{rowAnnotation}}.}
156
-  \item{right_annotation}{it should be specified by \code{\link{rowAnnotation}}.}
157
-  \item{km}{Apply 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 slice, hierarchical clustering is still applied with parameters above.}
158
-  \item{split}{A vector or a data frame by which the rows are split. But if \code{cluster_rows} is a clustering object, \code{split} can be a single number indicating to split the dendrogram by \code{\link[stats]{cutree}}.}
159
-  \item{row_km}{Same as \code{km}.}
160
-  \item{row_km_repeats}{Number of k-means runs to get a consensus k-means clustering. Note if \code{row_km_repeats} is set to more than one, the final number of groups might be smaller than \code{row_km}, but this might means the original \code{row_km} is not a good choice.}
161
-  \item{row_split}{Same as \code{split}.}
162
-  \item{column_km}{K-means clustering on columns.}
163
-  \item{column_km_repeats}{Number of k-means runs to get a consensus k-means clustering. Similar as \code{row_km_repeats}.}
164
-  \item{column_split}{Split on columns. For heatmap splitting, please refer to \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#heatmap-split} .}
165
-  \item{gap}{Gap between row slices if the heatmap is split by rows. The value should be a \code{\link[grid]{unit}} object.}
166
-  \item{row_gap}{Same as \code{gap}.}
167
-  \item{column_gap}{Gap between column slices.}
168
-  \item{show_parent_dend_line}{When heatmap is split, whether to add a dashed line to mark parent dendrogram and children dendrograms?}
169
-  \item{width}{Width of the heatmap body.}
170
-  \item{height}{Height of the heatmap body.}
171
-  \item{heatmap_width}{Width of the whole heatmap (including heatmap components)}
172
-  \item{heatmap_height}{Height of the whole heatmap (including heatmap components). Check \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#size-of-the-heatmap} .}
173
-  \item{show_heatmap_legend}{Whether show heatmap legend?}
174
-  \item{heatmap_legend_param}{A list contains parameters for the heatmap legends. See \code{\link{color_mapping_legend,ColorMapping-method}} for all available parameters.}
175
-  \item{use_raster}{Whether render the heatmap body as a raster image. It helps to reduce file size when the matrix is huge. Note if \code{cell_fun} is set, \code{use_raster} is enforced to be \code{FALSE}.}
176
-  \item{raster_device}{Graphic device which is used to generate the raster image.}
177
-  \item{raster_quality}{A value set to larger than 1 will improve the quality of the raster image.}
178
-  \item{raster_device_param}{A list of further parameters for the selected graphic device. For raster image support, please check \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#heatmap-as-raster-image} .}
179
-  \item{raster_resize}{Whether resize the matrix to let the dimension of the matrix the same as the dimension of the raster image?}
180
-  \item{post_fun}{A function which will be executed after the heatmap list is drawn.}
181
-
182
-}
183
-\details{
184
-The initialization function only applies parameter checking and fill values to the slots with some validation.
185
-
186
-Following methods can be applied to the \code{\link{Heatmap-class}} object:
187
-
188
-\itemize{
189
-  \item \code{\link{show,Heatmap-method}}: draw a single heatmap with default parameters
190
-  \item \code{\link{draw,Heatmap-method}}: draw a single heatmap.
191
-  \item \code{+} or \code{\link[=pct_v_pct]{\%v\%}} append heatmaps and annotations to a list of heatmaps.
192
-}
193
-
194
-The constructor function pretends to be a high-level graphic function because the \code{show} method
195
-of the \code{\link{Heatmap-class}} object actually plots the graphics.
196
-}
197
-\seealso{
198
-\url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html}
199
-}
200
-\value{
201
-A \code{\link{Heatmap-class}} object.
202
-}
203
-\author{
204
-Zuguang Gu <z.gu@dkfz.de>
205
-}
206
-\examples{
207
-# There is no example
208
-NULL
209
-
210
-}
Browse code

add jitter argument to Heatmap()

Zuguang Gu authored on 28/09/2019 08:37:13
Showing1 changed files
... ...
@@ -14,6 +14,7 @@ Heatmap(matrix, col, name,
14 14
     border = NA,
15 15
     cell_fun = NULL,
16 16
     layer_fun = NULL,
17
+    jitter = FALSE,
17 18
     
18 19
     row_title = character(0),
19 20
     row_title_side = c("left", "right"),
... ...
@@ -106,6 +107,7 @@ Heatmap(matrix, col, name,
106 107
   \item{border}{Whether draw border. The value can be logical or a string of color.}
107 108
   \item{cell_fun}{Self-defined function to add graphics on each cell. Seven parameters will be passed into  this function: \code{j}, \code{i}, \code{x}, \code{y}, \code{width}, \code{height}, \code{fill} which are column index, row index in \code{matrix}, coordinate of the cell, the width and height of the cell and the filled color. \code{x}, \code{y}, \code{width} and \code{height} are all \code{\link[grid]{unit}} objects.}
108 109
   \item{layer_fun}{Similar as \code{cell_fun}, but is vectorized. Check \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#customize-the-heatmap-body} .}
110
+  \item{jitter}{Random shifts added to the matrix. The value can be logical or a single numeric value. It it is \code{TRUE}, random  values from uniform distribution between 0 and 1e-10 are generated. If it is a numeric value, the range for the uniform distribution is (0, \code{jitter}). It is mainly to solve the problem of "Error: node stack overflow" when there are too many identical rows/columns for plotting the dendrograms.}
109 111
   \item{row_title}{Title on the row.}
110 112
   \item{row_title_side}{Will the title be put on the left or right of the heatmap?}
111 113
   \item{row_title_gp}{Graphic parameters for row title.}
... ...
@@ -204,4 +206,5 @@ Zuguang Gu <z.gu@dkfz.de>
204 206
 \examples{
205 207
 # There is no example
206 208
 NULL
209
+
207 210
 }
Browse code

use pkgdown to build the doc site

Zuguang Gu authored on 24/09/2019 21:01:04
Showing1 changed files
... ...
@@ -204,5 +204,4 @@ Zuguang Gu <z.gu@dkfz.de>
204 204
 \examples{
205 205
 # There is no example
206 206
 NULL
207
-
208 207
 }
Browse code

gp in anno_text() supports fill and border

Zuguang Gu authored on 24/03/2019 22:20:59
Showing1 changed files
... ...
@@ -52,12 +52,14 @@ Heatmap(matrix, col, name,
52 52
     row_names_max_width = unit(6, "cm"),
53 53
     row_names_gp = gpar(fontsize = 12),
54 54
     row_names_rot = 0,
55
+    row_names_centered = FALSE,
55 56
     column_labels = colnames(matrix),
56 57
     column_names_side = c("bottom", "top"),
57 58
     show_column_names = TRUE,
58 59
     column_names_max_height = unit(6, "cm"),
59 60
     column_names_gp = gpar(fontsize = 12),
60 61
     column_names_rot = 90,
62
+    column_names_centered = FALSE,
61 63
     
62 64
     top_annotation = NULL,
63 65
     bottom_annotation = NULL,
... ...
@@ -67,10 +69,10 @@ Heatmap(matrix, col, name,
67 69
     km = 1,
68 70
     split = NULL,
69 71
     row_km = km,
70
-    row_km_repeats = 10,
72
+    row_km_repeats = 1,
71 73
     row_split = split,
72 74
     column_km = 1,
73
-    column_km_repeats = 10,
75
+    column_km_repeats = 1,
74 76
     column_split = NULL,
75 77
     gap = unit(1, "mm"),
76 78
     row_gap = unit(1, "mm"),
... ...
@@ -138,12 +140,14 @@ Heatmap(matrix, col, name,
138 140
   \item{row_names_max_width}{Maximum width of row names viewport.}
139 141
   \item{row_names_gp}{Graphic parameters for row names.}
140 142
   \item{row_names_rot}{Rotation of row names.}
143
+  \item{row_names_centered}{Should row names put centered?}
141 144
   \item{column_labels}{Optional column labels which are put as column names in the heatmap.}
142 145
   \item{column_names_side}{Should the column names be put on the top or bottom of the heatmap?}
143 146
   \item{column_names_max_height}{Maximum height of column names viewport.}
144 147
   \item{show_column_names}{Whether show column names.}
145 148
   \item{column_names_gp}{Graphic parameters for drawing text.}
146 149
   \item{column_names_rot}{Rotation of column names.}
150
+  \item{column_names_centered}{Should column names put centered?}
147 151
   \item{top_annotation}{A \code{\link{HeatmapAnnotation}} object.}
148 152
   \item{bottom_annotation}{A \code{\link{HeatmapAnnotation}} object.}
149 153
   \item{left_annotation}{It should be specified by \code{\link{rowAnnotation}}.}
Browse code

add consensus k-means

jokergoo authored on 22/03/2019 15:02:46
Showing1 changed files
... ...
@@ -67,8 +67,10 @@ Heatmap(matrix, col, name,
67 67
     km = 1,
68 68
     split = NULL,
69 69
     row_km = km,
70
+    row_km_repeats = 10,
70 71
     row_split = split,
71 72
     column_km = 1,
73
+    column_km_repeats = 10,
72 74
     column_split = NULL,
73 75
     gap = unit(1, "mm"),
74 76
     row_gap = unit(1, "mm"),
... ...
@@ -149,8 +151,10 @@ Heatmap(matrix, col, name,
149 151
   \item{km}{Apply 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 slice, hierarchical clustering is still applied with parameters above.}
150 152
   \item{split}{A vector or a data frame by which the rows are split. But if \code{cluster_rows} is a clustering object, \code{split} can be a single number indicating to split the dendrogram by \code{\link[stats]{cutree}}.}
151 153
   \item{row_km}{Same as \code{km}.}
154
+  \item{row_km_repeats}{Number of k-means runs to get a consensus k-means clustering. Note if \code{row_km_repeats} is set to more than one, the final number of groups might be smaller than \code{row_km}, but this might means the original \code{row_km} is not a good choice.}
152 155
   \item{row_split}{Same as \code{split}.}
153 156
   \item{column_km}{K-means clustering on columns.}
157
+  \item{column_km_repeats}{Number of k-means runs to get a consensus k-means clustering. Similar as \code{row_km_repeats}.}
154 158
   \item{column_split}{Split on columns. For heatmap splitting, please refer to \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#heatmap-split} .}
155 159
   \item{gap}{Gap between row slices if the heatmap is split by rows. The value should be a \code{\link[grid]{unit}} object.}
156 160
   \item{row_gap}{Same as \code{gap}.}
Browse code

set cluster_slice to FALSE for character matrix

Zuguang Gu authored on 18/01/2019 10:43:26
Showing1 changed files
... ...
@@ -196,4 +196,5 @@ Zuguang Gu <z.gu@dkfz.de>
196 196
 \examples{
197 197
 # There is no example
198 198
 NULL
199
+
199 200
 }
Browse code

add NEWs

Zuguang Gu authored on 30/12/2018 08:12:22
Showing1 changed files
... ...
@@ -196,5 +196,4 @@ Zuguang Gu <z.gu@dkfz.de>
196 196
 \examples{
197 197
 # There is no example
198 198
 NULL
199
-
200 199
 }
Browse code

add 'cluster_row_slices' and 'cluster_column_slices' in Heatmap()

jokergoo authored on 23/11/2018 10:48:52
Showing1 changed files
... ...
@@ -25,6 +25,7 @@ Heatmap(matrix, col, name,
25 25
     column_title_rot = 0,
26 26
     
27 27
     cluster_rows = TRUE,
28
+    cluster_row_slices = TRUE,
28 29
     clustering_distance_rows = "euclidean",
29 30
     clustering_method_rows = "complete",
30 31
     row_dend_side = c("left", "right"),
... ...
@@ -33,6 +34,7 @@ Heatmap(matrix, col, name,
33 34
     row_dend_reorder = is.logical(cluster_rows) || is.function(cluster_rows),
34 35
     row_dend_gp = gpar(),
35 36
     cluster_columns = TRUE,
37
+    cluster_column_slices = TRUE,
36 38
     clustering_distance_columns = "euclidean",
37 39
     clustering_method_columns = "complete",
38 40
     column_dend_side = c("top", "bottom"),
... ...
@@ -85,6 +87,7 @@ Heatmap(matrix, col, name,
85 87
     raster_device = c("png", "jpeg", "tiff", "CairoPNG", "CairoJPEG", "CairoTIFF"),
86 88
     raster_quality = 2,
87 89
     raster_device_param = list(),
90
+    raster_resize = FALSE,
88 91
     
89 92
     post_fun = NULL)
90 93
 }
... ...
@@ -108,6 +111,7 @@ Heatmap(matrix, col, name,
108 111
   \item{column_title_gp}{Graphic parameters for column title.}
109 112
   \item{column_title_rot}{Rotation of column titles. Only 0, 90, 270 are allowed to set.}
110 113
   \item{cluster_rows}{If the value is a logical, it controls whether to make cluster on rows. The value can also be a \code{\link[stats]{hclust}} or a \code{\link[stats]{dendrogram}} which already contains clustering. Check \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#clustering} .}
114
+  \item{cluster_row_slices}{If rows are split into slices, whether perform clustering on the slice means?}
111 115
   \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.}
112 116
   \item{clustering_method_rows}{Method to perform hierarchical clustering, pass to \code{\link[stats]{hclust}}.}
113 117
   \item{row_dend_side}{Should the row dendrogram be put on the left or right of the heatmap?}
... ...
@@ -116,6 +120,7 @@ Heatmap(matrix, col, name,
116 120
   \item{row_dend_gp}{Graphic parameters for the dendrogram segments. If users already provide a \code{\link[stats]{dendrogram}} object with edges rendered, this argument will be ignored.}
117 121
   \item{row_dend_reorder}{Apply reordering on row dendrograms. The value can be a logical value or a vector which contains weight  which is used to reorder rows. The reordering is applied by \code{\link[stats]{reorder.dendrogram}}.}
118 122
   \item{cluster_columns}{Whether make cluster on columns? Same settings as \code{cluster_rows}.}
123
+  \item{cluster_column_slices}{If columns are split into slices, whether perform clustering on the slice means?}
119 124
   \item{clustering_distance_columns}{Same setting as \code{clustering_distance_rows}.}
120 125
   \item{clustering_method_columns}{Method to perform hierarchical clustering, pass to \code{\link[stats]{hclust}}.}
121 126
   \item{column_dend_side}{Should the column dendrogram be put on the top or bottom of the heatmap?}
... ...
@@ -161,6 +166,7 @@ Heatmap(matrix, col, name,
161 166
   \item{raster_device}{Graphic device which is used to generate the raster image.}
162 167
   \item{raster_quality}{A value set to larger than 1 will improve the quality of the raster image.}
163 168
   \item{raster_device_param}{A list of further parameters for the selected graphic device. For raster image support, please check \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#heatmap-as-raster-image} .}
169
+  \item{raster_resize}{Whether resize the matrix to let the dimension of the matrix the same as the dimension of the raster image?}
164 170
   \item{post_fun}{A function which will be executed after the heatmap list is drawn.}
165 171
 
166 172
 }
Browse code

adjust color order on barplot

Zuguang Gu authored on 25/10/2018 19:37:48
Showing1 changed files
... ...
@@ -30,7 +30,7 @@ Heatmap(matrix, col, name,
30 30
     row_dend_side = c("left", "right"),
31 31
     row_dend_width = unit(10, "mm"),
32 32
     show_row_dend = TRUE,
33
-    row_dend_reorder = TRUE,
33
+    row_dend_reorder = is.logical(cluster_rows) || is.function(cluster_rows),
34 34
     row_dend_gp = gpar(),
35 35
     cluster_columns = TRUE,
36 36
     clustering_distance_columns = "euclidean",
... ...
@@ -39,7 +39,7 @@ Heatmap(matrix, col, name,
39 39
     column_dend_height = unit(10, "mm"),
40 40
     show_column_dend = TRUE,
41 41
     column_dend_gp = gpar(),
42
-    column_dend_reorder = TRUE,
42
+    column_dend_reorder = is.logical(cluster_columns) || is.function(cluster_columns),
43 43
     
44 44
     row_order = NULL,
45 45
     column_order = NULL,
... ...
@@ -71,6 +71,7 @@ Heatmap(matrix, col, name,
71 71
     gap = unit(1, "mm"),
72 72
     row_gap = unit(1, "mm"),
73 73
     column_gap = unit(1, "mm"),
74
+    show_parent_dend_line = ht_opt$show_parent_dend_line,
74 75
     
75 76
     heatmap_width = unit(1, "npc"),
76 77
     width = NULL,
... ...
@@ -149,6 +150,7 @@ Heatmap(matrix, col, name,
149 150
   \item{gap}{Gap between row slices if the heatmap is split by rows. The value should be a \code{\link[grid]{unit}} object.}
150 151
   \item{row_gap}{Same as \code{gap}.}
151 152
   \item{column_gap}{Gap between column slices.}
153
+  \item{show_parent_dend_line}{When heatmap is split, whether to add a dashed line to mark parent dendrogram and children dendrograms?}
152 154
   \item{width}{Width of the heatmap body.}
153 155
   \item{height}{Height of the heatmap body.}
154 156
   \item{heatmap_width}{Width of the whole heatmap (including heatmap components)}
Browse code

documentation checked

Zuguang Gu authored on 23/10/2018 19:59:12
Showing1 changed files
... ...
@@ -89,93 +89,96 @@ Heatmap(matrix, col, name,
89 89
 }
90 90
 \arguments{
91 91
 
92
-  \item{matrix}{a matrix. Either numeric or character. If it is a simple vector, it will be converted to a one-column matrix.}
93
-  \item{col}{a vector of colors if the color mapping is discrete or a color mapping  function if the matrix is continuous numbers (should be generated by \code{\link[circlize]{colorRamp2}}. 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}}.}
94
-  \item{name}{name of the heatmap. The name is used as the title of the heatmap legend.}
95
-  \item{na_col}{color for \code{NA} values.}
96
-  \item{rect_gp}{graphic parameters for drawing rectangles (for heatmap body).}
97
-  \item{color_space}{the color space in which colors are interpolated. Only used if \code{matrix} is numeric and  \code{col} is a vector of colors. Pass to \code{\link[circlize]{colorRamp2}}.}
98
-  \item{border}{whether draw border or the color of border.}
99
-  \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. \code{x}, \code{y}, \code{width} and \code{height} are all \code{\link[grid]{unit}} objects.}
100
-  \item{layer_fun}{similar as \code{cell_fun}, but is vectorized. }
101
-  \item{row_title}{title on row.}
102
-  \item{row_title_side}{will the title be put on the left or right of the heatmap?}
103
-  \item{row_title_gp}{graphic parameters for drawing text.}
104
-  \item{row_title_rot}{rotation of row titles. Only 0, 90, 270 are allowed to set.}
105
-  \item{column_title}{title on column.}
106
-  \item{column_title_side}{will the title be put on the top or bottom of the heatmap?}
107
-  \item{column_title_gp}{graphic parameters for drawing text.}
108
-  \item{column_title_rot}{rotation of column titles. Only 0, 90, 270 are allowed to set.}
109
-  \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.}
110
-  \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.}
111
-  \item{clustering_method_rows}{method to make cluster, pass to \code{\link[stats]{hclust}}.}
112
-  \item{row_dend_side}{should the row cluster be put on the left or right of the heatmap?}
113
-  \item{row_dend_width}{width of the row cluster, should be a \code{\link[grid]{unit}} object.}
114
-  \item{show_row_dend}{whether show row clusters. }
115
-  \item{row_dend_gp}{graphics parameters for drawing lines. If users already provide a \code{\link[stats]{dendrogram}} object with edges rendered, this argument will be ignored.}
116
-  \item{row_dend_reorder}{apply reordering on rows. The value can be a logical value or a vector which contains weight  which is used to reorder rows}
117
-  \item{cluster_columns}{whether make cluster on columns. Same settings as \code{cluster_rows}.}
118
-  \item{clustering_distance_columns}{same setting as \code{clustering_distance_rows}.}
119
-  \item{clustering_method_columns}{method to make cluster, pass to \code{\link[stats]{hclust}}.}
120
-  \item{column_dend_side}{should the column cluster be put on the top or bottom of the heatmap?}
92
+  \item{matrix}{A matrix. Either numeric or character. If it is a simple vector, it will be converted to a one-column matrix.}
93
+  \item{col}{A vector of colors if the color mapping is discrete or a color mapping  function if the matrix is continuous numbers (should be generated by \code{\link[circlize]{colorRamp2}}). If the matrix is continuous, the value can also be a vector of colors so that colors can be interpolated. Pass to \code{\link{ColorMapping}}. For more details and examples, please refer to \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#colors} .}
94
+  \item{name}{Name of the heatmap. By default the heatmap name is used as the title of the heatmap legend.}
95
+  \item{na_col}{Color for \code{NA} values.}
96
+  \item{rect_gp}{Graphic parameters for drawing rectangles (for heatmap body). The value should be specified by \code{\link[grid]{gpar}} and \code{fill} parameter is ignored.}
97
+  \item{color_space}{The color space in which colors are interpolated. Only used if \code{matrix} is numeric and  \code{col} is a vector of colors. Pass to \code{\link[circlize]{colorRamp2}}.}
98
+  \item{border}{Whether draw border. The value can be logical or a string of color.}
99
+  \item{cell_fun}{Self-defined function to add graphics on each cell. Seven parameters will be passed into  this function: \code{j}, \code{i}, \code{x}, \code{y}, \code{width}, \code{height}, \code{fill} which are column index, row index in \code{matrix}, coordinate of the cell, the width and height of the cell and the filled color. \code{x}, \code{y}, \code{width} and \code{height} are all \code{\link[grid]{unit}} objects.}
100
+  \item{layer_fun}{Similar as \code{cell_fun}, but is vectorized. Check \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#customize-the-heatmap-body} .}
101
+  \item{row_title}{Title on the row.}
102
+  \item{row_title_side}{Will the title be put on the left or right of the heatmap?}
103
+  \item{row_title_gp}{Graphic parameters for row title.}
104
+  \item{row_title_rot}{Rotation of row title. Only 0, 90, 270 are allowed to set.}
105
+  \item{column_title}{Title on the column.}
106
+  \item{column_title_side}{Will the title be put on the top or bottom of the heatmap?}
107
+  \item{column_title_gp}{Graphic parameters for column title.}
108
+  \item{column_title_rot}{Rotation of column titles. Only 0, 90, 270 are allowed to set.}
109
+  \item{cluster_rows}{If the value is a logical, it controls whether to make cluster on rows. The value can also be a \code{\link[stats]{hclust}} or a \code{\link[stats]{dendrogram}} which already contains clustering. Check \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#clustering} .}
110
+  \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.}
111
+  \item{clustering_method_rows}{Method to perform hierarchical clustering, pass to \code{\link[stats]{hclust}}.}
112
+  \item{row_dend_side}{Should the row dendrogram be put on the left or right of the heatmap?}
113
+  \item{row_dend_width}{Width of the row dendrogram, should be a \code{\link[grid]{unit}} object.}
114
+  \item{show_row_dend}{Whether show row dendrogram?}
115
+  \item{row_dend_gp}{Graphic parameters for the dendrogram segments. If users already provide a \code{\link[stats]{dendrogram}} object with edges rendered, this argument will be ignored.}
116
+  \item{row_dend_reorder}{Apply reordering on row dendrograms. The value can be a logical value or a vector which contains weight  which is used to reorder rows. The reordering is applied by \code{\link[stats]{reorder.dendrogram}}.}
117
+  \item{cluster_columns}{Whether make cluster on columns? Same settings as \code{cluster_rows}.}
118
+  \item{clustering_distance_columns}{Same setting as \code{clustering_distance_rows}.}
119
+  \item{clustering_method_columns}{Method to perform hierarchical clustering, pass to \code{\link[stats]{hclust}}.}
120
+  \item{column_dend_side}{Should the column dendrogram be put on the top or bottom of the heatmap?}
121 121
   \item{column_dend_height}{height of the column cluster, should be a \code{\link[grid]{unit}} object.}
122
-  \item{show_column_dend}{whether show column clusters.}
123
-  \item{column_dend_gp}{graphic parameters for drawling lines. Same settings as \code{row_dend_gp}.}
124
-  \item{column_dend_reorder}{apply reordering on columns. The value can be a logical value or a vector which contains weight  which is used to reorder columns}
125
-  \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}
126
-  \item{column_order}{order of column. It makes it easy to adjust column order for both matrix and column annotations.}
127
-  \item{row_labels}{row labels}
128
-  \item{row_names_side}{should the row names be put on the left or right of the heatmap?}
129
-  \item{show_row_names}{whether show row names.}
130
-  \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.}
131
-  \item{row_names_gp}{graphic parameters for drawing text.}
132
-  \item{row_names_rot}{rotation of row labels}
133
-  \item{column_labels}{column labels}
134
-  \item{column_names_side}{should the column names be put on the top or bottom of the heatmap?}
135
-  \item{column_names_max_height}{maximum height of column names viewport.}
136
-  \item{show_column_names}{whether show column names.}
137
-  \item{column_names_gp}{graphic parameters for drawing text.}
138
-  \item{column_names_rot}{rotation of column labels}
139
-  \item{top_annotation}{a \code{\link{HeatmapAnnotation}} object which contains a list of annotations.}
140
-  \item{bottom_annotation}{a \code{\link{HeatmapAnnotation}} object.}
141
-  \item{left_annotation}{should specified in \code{\link{rowAnnotation}}}
142
-  \item{right_annotation}{should shpecified in \code{\link{rowAnnotation}}}
143
-  \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.}
144
-  \item{split}{a vector or a data frame by which the rows are split. But if \code{cluster_rows} is a clustering object, \code{split} can be a single number indicating rows are to be split according to the split on the tree.}
145
-  \item{row_km}{row km}
146
-  \item{row_split}{row split}
147
-  \item{column_km}{column km}
148
-  \item{column_split}{column split}
149
-  \item{gap}{gap between row-slices if the heatmap is split by rows, should be \code{\link[grid]{unit}} object. If it is a vector, the order corresponds to top to bottom in the heatmap}
150
-  \item{row_gap}{row gap}
151
-  \item{column_gap}{column gap}
152
-  \item{width}{width of the heatmap body}
153
-  \item{height}{height of the heatmap body}
154
-  \item{heatmap_width}{width of the whole heatmap (including heatmap components)}
155
-  \item{heatmap_height}{height of the whole heatmap (including heatmap components)}
156
-  \item{show_heatmap_legend}{whether show heatmap legend?}
157
-  \item{heatmap_legend_param}{a list contains parameters for the heatmap legend. See \code{\link{color_mapping_legend,ColorMapping-method}} for all available parameters.}
158
-  \item{use_raster}{whether render the heatmap body as a raster image. It helps to reduce file size when the matrix is huge. Note if \code{cell_fun} is set, \code{use_raster} is enforced to be \code{FALSE}.}
159
-  \item{raster_device}{graphic device which is used to generate the raster image}
160
-  \item{raster_quality}{a value set to larger than 1 will improve the quality of the raster image.}
161
-  \item{raster_device_param}{a list of further parameters for the selected graphic device}
162
-  \item{post_fun}{a function which will be executed after the plot is drawn.}
122
+  \item{show_column_dend}{Whether show column dendrogram?}
123
+  \item{column_dend_gp}{Graphic parameters for dendrogram segments. Same settings as \code{row_dend_gp}.}
124
+  \item{column_dend_reorder}{Apply reordering on column dendrograms. Same settings as \code{row_dend_reorder}.}
125
+  \item{row_order}{Order of rows. Manually setting row order turns off clustering.}
126
+  \item{column_order}{Order of column.}
127
+  \item{row_labels}{Optional row labels which are put as row names in the heatmap.}
128
+  \item{row_names_side}{Should the row names be put on the left or right of the heatmap?}
129
+  \item{show_row_names}{Whether show row names.}
130
+  \item{row_names_max_width}{Maximum width of row names viewport.}
131
+  \item{row_names_gp}{Graphic parameters for row names.}
132
+  \item{row_names_rot}{Rotation of row names.}
133
+  \item{column_labels}{Optional column labels which are put as column names in the heatmap.}
134
+  \item{column_names_side}{Should the column names be put on the top or bottom of the heatmap?}
135
+  \item{column_names_max_height}{Maximum height of column names viewport.}
136
+  \item{show_column_names}{Whether show column names.}
137
+  \item{column_names_gp}{Graphic parameters for drawing text.}
138
+  \item{column_names_rot}{Rotation of column names.}
139
+  \item{top_annotation}{A \code{\link{HeatmapAnnotation}} object.}
140
+  \item{bottom_annotation}{A \code{\link{HeatmapAnnotation}} object.}
141
+  \item{left_annotation}{It should be specified by \code{\link{rowAnnotation}}.}
142
+  \item{right_annotation}{it should be specified by \code{\link{rowAnnotation}}.}
143
+  \item{km}{Apply 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 slice, hierarchical clustering is still applied with parameters above.}
144
+  \item{split}{A vector or a data frame by which the rows are split. But if \code{cluster_rows} is a clustering object, \code{split} can be a single number indicating to split the dendrogram by \code{\link[stats]{cutree}}.}
145
+  \item{row_km}{Same as \code{km}.}
146
+  \item{row_split}{Same as \code{split}.}
147
+  \item{column_km}{K-means clustering on columns.}
148
+  \item{column_split}{Split on columns. For heatmap splitting, please refer to \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#heatmap-split} .}
149
+  \item{gap}{Gap between row slices if the heatmap is split by rows. The value should be a \code{\link[grid]{unit}} object.}
150
+  \item{row_gap}{Same as \code{gap}.}
151
+  \item{column_gap}{Gap between column slices.}
152
+  \item{width}{Width of the heatmap body.}
153
+  \item{height}{Height of the heatmap body.}
154
+  \item{heatmap_width}{Width of the whole heatmap (including heatmap components)}
155
+  \item{heatmap_height}{Height of the whole heatmap (including heatmap components). Check \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#size-of-the-heatmap} .}
156
+  \item{show_heatmap_legend}{Whether show heatmap legend?}
157
+  \item{heatmap_legend_param}{A list contains parameters for the heatmap legends. See \code{\link{color_mapping_legend,ColorMapping-method}} for all available parameters.}
158
+  \item{use_raster}{Whether render the heatmap body as a raster image. It helps to reduce file size when the matrix is huge. Note if \code{cell_fun} is set, \code{use_raster} is enforced to be \code{FALSE}.}
159
+  \item{raster_device}{Graphic device which is used to generate the raster image.}
160
+  \item{raster_quality}{A value set to larger than 1 will improve the quality of the raster image.}
161
+  \item{raster_device_param}{A list of further parameters for the selected graphic device. For raster image support, please check \url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#heatmap-as-raster-image} .}
162
+  \item{post_fun}{A function which will be executed after the heatmap list is drawn.}
163 163
 
164 164
 }
165 165
 \details{
166
-The initialization function only applies parameter checking and fill values to the slots with proper values.
166
+The initialization function only applies parameter checking and fill values to the slots with some validation.
167 167
 
168
-Following methods can be applied on the \code{\link{Heatmap-class}} object:
168
+Following methods can be applied to the \code{\link{Heatmap-class}} object:
169 169
 
170 170
 \itemize{
171 171
   \item \code{\link{show,Heatmap-method}}: draw a single heatmap with default parameters
172 172
   \item \code{\link{draw,Heatmap-method}}: draw a single heatmap.
173
-  \item \code{+} or \code{\link[=pct_v_pct]{\%v\%}} append heatmaps and row annotations to a list of heatmaps.
173
+  \item \code{+} or \code{\link[=pct_v_pct]{\%v\%}} append heatmaps and annotations to a list of heatmaps.
174 174
 }
175 175
 
176 176
 The constructor function pretends to be a high-level graphic function because the \code{show} method
177 177
 of the \code{\link{Heatmap-class}} object actually plots the graphics.
178 178
 }
179
+\seealso{
180
+\url{https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html}
181
+}
179 182
 \value{
180 183
 A \code{\link{Heatmap-class}} object.
181 184
 }
Browse code

fix some bugs

Zuguang Gu authored on 19/10/2018 19:08:59
Showing1 changed files
... ...
@@ -185,4 +185,5 @@ Zuguang Gu <z.gu@dkfz.de>
185 185
 \examples{
186 186
 # There is no example
187 187
 NULL
188
+
188 189
 }
Browse code

update

Zuguang Gu authored on 17/10/2018 06:09:36
Showing1 changed files
... ...
@@ -185,5 +185,4 @@ Zuguang Gu <z.gu@dkfz.de>
185 185
 \examples{
186 186
 # There is no example
187 187
 NULL
188
-
189 188
 }
Browse code

update

Zuguang Gu authored on 16/10/2018 05:54:05
Showing1 changed files
... ...
@@ -80,7 +80,7 @@ Heatmap(matrix, col, name,
80 80
     show_heatmap_legend = TRUE,
81 81
     heatmap_legend_param = list(title = name),
82 82
     
83
-    use_raster = nrow(matrix) > 2000 || ncol(matrix) > 2000,
83
+    use_raster = (nrow(matrix) > 2000 && ncol(matrix) > 1) || (ncol(matrix) > 2000 && nrow(matrix) > 1),
84 84
     raster_device = c("png", "jpeg", "tiff", "CairoPNG", "CairoJPEG", "CairoTIFF"),
85 85
     raster_quality = 2,
86 86
     raster_device_param = list(),
Browse code

R CMD check passed

Zuguang Gu authored on 12/10/2018 19:19:48
Showing1 changed files
... ...
@@ -185,4 +185,5 @@ Zuguang Gu <z.gu@dkfz.de>
185 185
 \examples{
186 186
 # There is no example
187 187
 NULL
188
+
188 189
 }
Browse code

update

jokergoo authored on 12/10/2018 15:28:37
Showing1 changed files
... ...
@@ -68,19 +68,19 @@ Heatmap(matrix, col, name,
68 68
     row_split = split,
69 69
     column_km = 1,
70 70
     column_split = NULL,
71
-    gap = unit(0.5, "mm"),
72
-    row_gap = unit(0.5, "mm"),
73
-    column_gap = unit(0.5, "mm"),
71
+    gap = unit(1, "mm"),
72
+    row_gap = unit(1, "mm"),
73
+    column_gap = unit(1, "mm"),
74 74
     
75
-    width = unit(1, "npc"),
76
-    heatmap_body_width = NULL,
77
-    height = unit(1, "npc"),
78
-    heatmap_body_height = NULL,
75
+    heatmap_width = unit(1, "npc"),
76
+    width = NULL,
77
+    heatmap_height = unit(1, "npc"),
78
+    height = NULL,
79 79
     
80 80
     show_heatmap_legend = TRUE,
81 81
     heatmap_legend_param = list(title = name),
82 82
     
83
-    use_raster = nrow(matrix) > 5000,
83
+    use_raster = nrow(matrix) > 2000 || ncol(matrix) > 2000,
84 84
     raster_device = c("png", "jpeg", "tiff", "CairoPNG", "CairoJPEG", "CairoTIFF"),
85 85
     raster_quality = 2,
86 86
     raster_device_param = list(),
... ...
@@ -95,9 +95,9 @@ Heatmap(matrix, col, name,
95 95
   \item{na_col}{color for \code{NA} values.}
96 96
   \item{rect_gp}{graphic parameters for drawing rectangles (for heatmap body).}
97 97
   \item{color_space}{the color space in which colors are interpolated. Only used if \code{matrix} is numeric and  \code{col} is a vector of colors. Pass to \code{\link[circlize]{colorRamp2}}.}
98
-  \item{border}{border}
98
+  \item{border}{whether draw border or the color of border.}
99 99
   \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. \code{x}, \code{y}, \code{width} and \code{height} are all \code{\link[grid]{unit}} objects.}
100
-  \item{layer_fun}{layer fun}
100
+  \item{layer_fun}{similar as \code{cell_fun}, but is vectorized. }
101 101
   \item{row_title}{title on row.}
102 102
   \item{row_title_side}{will the title be put on the left or right of the heatmap?}
103 103
   \item{row_title_gp}{graphic parameters for drawing text.}
... ...
@@ -149,10 +149,10 @@ Heatmap(matrix, col, name,
149 149
   \item{gap}{gap between row-slices if the heatmap is split by rows, should be \code{\link[grid]{unit}} object. If it is a vector, the order corresponds to top to bottom in the heatmap}
150 150
   \item{row_gap}{row gap}
151 151
   \item{column_gap}{column gap}
152
-  \item{width}{width}
153
-  \item{height}{height}
154
-  \item{heatmap_body_width}{width}
155
-  \item{heatmap_body_height}{height}
152
+  \item{width}{width of the heatmap body}
153
+  \item{height}{height of the heatmap body}
154
+  \item{heatmap_width}{width of the whole heatmap (including heatmap components)}
155
+  \item{heatmap_height}{height of the whole heatmap (including heatmap components)}
156 156
   \item{show_heatmap_legend}{whether show heatmap legend?}
157 157
   \item{heatmap_legend_param}{a list contains parameters for the heatmap legend. See \code{\link{color_mapping_legend,ColorMapping-method}} for all available parameters.}
158 158
   \item{use_raster}{whether render the heatmap body as a raster image. It helps to reduce file size when the matrix is huge. Note if \code{cell_fun} is set, \code{use_raster} is enforced to be \code{FALSE}.}
... ...
@@ -163,15 +163,14 @@ Heatmap(matrix, col, name,
163 163
 
164 164
 }
165 165
 \details{
166
-The initialization function only applies parameter checking and fill values to each slot with proper ones.
167
-Then it will be ready for clustering and layout.
166
+The initialization function only applies parameter checking and fill values to the slots with proper values.
168 167
 
169 168
 Following methods can be applied on the \code{\link{Heatmap-class}} object:
170 169
 
171 170
 \itemize{
172 171
   \item \code{\link{show,Heatmap-method}}: draw a single heatmap with default parameters
173 172
   \item \code{\link{draw,Heatmap-method}}: draw a single heatmap.
174
-  \item \code{\link{add_heatmap,Heatmap-method}} append heatmaps and row annotations to a list of heatmaps.
173
+  \item \code{+} or \code{\link[=pct_v_pct]{\%v\%}} append heatmaps and row annotations to a list of heatmaps.
175 174
 }
176 175
 
177 176
 The constructor function pretends to be a high-level graphic function because the \code{show} method
... ...
@@ -186,5 +185,4 @@ Zuguang Gu <z.gu@dkfz.de>
186 185
 \examples{
187 186
 # There is no example
188 187
 NULL
189
-
190 188
 }
Browse code

vignette check passed

Zuguang Gu authored on 20/09/2018 22:09:48
Showing1 changed files
... ...
@@ -186,4 +186,5 @@ Zuguang Gu <z.gu@dkfz.de>
186 186
 \examples{
187 187
 # There is no example
188 188
 NULL
189
+
189 190
 }
Browse code

R CMD check passed

Zuguang Gu authored on 20/09/2018 12:48:08
Showing1 changed files
1 1
old mode 100755
2 2
new mode 100644
... ...
@@ -11,7 +11,10 @@ Heatmap(matrix, col, name,
11 11
     na_col = "grey",
12 12
     color_space = "LAB",
13 13
     rect_gp = gpar(col = NA),
14
+    border = NA,
14 15
     cell_fun = NULL,
16
+    layer_fun = NULL,
17
+    
15 18
     row_title = character(0),
16 19
     row_title_side = c("left", "right"),
17 20
     row_title_gp = gpar(fontsize = 14),
... ...
@@ -20,6 +23,7 @@ Heatmap(matrix, col, name,
20 23
     column_title_side = c("top", "bottom"),
21 24
     column_title_gp = gpar(fontsize = 14),
22 25
     column_title_rot = 0,
26
+    
23 27
     cluster_rows = TRUE,
24 28
     clustering_distance_rows = "euclidean",
25 29
     clustering_method_rows = "complete",
... ...
@@ -28,11 +32,6 @@ Heatmap(matrix, col, name,
28 32
     show_row_dend = TRUE,
29 33
     row_dend_reorder = TRUE,
30 34
     row_dend_gp = gpar(),
31
-    row_hclust_side = row_dend_side,
32
-    row_hclust_width = row_dend_width,
33
-    show_row_hclust = show_row_dend,
34
-    row_hclust_reorder = row_dend_reorder,
35
-    row_hclust_gp = row_dend_gp,
36 35
     cluster_columns = TRUE,
37 36
     clustering_distance_columns = "euclidean",
38 37
     clustering_method_columns = "complete",
... ...
@@ -41,37 +40,52 @@ Heatmap(matrix, col, name,
41 40
     show_column_dend = TRUE,
42 41
     column_dend_gp = gpar(),
43 42
     column_dend_reorder = TRUE,
44
-    column_hclust_side = column_dend_side,
45
-    column_hclust_height = column_dend_height,
46
-    show_column_hclust = show_column_dend,
47
-    column_hclust_gp = column_dend_gp,
48
-    column_hclust_reorder = column_dend_reorder,
43
+    
49 44
     row_order = NULL,
50 45
     column_order = NULL,
46
+    
47
+    row_labels = rownames(matrix),
51 48
     row_names_side = c("right", "left"),
52 49
     show_row_names = TRUE,
53
-    row_names_max_width = default_row_names_max_width(),
50
+    row_names_max_width = unit(6, "cm"),
54 51
     row_names_gp = gpar(fontsize = 12),
52
+    row_names_rot = 0,
53
+    column_labels = colnames(matrix),
55 54
     column_names_side = c("bottom", "top"),
56 55
     show_column_names = TRUE,
57
-    column_names_max_height = default_column_names_max_height(),
56
+    column_names_max_height = unit(6, "cm"),
58 57
     column_names_gp = gpar(fontsize = 12),
59
-    top_annotation = new("HeatmapAnnotation"),
60
-    top_annotation_height = top_annotation@size,
61
-    bottom_annotation = new("HeatmapAnnotation"),
62
-    bottom_annotation_height = bottom_annotation@size,
58
+    column_names_rot = 90,
59
+    
60
+    top_annotation = NULL,
61
+    bottom_annotation = NULL,
62
+    left_annotation = NULL,
63
+    right_annotation = NULL,
64
+    
63 65
     km = 1,
64
-    km_title = "cluster\%i",
65 66
     split = NULL,
66
-    gap = unit(1, "mm"),
67
-    combined_name_fun = function(x) paste(x, collapse = "/"),
68
-    width = NULL,
67
+    row_km = km,
68
+    row_split = split,
69
+    column_km = 1,
70
+    column_split = NULL,
71
+    gap = unit(0.5, "mm"),
72
+    row_gap = unit(0.5, "mm"),
73
+    column_gap = unit(0.5, "mm"),
74
+    
75
+    width = unit(1, "npc"),
76
+    heatmap_body_width = NULL,
77
+    height = unit(1, "npc"),
78
+    heatmap_body_height = NULL,
79
+    
69 80
     show_heatmap_legend = TRUE,
70 81
     heatmap_legend_param = list(title = name),
71
-    use_raster = FALSE,
82
+    
83
+    use_raster = nrow(matrix) > 5000,
72 84
     raster_device = c("png", "jpeg", "tiff", "CairoPNG", "CairoJPEG", "CairoTIFF"),
73 85
     raster_quality = 2,
74
-    raster_device_param = list())
86
+    raster_device_param = list(),
87
+    
88
+    post_fun = NULL)
75 89
 }
76 90
 \arguments{
77 91
 
... ...
@@ -81,7 +95,9 @@ Heatmap(matrix, col, name,
81 95
   \item{na_col}{color for \code{NA} values.}
82 96
   \item{rect_gp}{graphic parameters for drawing rectangles (for heatmap body).}
83 97
   \item{color_space}{the color space in which colors are interpolated. Only used if \code{matrix} is numeric and  \code{col} is a vector of colors. Pass to \code{\link[circlize]{colorRamp2}}.}
98
+  \item{border}{border}
84 99
   \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. \code{x}, \code{y}, \code{width} and \code{height} are all \code{\link[grid]{unit}} objects.}
100
+  \item{layer_fun}{layer fun}
85 101
   \item{row_title}{title on row.}
86 102
   \item{row_title_side}{will the title be put on the left or right of the heatmap?}
87 103
   \item{row_title_gp}{graphic parameters for drawing text.}
... ...
@@ -98,11 +114,6 @@ Heatmap(matrix, col, name,
98 114
   \item{show_row_dend}{whether show row clusters. }
99 115
   \item{row_dend_gp}{graphics parameters for drawing lines. If users already provide a \code{\link[stats]{dendrogram}} object with edges rendered, this argument will be ignored.}
100 116
   \item{row_dend_reorder}{apply reordering on rows. The value can be a logical value or a vector which contains weight  which is used to reorder rows}
101
-  \item{row_hclust_side}{deprecated, use \code{row_dend_side} instead}
102
-  \item{row_hclust_width}{deprecated, use \code{row_dend_width} instead}
103
-  \item{show_row_hclust}{deprecated, use \code{show_row_dend} instead}
104
-  \item{row_hclust_gp}{deprecated, use \code{row_dend_gp} instead}
105
-  \item{row_hclust_reorder}{deprecated, use \code{row_dend_reorder} instead}
106 117
   \item{cluster_columns}{whether make cluster on columns. Same settings as \code{cluster_rows}.}
107 118
   \item{clustering_distance_columns}{same setting as \code{clustering_distance_rows}.}
108 119
   \item{clustering_method_columns}{method to make cluster, pass to \code{\link[stats]{hclust}}.}
... ...
@@ -111,37 +122,44 @@ Heatmap(matrix, col, name,
111 122
   \item{show_column_dend}{whether show column clusters.}
112 123
   \item{column_dend_gp}{graphic parameters for drawling lines. Same settings as \code{row_dend_gp}.}
113 124
   \item{column_dend_reorder}{apply reordering on columns. The value can be a logical value or a vector which contains weight  which is used to reorder columns}
114
-  \item{column_hclust_side}{deprecated, use \code{column_dend_side} instead}
115
-  \item{column_hclust_height}{deprecated, use \code{column_dend_height} instead}
116
-  \item{show_column_hclust}{deprecated, use \code{show_column_dend} instead}
117
-  \item{column_hclust_gp}{deprecated, use \code{column_dend_gp} instead}
118
-  \item{column_hclust_reorder}{deprecated, use \code{column_dend_reorder} instead}
119 125
   \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}
120 126
   \item{column_order}{order of column. It makes it easy to adjust column order for both matrix and column annotations.}
127
+  \item{row_labels}{row labels}
121 128
   \item{row_names_side}{should the row names be put on the left or right of the heatmap?}
122 129
   \item{show_row_names}{whether show row names.}
123 130
   \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.}
124 131
   \item{row_names_gp}{graphic parameters for drawing text.}
132
+  \item{row_names_rot}{rotation of row labels}
133
+  \item{column_labels}{column labels}
125 134
   \item{column_names_side}{should the column names be put on the top or bottom of the heatmap?}
126 135
   \item{column_names_max_height}{maximum height of column names viewport.}
127 136
   \item{show_column_names}{whether show column names.}
128 137
   \item{column_names_gp}{graphic parameters for drawing text.}
138
+  \item{column_names_rot}{rotation of column labels}
129 139
   \item{top_annotation}{a \code{\link{HeatmapAnnotation}} object which contains a list of annotations.}
130
-  \item{top_annotation_height}{total height of the column annotations on the top.}
131 140
   \item{bottom_annotation}{a \code{\link{HeatmapAnnotation}} object.}
132
-  \item{bottom_annotation_height}{total height of the column annotations on the bottom.}
141
+  \item{left_annotation}{should specified in \code{\link{rowAnnotation}}}
142
+  \item{right_annotation}{should shpecified in \code{\link{rowAnnotation}}}
133 143
   \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.}
134
-  \item{km_title}{row title for each cluster when \code{km} is set. It must a text with format of ".*\%i.*" where "\%i" is replaced by the index of the cluster.}
135 144
   \item{split}{a vector or a data frame by which the rows are split. But if \code{cluster_rows} is a clustering object, \code{split} can be a single number indicating rows are to be split according to the split on the tree.}
145
+  \item{row_km}{row km}
146
+  \item{row_split}{row split}
147
+  \item{column_km}{column km}
148
+  \item{column_split}{column split}
136 149
   \item{gap}{gap between row-slices if the heatmap is split by rows, should be \code{\link[grid]{unit}} object. If it is a vector, the order corresponds to top to bottom in the heatmap}
137
-  \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}.}
138
-  \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.}
150
+  \item{row_gap}{row gap}
151
+  \item{column_gap}{column gap}
152
+  \item{width}{width}
153
+  \item{height}{height}
154
+  \item{heatmap_body_width}{width}
155
+  \item{heatmap_body_height}{height}
139 156
   \item{show_heatmap_legend}{whether show heatmap legend?}
140 157
   \item{heatmap_legend_param}{a list contains parameters for the heatmap legend. See \code{\link{color_mapping_legend,ColorMapping-method}} for all available parameters.}
141 158
   \item{use_raster}{whether render the heatmap body as a raster image. It helps to reduce file size when the matrix is huge. Note if \code{cell_fun} is set, \code{use_raster} is enforced to be \code{FALSE}.}
142 159
   \item{raster_device}{graphic device which is used to generate the raster image}
143 160
   \item{raster_quality}{a value set to larger than 1 will improve the quality of the raster image.}
144 161
   \item{raster_device_param}{a list of further parameters for the selected graphic device}
162
+  \item{post_fun}{a function which will be executed after the plot is drawn.}
145 163
 
146 164
 }
147 165
 \details{
... ...
@@ -166,76 +184,6 @@ A \code{\link{Heatmap-class}} object.
166 184
 Zuguang Gu <z.gu@dkfz.de>
167 185
 }
168 186
 \examples{
169
-mat = matrix(rnorm(80, 2), 8, 10)
170
-mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
171
-rownames(mat) = letters[1:12]
172
-colnames(mat) = letters[1:10]
173
-
174
-require(circlize)
175
-
176
-Heatmap(mat)
177
-Heatmap(mat, col = colorRamp2(c(-3, 0, 3), c("green", "white", "red")))
178
-Heatmap(mat, name = "test")
179
-Heatmap(mat, column_title = "blablabla")
180
-Heatmap(mat, row_title = "blablabla")
181
-Heatmap(mat, column_title = "blablabla", column_title_side = "bottom")
182
-Heatmap(mat, column_title = "blablabla", column_title_gp = gpar(fontsize = 20, 
183
-    fontface = "bold"))
184
-Heatmap(mat, cluster_rows = FALSE)
185
-Heatmap(mat, clustering_distance_rows = "pearson")
186
-Heatmap(mat, clustering_distance_rows = function(x) dist(x))
187
-Heatmap(mat, clustering_distance_rows = function(x, y) 1 - cor(x, y))
188
-Heatmap(mat, clustering_method_rows = "single")
189
-Heatmap(mat, row_dend_side = "right")
190
-Heatmap(mat, row_dend_width = unit(1, "cm"))
191
-Heatmap(mat, row_names_side = "left", row_dend_side = "right", 
192
-    column_names_side = "top", column_dend_side = "bottom")
193
-Heatmap(mat, show_row_names = FALSE)
194
-
195
-mat2 = mat
196
-rownames(mat2) = NULL
197
-colnames(mat2) = NULL
198
-Heatmap(mat2)
199
-
200
-Heatmap(mat, row_names_gp = gpar(fontsize = 20))
201
-Heatmap(mat, km = 2)
202
-Heatmap(mat, split = rep(c("A", "B"), 6))
203
-Heatmap(mat, split = data.frame(rep(c("A", "B"), 6), rep(c("C", "D"), each = 6)))
204
-Heatmap(mat, split = data.frame(rep(c("A", "B"), 6), rep(c("C", "D"), each = 6)), 
205
-    combined_name_fun = function(x) paste(x, collapse = "\n"))
206
-
207
-annotation = HeatmapAnnotation(df = data.frame(type = c(rep("A", 6), rep("B", 6))))
208
-Heatmap(mat, top_annotation = annotation)
209
-
210
-annotation = HeatmapAnnotation(df = data.frame(type1 = rep(c("A", "B"), 6), 
211
-    type2 = rep(c("C", "D"), each = 6)))
212
-Heatmap(mat, bottom_annotation = annotation)
213
-
214
-annotation = data.frame(value = rnorm(10))
215
-annotation = HeatmapAnnotation(df = annotation)
216
-Heatmap(mat, top_annotation = annotation)
217
-
218
-annotation = data.frame(value = rnorm(10))
219
-value = 1:10
220
-ha = HeatmapAnnotation(df = annotation, points = anno_points(value), 
221
-    annotation_height = c(1, 2))
222
-Heatmap(mat, top_annotation = ha, top_annotation_height = unit(2, "cm"), 
223
-    bottom_annotation = ha)
224
-
225
-# character matrix
226
-mat3 = matrix(sample(letters[1:6], 100, replace = TRUE), 10, 10)
227
-rownames(mat3) = {x = letters[1:10]; x[1] = "aaaaaaaaaaaaaaaaaaaaaaa";x}
228
-Heatmap(mat3, rect_gp = gpar(col = "white"))
229
-
230
-mat = matrix(1:9, 3, 3)
231
-rownames(mat) = letters[1:3]
232
-colnames(mat) = letters[1:3]
233
-
234
-Heatmap(mat, rect_gp = gpar(col = "white"), 
235
-    cell_fun = function(i, j, x, y, width, height, fill) {
236
-        grid.text(mat[i, j], x = x, y = y)
237
-    },
238
-    cluster_rows = FALSE, cluster_columns = FALSE, row_names_side = "left", 
239
-    column_names_side = "top")
240
-
187
+# There is no example
188
+NULL
241 189
 }
Browse code

regenerate docs

Zuguang Gu authored on 17/10/2017 21:31:32
Showing1 changed files
... ...
@@ -70,7 +70,7 @@ Heatmap(matrix, col, name,
70 70
     heatmap_legend_param = list(title = name),
71 71
     use_raster = FALSE,
72 72
     raster_device = c("png", "jpeg", "tiff", "CairoPNG", "CairoJPEG", "CairoTIFF"),
73
-    raster_quality = 1,
73
+    raster_quality = 2,
74 74
     raster_device_param = list())
75 75
 }
76 76
 \arguments{
Browse code

merge by copy paste

Zuguang Gu authored on 17/10/2017 20:55:32
Showing1 changed files
... ...
@@ -11,11 +11,7 @@ Heatmap(matrix, col, name,
11 11
     na_col = "grey",
12 12
     color_space = "LAB",
13 13
     rect_gp = gpar(col = NA),
14
-<<<<<<< HEAD
15 14
     cell_fun = NULL,
16
-=======
17
-    cell_fun = function(j, i, x, y, width, height, fill) NULL,
18
->>>>>>> bioc/master
19 15
     row_title = character(0),
20 16
     row_title_side = c("left", "right"),
21 17
     row_title_gp = gpar(fontsize = 14),
... ...
@@ -54,19 +50,11 @@ Heatmap(matrix, col, name,
54 50
     column_order = NULL,
55 51
     row_names_side = c("right", "left"),
56 52
     show_row_names = TRUE,
57
-<<<<<<< HEAD
58 53
     row_names_max_width = default_row_names_max_width(),
59 54
     row_names_gp = gpar(fontsize = 12),
60 55
     column_names_side = c("bottom", "top"),
61 56
     show_column_names = TRUE,
62 57
     column_names_max_height = default_column_names_max_height(),
63
-=======
64
-    row_names_max_width = unit(4, "cm"),
65
-    row_names_gp = gpar(fontsize = 12),
66
-    column_names_side = c("bottom", "top"),
67
-    show_column_names = TRUE,
68
-    column_names_max_height = unit(4, "cm"),
69
->>>>>>> bioc/master
70 58
     column_names_gp = gpar(fontsize = 12),
71 59
     top_annotation = new("HeatmapAnnotation"),
72 60
     top_annotation_height = top_annotation@size,
... ...
@@ -79,11 +67,7 @@ Heatmap(matrix, col, name,
79 67
     combined_name_fun = function(x) paste(x, collapse = "/"),
80 68
     width = NULL,
81 69
     show_heatmap_legend = TRUE,
82
-<<<<<<< HEAD
83 70
     heatmap_legend_param = list(title = name),
84
-=======
85
-    heatmap_legend_param = list(title = name, color_bar = "discrete"),
86
->>>>>>> bioc/master
87 71
     use_raster = FALSE,
88 72
     raster_device = c("png", "jpeg", "tiff", "CairoPNG", "CairoJPEG", "CairoTIFF"),
89 73
     raster_quality = 1,
... ...
@@ -147,22 +131,14 @@ Heatmap(matrix, col, name,
147 131
   \item{bottom_annotation}{a \code{\link{HeatmapAnnotation}} object.}
148 132
   \item{bottom_annotation_height}{total height of the column annotations on the bottom.}
149 133
   \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.}
150
-<<<<<<< HEAD
151 134
   \item{km_title}{row title for each cluster when \code{km} is set. It must a text with format of ".*\%i.*" where "\%i" is replaced by the index of the cluster.}
152
-=======
153
-  \item{km_title}{row title for each cluster when \code{km} is set. It must a text with format of "*\%i*" where "\%i" is replaced by the index of the cluster.}
154
->>>>>>> bioc/master
155 135
   \item{split}{a vector or a data frame by which the rows are split. But if \code{cluster_rows} is a clustering object, \code{split} can be a single number indicating rows are to be split according to the split on the tree.}
156 136
   \item{gap}{gap between row-slices if the heatmap is split by rows, should be \code{\link[grid]{unit}} object. If it is a vector, the order corresponds to top to bottom in the heatmap}
157 137
   \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}.}
158 138
   \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.}
159 139
   \item{show_heatmap_legend}{whether show heatmap legend?}
160 140
   \item{heatmap_legend_param}{a list contains parameters for the heatmap legend. See \code{\link{color_mapping_legend,ColorMapping-method}} for all available parameters.}
161
-<<<<<<< HEAD
162 141
   \item{use_raster}{whether render the heatmap body as a raster image. It helps to reduce file size when the matrix is huge. Note if \code{cell_fun} is set, \code{use_raster} is enforced to be \code{FALSE}.}
163
-=======
164
-  \item{use_raster}{whether render the heatmap body as a raster image. It helps to reduce file size when the matrix is huge.}
165
->>>>>>> bioc/master
166 142
   \item{raster_device}{graphic device which is used to generate the raster image}
167 143
   \item{raster_quality}{a value set to larger than 1 will improve the quality of the raster image.}
168 144
   \item{raster_device_param}{a list of further parameters for the selected graphic device}
Zuguang Gu authored on 17/10/2017 19:44:53
Showing0 changed files
Browse code

decorate_*() functions returns to the viewport where they are called

Zuguang Gu authored on 19/07/2017 14:06:45
Showing1 changed files
... ...
@@ -67,7 +67,7 @@ Heatmap(matrix, col, name,
67 67
     combined_name_fun = function(x) paste(x, collapse = "/"),
68 68
     width = NULL,
69 69
     show_heatmap_legend = TRUE,
70
-    heatmap_legend_param = list(title = name, color_bar = "discrete"),
70
+    heatmap_legend_param = list(title = name),
71 71
     use_raster = FALSE,
72 72
     raster_device = c("png", "jpeg", "tiff", "CairoPNG", "CairoJPEG", "CairoTIFF"),
73 73
     raster_quality = 1,
... ...
@@ -131,7 +131,7 @@ Heatmap(matrix, col, name,
131 131
   \item{bottom_annotation}{a \code{\link{HeatmapAnnotation}} object.}
132 132
   \item{bottom_annotation_height}{total height of the column annotations on the bottom.}
133 133
   \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.}
134
-  \item{km_title}{row title for each cluster when \code{km} is set. It must a text with format of "*\%i*" where "\%i" is replaced by the index of the cluster.}
134
+  \item{km_title}{row title for each cluster when \code{km} is set. It must a text with format of ".*\%i.*" where "\%i" is replaced by the index of the cluster.}
135 135
   \item{split}{a vector or a data frame by which the rows are split. But if \code{cluster_rows} is a clustering object, \code{split} can be a single number indicating rows are to be split according to the split on the tree.}
136 136
   \item{gap}{gap between row-slices if the heatmap is split by rows, should be \code{\link[grid]{unit}} object. If it is a vector, the order corresponds to top to bottom in the heatmap}
137 137
   \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}.}
Browse code

change default value of row names width and column names height

Zuguang Gu authored on 12/07/2017 08:45:31
Showing1 changed files
... ...
@@ -50,11 +50,11 @@ Heatmap(matrix, col, name,
50 50
     column_order = NULL,
51 51
     row_names_side = c("right", "left"),
52 52
     show_row_names = TRUE,
53
-    row_names_max_width = unit(4, "cm"),
53
+    row_names_max_width = default_row_names_max_width(),
54 54
     row_names_gp = gpar(fontsize = 12),
55 55
     column_names_side = c("bottom", "top"),
56 56
     show_column_names = TRUE,
57
-    column_names_max_height = unit(4, "cm"),
57
+    column_names_max_height = default_column_names_max_height(),
58 58
     column_names_gp = gpar(fontsize = 12),
59 59
     top_annotation = new("HeatmapAnnotation"),
60 60
     top_annotation_height = top_annotation@size,
Browse code

various updates

Zuguang Gu authored on 23/06/2017 21:05:07
Showing0 changed files
Browse code

resolve conflict

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

Zuguang Gu authored on 06/03/2017 17:12:58
Showing1 changed files
... ...
@@ -61,6 +61,7 @@ Heatmap(matrix, col, name,
61 61
     bottom_annotation = new("HeatmapAnnotation"),
62 62
     bottom_annotation_height = bottom_annotation@size,
63 63
     km = 1,
64
+    km_title = "cluster\%i",
64 65
     split = NULL,
65 66
     gap = unit(1, "mm"),
66 67
     combined_name_fun = function(x) paste(x, collapse = "/"),
... ...
@@ -130,6 +131,7 @@ Heatmap(matrix, col, name,
130 131
   \item{bottom_annotation}{a \code{\link{HeatmapAnnotation}} object.}
131 132
   \item{bottom_annotation_height}{total height of the column annotations on the bottom.}
132 133
   \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.}
134
+  \item{km_title}{row title for each cluster when \code{km} is set. It must a text with format of "*\%i*" where "\%i" is replaced by the index of the cluster.}
133 135
   \item{split}{a vector or a data frame by which the rows are split. But if \code{cluster_rows} is a clustering object, \code{split} can be a single number indicating rows are to be split according to the split on the tree.}
134 136
   \item{gap}{gap between row-slices if the heatmap is split by rows, should be \code{\link[grid]{unit}} object. If it is a vector, the order corresponds to top to bottom in the heatmap}
135 137
   \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}.}
Browse code

support 'km_title' to control format of row title when 'km' is set

Zuguang Gu authored on 27/10/2016 14:08:04
Showing1 changed files
... ...
@@ -61,6 +61,7 @@ Heatmap(matrix, col, name,
61 61
     bottom_annotation = new("HeatmapAnnotation"),
62 62
     bottom_annotation_height = bottom_annotation@size,
63 63
     km = 1,
64
+    km_title = "cluster\%i",
64 65
     split = NULL,
65 66
     gap = unit(1, "mm"),
66 67
     combined_name_fun = function(x) paste(x, collapse = "/"),
... ...
@@ -130,6 +131,7 @@ Heatmap(matrix, col, name,
130 131
   \item{bottom_annotation}{a \code{\link{HeatmapAnnotation}} object.}
131 132
   \item{bottom_annotation_height}{total height of the column annotations on the bottom.}
132 133
   \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.}
134
+  \item{km_title}{row title for each cluster when \code{km} is set. It must a text with format of "*\%i*" where "\%i" is replaced by the index of the cluster.}
133 135
   \item{split}{a vector or a data frame by which the rows are split. But if \code{cluster_rows} is a clustering object, \code{split} can be a single number indicating rows are to be split according to the split on the tree.}
134 136
   \item{gap}{gap between row-slices if the heatmap is split by rows, should be \code{\link[grid]{unit}} object. If it is a vector, the order corresponds to top to bottom in the heatmap}
135 137
   \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}.}
Browse code

Merge branch 'master' into devel

* master:
updated time
barplots annotation supports stacked barplots

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

Zuguang Gu authored on 14/10/2016 11:35:51
Showing1 changed files
... ...
@@ -131,7 +131,7 @@ Heatmap(matrix, col, name,
131 131
   \item{bottom_annotation_height}{total height of the column annotations on the bottom.}
132 132
   \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.}
133 133
   \item{split}{a vector or a data frame by which the rows are split. But if \code{cluster_rows} is a clustering object, \code{split} can be a single number indicating rows are to be split according to the split on the tree.}
134
-  \item{gap}{gap between row-slices if the heatmap is split by rows, should be \code{\link[grid]{unit}} object.}
134
+  \item{gap}{gap between row-slices if the heatmap is split by rows, should be \code{\link[grid]{unit}} object. If it is a vector, the order corresponds to top to bottom in the heatmap}
135 135
   \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}.}
136 136
   \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.}
137 137
   \item{show_heatmap_legend}{whether show heatmap legend?}
Browse code

barplots annotation supports stacked barplots

Zuguang Gu authored on 14/10/2016 11:34:33
Showing1 changed files
... ...
@@ -131,7 +131,7 @@ Heatmap(matrix, col, name,
131 131
   \item{bottom_annotation_height}{total height of the column annotations on the bottom.}
132 132
   \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.}
133 133
   \item{split}{a vector or a data frame by which the rows are split. But if \code{cluster_rows} is a clustering object, \code{split} can be a single number indicating rows are to be split according to the split on the tree.}
134
-  \item{gap}{gap between row-slices if the heatmap is split by rows, should be \code{\link[grid]{unit}} object.}
134
+  \item{gap}{gap between row-slices if the heatmap is split by rows, should be \code{\link[grid]{unit}} object. If it is a vector, the order corresponds to top to bottom in the heatmap}
135 135
   \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}.}
136 136
   \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.}
137 137
   \item{show_heatmap_legend}{whether show heatmap legend?}
Browse code

update documentations

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

Zuguang Gu authored on 29/03/2016 16:04:57
Showing1 changed files
... ...
@@ -68,7 +68,7 @@ Heatmap(matrix, col, name,
68 68
     show_heatmap_legend = TRUE,
69 69
     heatmap_legend_param = list(title = name, color_bar = "discrete"),
70 70
     use_raster = FALSE,
71
-    raster_device = c("png", "jpeg", "tiff"),
71
+    raster_device = c("png", "jpeg", "tiff", "CairoPNG", "CairoJPEG", "CairoTIFF"),
72 72
     raster_quality = 1,
73 73
     raster_device_param = list())
74 74
 }
Browse code

update documentations

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

z.gu authored on 29/03/2016 16:04:57
Showing1 changed files
... ...
@@ -68,7 +68,7 @@ Heatmap(matrix, col, name,
68 68
     show_heatmap_legend = TRUE,
69 69
     heatmap_legend_param = list(title = name, color_bar = "discrete"),
70 70
     use_raster = FALSE,
71
-    raster_device = c("png", "jpeg", "tiff"),
71
+    raster_device = c("png", "jpeg", "tiff", "CairoPNG", "CairoJPEG", "CairoTIFF"),
72 72
     raster_quality = 1,
73 73
     raster_device_param = list())
74 74
 }
Browse code

heatmap bodies can be replaced with raster images

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

Zuguang Gu authored on 29/03/2016 16:04:35
Showing1 changed files
... ...
@@ -66,7 +66,11 @@ Heatmap(matrix, col, name,
66 66
     combined_name_fun = function(x) paste(x, collapse = "/"),
67 67
     width = NULL,
68 68
     show_heatmap_legend = TRUE,
69
-    heatmap_legend_param = list(title = name, color_bar = "discrete"))
69
+    heatmap_legend_param = list(title = name, color_bar = "discrete"),
70
+    use_raster = FALSE,
71
+    raster_device = c("png", "jpeg", "tiff"),
72
+    raster_quality = 1,
73
+    raster_device_param = list())
70 74
 }
71 75
 \arguments{
72 76
 
... ...
@@ -132,6 +136,10 @@ Heatmap(matrix, col, name,
132 136
   \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.}
133 137
   \item{show_heatmap_legend}{whether show heatmap legend?}
134 138
   \item{heatmap_legend_param}{a list contains parameters for the heatmap legend. See \code{\link{color_mapping_legend,ColorMapping-method}} for all available parameters.}
139
+  \item{use_raster}{whether render the heatmap body as a raster image. It helps to reduce file size when the matrix is huge.}
140
+  \item{raster_device}{graphic device which is used to generate the raster image}
141
+  \item{raster_quality}{a value set to larger than 1 will improve the quality of the raster image.}
142
+  \item{raster_device_param}{a list of further parameters for the selected graphic device}
135 143
 
136 144
 }
137 145
 \details{
Browse code

heatmap bodies can be replaced with raster images

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

z.gu authored on 29/03/2016 16:04:35
Showing1 changed files
... ...
@@ -66,7 +66,11 @@ Heatmap(matrix, col, name,
66 66
     combined_name_fun = function(x) paste(x, collapse = "/"),
67 67
     width = NULL,
68 68
     show_heatmap_legend = TRUE,
69
-    heatmap_legend_param = list(title = name, color_bar = "discrete"))
69
+    heatmap_legend_param = list(title = name, color_bar = "discrete"),
70
+    use_raster = FALSE,
71
+    raster_device = c("png", "jpeg", "tiff"),
72
+    raster_quality = 1,
73
+    raster_device_param = list())
70 74
 }
71 75
 \arguments{
72 76
 
... ...
@@ -132,6 +136,10 @@ Heatmap(matrix, col, name,
132 136
   \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.}
133 137
   \item{show_heatmap_legend}{whether show heatmap legend?}
134 138
   \item{heatmap_legend_param}{a list contains parameters for the heatmap legend. See \code{\link{color_mapping_legend,ColorMapping-method}} for all available parameters.}
139
+  \item{use_raster}{whether render the heatmap body as a raster image. It helps to reduce file size when the matrix is huge.}
140
+  \item{raster_device}{graphic device which is used to generate the raster image}
141
+  \item{raster_quality}{a value set to larger than 1 will improve the quality of the raster image.}
142
+  \item{raster_device_param}{a list of further parameters for the selected graphic device}
135 143
 
136 144
 }
137 145
 \details{
Browse code

anoying rebase

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

Zuguang Gu authored on 20/12/2015 21:42:51
Showing1 changed files
... ...
@@ -26,7 +26,7 @@ Heatmap(matrix, col, name,
26 26
     row_dend_side = c("left", "right"),
27 27
     row_dend_width = unit(10, "mm"),
28 28
     show_row_dend = TRUE,
29
-    row_dend_reorder = FALSE,
29
+    row_dend_reorder = TRUE,
30 30
     row_dend_gp = gpar(),
31 31
     row_hclust_side = row_dend_side,
32 32
     row_hclust_width = row_dend_width,
... ...
@@ -40,7 +40,7 @@ Heatmap(matrix, col, name,
40 40
     column_dend_height = unit(10, "mm"),
41 41
     show_column_dend = TRUE,
42 42
     column_dend_gp = gpar(),
43
-    column_dend_reorder = FALSE,
43
+    column_dend_reorder = TRUE,
44 44
     column_hclust_side = column_dend_side,
45 45
     column_hclust_height = column_dend_height,
46 46
     show_column_hclust = show_column_dend,
Browse code

anoying rebase

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

z.gu authored on 20/12/2015 21:42:51
Showing1 changed files
... ...
@@ -26,7 +26,7 @@ Heatmap(matrix, col, name,
26 26
     row_dend_side = c("left", "right"),
27 27
     row_dend_width = unit(10, "mm"),
28 28
     show_row_dend = TRUE,
29
-    row_dend_reorder = FALSE,
29
+    row_dend_reorder = TRUE,
30 30
     row_dend_gp = gpar(),
31 31
     row_hclust_side = row_dend_side,
32 32
     row_hclust_width = row_dend_width,
... ...
@@ -40,7 +40,7 @@ Heatmap(matrix, col, name,
40 40
     column_dend_height = unit(10, "mm"),
41 41
     show_column_dend = TRUE,
42 42
     column_dend_gp = gpar(),
43
-    column_dend_reorder = FALSE,
43
+    column_dend_reorder = TRUE,
44 44
     column_hclust_side = column_dend_side,
45 45
     column_hclust_height = column_dend_height,
46 46
     show_column_hclust = show_column_dend,
Browse code

Merge branch 'master' into devel

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

Zuguang Gu authored on 12/11/2015 10:07:49
Showing1 changed files
... ...
@@ -70,13 +70,13 @@ Heatmap(matrix, col, name,
70 70
 }
71 71
 \arguments{
72 72
 
73
-  \item{matrix}{a matrix. Either numeric or character. If it is a simple vector, it will beconverted to a one-column matrix.}
74
-  \item{col}{a vector of colors if the color mapping is discrete or a color mapping function if the matrix is continuous numbers (should be generated by \code{\link[circlize]{colorRamp2}}. 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}}.}
73
+  \item{matrix}{a matrix. Either numeric or character. If it is a simple vector, it will be converted to a one-column matrix.}
74
+  \item{col}{a vector of colors if the color mapping is discrete or a color mapping  function if the matrix is continuous numbers (should be generated by \code{\link[circlize]{colorRamp2}}. 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}}.}
75 75
   \item{name}{name of the heatmap. The name is used as the title of the heatmap legend.}
76 76
   \item{na_col}{color for \code{NA} values.}
77 77
   \item{rect_gp}{graphic parameters for drawing rectangles (for heatmap body).}
78
-  \item{color_space}{the color space in which colors are interpolated. Only used if \code{matrix} is numeric and \code{col} is a vector of colors. Pass to \code{\link[circlize]{colorRamp2}}.}
79
-  \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. \code{x}, \code{y}, \code{width} and \code{height} are all \code{\link[grid]{unit}} objects.}
78
+  \item{color_space}{the color space in which colors are interpolated. Only used if \code{matrix} is numeric and  \code{col} is a vector of colors. Pass to \code{\link[circlize]{colorRamp2}}.}
79
+  \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. \code{x}, \code{y}, \code{width} and \code{height} are all \code{\link[grid]{unit}} objects.}
80 80
   \item{row_title}{title on row.}
81 81
   \item{row_title_side}{will the title be put on the left or right of the heatmap?}
82 82
   \item{row_title_gp}{graphic parameters for drawing text.}
... ...
@@ -85,14 +85,14 @@ Heatmap(matrix, col, name,
85 85
   \item{column_title_side}{will the title be put on the top or bottom of the heatmap?}
86 86
   \item{column_title_gp}{graphic parameters for drawing text.}
87 87
   \item{column_title_rot}{rotation of column titles. Only 0, 90, 270 are allowed to set.}
88
-  \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.}
89
-  \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.}
88
+  \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.}
89
+  \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.}
90 90
   \item{clustering_method_rows}{method to make cluster, pass to \code{\link[stats]{hclust}}.}
91 91
   \item{row_dend_side}{should the row cluster be put on the left or right of the heatmap?}
92 92
   \item{row_dend_width}{width of the row cluster, should be a \code{\link[grid]{unit}} object.}
93 93
   \item{show_row_dend}{whether show row clusters. }
94
-  \item{row_dend_gp}{graphics parameters for drawing lines. If users already provide a \code{\link[stats]{dendrogram}}object with edges rendered, this argument will be ignored.}
95
-  \item{row_dend_reorder}{apply reordering on rows. The value can be a logical value or a vector which contains weight which is used to reorder rows}
94
+  \item{row_dend_gp}{graphics parameters for drawing lines. If users already provide a \code{\link[stats]{dendrogram}} object with edges rendered, this argument will be ignored.}
95
+  \item{row_dend_reorder}{apply reordering on rows. The value can be a logical value or a vector which contains weight  which is used to reorder rows}
96 96
   \item{row_hclust_side}{deprecated, use \code{row_dend_side} instead}
97 97
   \item{row_hclust_width}{deprecated, use \code{row_dend_width} instead}
98 98
   \item{show_row_hclust}{deprecated, use \code{show_row_dend} instead}
... ...
@@ -105,17 +105,17 @@ Heatmap(matrix, col, name,
105 105
   \item{column_dend_height}{height of the column cluster, should be a \code{\link[grid]{unit}} object.}
106 106
   \item{show_column_dend}{whether show column clusters.}
107 107
   \item{column_dend_gp}{graphic parameters for drawling lines. Same settings as \code{row_dend_gp}.}
108
-  \item{column_dend_reorder}{apply reordering on columns. The value can be a logical value or a vector which contains weight which is used to reorder columns}
108
+  \item{column_dend_reorder}{apply reordering on columns. The value can be a logical value or a vector which contains weight  which is used to reorder columns}
109 109
   \item{column_hclust_side}{deprecated, use \code{column_dend_side} instead}
110 110
   \item{column_hclust_height}{deprecated, use \code{column_dend_height} instead}
111 111
   \item{show_column_hclust}{deprecated, use \code{show_column_dend} instead}
112 112
   \item{column_hclust_gp}{deprecated, use \code{column_dend_gp} instead}
113 113
   \item{column_hclust_reorder}{deprecated, use \code{column_dend_reorder} instead}
114
-  \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}
114
+  \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}
115 115
   \item{column_order}{order of column. It makes it easy to adjust column order for both matrix and column annotations.}
116 116
   \item{row_names_side}{should the row names be put on the left or right of the heatmap?}
117 117
   \item{show_row_names}{whether show row names.}
118
-  \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.}
118
+  \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.}
119 119
   \item{row_names_gp}{graphic parameters for drawing text.}
120 120
   \item{column_names_side}{should the column names be put on the top or bottom of the heatmap?}
121 121
   \item{column_names_max_height}{maximum height of column names viewport.}
... ...
@@ -125,11 +125,11 @@ Heatmap(matrix, col, name,
125 125
   \item{top_annotation_height}{total height of the column annotations on the top.}
126 126
   \item{bottom_annotation}{a \code{\link{HeatmapAnnotation}} object.}
127 127
   \item{bottom_annotation_height}{total height of the column annotations on the bottom.}
128
-  \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.}
129
-  \item{split}{a vector or a data frame by which the rows are split. But if \code{cluster_rows} is a clustering object, \code{split} can be a single numberindicating rows are to be split according to the split on the tree.}
128
+  \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.}
129
+  \item{split}{a vector or a data frame by which the rows are split. But if \code{cluster_rows} is a clustering object, \code{split} can be a single number indicating rows are to be split according to the split on the tree.}
130 130
   \item{gap}{gap between row-slices if the heatmap is split by rows, should be \code{\link[grid]{unit}} object.}
131
-  \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}.}
132
-  \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.}
131
+  \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}.}
132
+  \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.}
133 133
   \item{show_heatmap_legend}{whether show heatmap legend?}
134 134
   \item{heatmap_legend_param}{a list contains parameters for the heatmap legend. See \code{\link{color_mapping_legend,ColorMapping-method}} for all available parameters.}
135 135
 
Browse code

Merge branch 'master' into devel

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

z.gu authored on 12/11/2015 10:07:49
Showing1 changed files
... ...
@@ -70,13 +70,13 @@ Heatmap(matrix, col, name,
70 70
 }
71 71
 \arguments{
72 72
 
73
-  \item{matrix}{a matrix. Either numeric or character. If it is a simple vector, it will beconverted to a one-column matrix.}
74
-  \item{col}{a vector of colors if the color mapping is discrete or a color mapping function if the matrix is continuous numbers (should be generated by \code{\link[circlize]{colorRamp2}}. 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}}.}
73
+  \item{matrix}{a matrix. Either numeric or character. If it is a simple vector, it will be converted to a one-column matrix.}
74
+  \item{col}{a vector of colors if the color mapping is discrete or a color mapping  function if the matrix is continuous numbers (should be generated by \code{\link[circlize]{colorRamp2}}. 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}}.}
75 75
   \item{name}{name of the heatmap. The name is used as the title of the heatmap legend.}
76 76
   \item{na_col}{color for \code{NA} values.}
77 77
   \item{rect_gp}{graphic parameters for drawing rectangles (for heatmap body).}
78
-  \item{color_space}{the color space in which colors are interpolated. Only used if \code{matrix} is numeric and \code{col} is a vector of colors. Pass to \code{\link[circlize]{colorRamp2}}.}
79
-  \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. \code{x}, \code{y}, \code{width} and \code{height} are all \code{\link[grid]{unit}} objects.}
78
+  \item{color_space}{the color space in which colors are interpolated. Only used if \code{matrix} is numeric and  \code{col} is a vector of colors. Pass to \code{\link[circlize]{colorRamp2}}.}
79
+  \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. \code{x}, \code{y}, \code{width} and \code{height} are all \code{\link[grid]{unit}} objects.}
80 80
   \item{row_title}{title on row.}
81 81
   \item{row_title_side}{will the title be put on the left or right of the heatmap?}
82 82
   \item{row_title_gp}{graphic parameters for drawing text.}
... ...
@@ -85,14 +85,14 @@ Heatmap(matrix, col, name,
85 85
   \item{column_title_side}{will the title be put on the top or bottom of the heatmap?}
86 86
   \item{column_title_gp}{graphic parameters for drawing text.}
87 87
   \item{column_title_rot}{rotation of column titles. Only 0, 90, 270 are allowed to set.}
88
-  \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.}
89
-  \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.}
88
+  \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.}
89
+  \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.}
90 90
   \item{clustering_method_rows}{method to make cluster, pass to \code{\link[stats]{hclust}}.}
91 91