Browse code

show_heatmap_legend is set to FALSE if rect_gp = gpar(type = 'none')

Zuguang Gu authored on 23/03/2019 16:18:16
Showing14 changed files

... ...
@@ -78,6 +78,8 @@ S3method("size<-", "HeatmapAnnotation")
78 78
 export("size<-.HeatmapAnnotation")
79 79
 S3method("size<-", "SingleAnnotation")
80 80
 export("size<-.SingleAnnotation")
81
+S3method("str", "comb_mat")
82
+export("str.comb_mat")
81 83
 S3method("summary", "Heatmap")
82 84
 export("summary.Heatmap")
83 85
 S3method("summary", "HeatmapList")
... ...
@@ -2,6 +2,7 @@ CHANGES in VERSION 1.99.6
2 2
 
3 3
 * adjust the size of heatmap annotations and add testing scripts
4 4
 * run multiple times k-means to get a consensus partition
5
+* `show_heatmap_legend` is set to FALSE if `rect_gp = gpar(type = "none")`
5 6
 
6 7
 ========================
7 8
 
... ...
@@ -1,31 +1,31 @@
1
-setGeneric('annotation_legend_size', function(object, ...) standardGeneric('annotation_legend_size'))
2
-setGeneric('draw_dend', function(object, ...) standardGeneric('draw_dend'))
3
-setGeneric('make_column_cluster', function(object, ...) standardGeneric('make_column_cluster'))
4
-setGeneric('adjust_heatmap_list', function(object, ...) standardGeneric('adjust_heatmap_list'))
5
-setGeneric('prepare', function(object, ...) standardGeneric('prepare'))
6 1
 setGeneric('map_to_colors', function(object, ...) standardGeneric('map_to_colors'))
7
-setGeneric('copy_all', function(object, ...) standardGeneric('copy_all'))
8
-setGeneric('row_dend', function(object, ...) standardGeneric('row_dend'))
9
-setGeneric('make_row_cluster', function(object, ...) standardGeneric('make_row_cluster'))
10
-setGeneric('heatmap_legend_size', function(object, ...) standardGeneric('heatmap_legend_size'))
11
-setGeneric('make_layout', function(object, ...) standardGeneric('make_layout'))
12 2
 setGeneric('set_component_height', function(object, ...) standardGeneric('set_component_height'))
13
-setGeneric('re_size', function(object, ...) standardGeneric('re_size'))
14
-setGeneric('column_order', function(object, ...) standardGeneric('column_order'))
15
-setGeneric('draw_annotation', function(object, ...) standardGeneric('draw_annotation'))
16
-setGeneric('component_width', function(object, ...) standardGeneric('component_width'))
17
-setGeneric('set_component_width', function(object, ...) standardGeneric('set_component_width'))
18
-setGeneric('column_dend', function(object, ...) standardGeneric('column_dend'))
19
-setGeneric('draw_annotation_legend', function(object, ...) standardGeneric('draw_annotation_legend'))
20 3
 setGeneric('draw_heatmap_body', function(object, ...) standardGeneric('draw_heatmap_body'))
21
-setGeneric('color_mapping_legend', function(object, ...) standardGeneric('color_mapping_legend'))
22 4
 setGeneric('component_height', function(object, ...) standardGeneric('component_height'))
23
-setGeneric('draw', function(object, ...) standardGeneric('draw'))
24
-setGeneric('add_heatmap', function(object, ...) standardGeneric('add_heatmap'))
25
-setGeneric('get_color_mapping_list', function(object, ...) standardGeneric('get_color_mapping_list'))
26
-setGeneric('draw_heatmap_list', function(object, ...) standardGeneric('draw_heatmap_list'))
5
+setGeneric('re_size', function(object, ...) standardGeneric('re_size'))
6
+setGeneric('make_layout', function(object, ...) standardGeneric('make_layout'))
7
+setGeneric('heatmap_legend_size', function(object, ...) standardGeneric('heatmap_legend_size'))
8
+setGeneric('get_legend_param_list', function(object, ...) standardGeneric('get_legend_param_list'))
9
+setGeneric('color_mapping_legend', function(object, ...) standardGeneric('color_mapping_legend'))
10
+setGeneric('make_column_cluster', function(object, ...) standardGeneric('make_column_cluster'))
11
+setGeneric('column_dend', function(object, ...) standardGeneric('column_dend'))
27 12
 setGeneric('row_order', function(object, ...) standardGeneric('row_order'))
13
+setGeneric('draw_heatmap_list', function(object, ...) standardGeneric('draw_heatmap_list'))
14
+setGeneric('row_dend', function(object, ...) standardGeneric('row_dend'))
15
+setGeneric('add_heatmap', function(object, ...) standardGeneric('add_heatmap'))
16
+setGeneric('set_component_width', function(object, ...) standardGeneric('set_component_width'))
17
+setGeneric('column_order', function(object, ...) standardGeneric('column_order'))
18
+setGeneric('draw_annotation_legend', function(object, ...) standardGeneric('draw_annotation_legend'))
19
+setGeneric('draw_heatmap_legend', function(object, ...) standardGeneric('draw_heatmap_legend'))
20
+setGeneric('annotation_legend_size', function(object, ...) standardGeneric('annotation_legend_size'))
21
+setGeneric('draw_annotation', function(object, ...) standardGeneric('draw_annotation'))
22
+setGeneric('prepare', function(object, ...) standardGeneric('prepare'))
28 23
 setGeneric('draw_dimnames', function(object, ...) standardGeneric('draw_dimnames'))
24
+setGeneric('draw', function(object, ...) standardGeneric('draw'))
29 25
 setGeneric('draw_title', function(object, ...) standardGeneric('draw_title'))
30
-setGeneric('draw_heatmap_legend', function(object, ...) standardGeneric('draw_heatmap_legend'))
31
-setGeneric('get_legend_param_list', function(object, ...) standardGeneric('get_legend_param_list'))
26
+setGeneric('make_row_cluster', function(object, ...) standardGeneric('make_row_cluster'))
27
+setGeneric('component_width', function(object, ...) standardGeneric('component_width'))
28
+setGeneric('get_color_mapping_list', function(object, ...) standardGeneric('get_color_mapping_list'))
29
+setGeneric('draw_dend', function(object, ...) standardGeneric('draw_dend'))
30
+setGeneric('adjust_heatmap_list', function(object, ...) standardGeneric('adjust_heatmap_list'))
31
+setGeneric('copy_all', function(object, ...) standardGeneric('copy_all'))
... ...
@@ -351,8 +351,12 @@ Heatmap = function(matrix, col, name,
351 351
     }
352 352
 
353 353
     if(ncol(matrix) == 0) {
354
+        show_heatmap_legend = FALSE
354 355
         .Object@heatmap_param$show_heatmap_legend = FALSE
355 356
     }
357
+    if(identical(rect_gp$type, "none")) {
358
+        show_heatmap_legend = FALSE
359
+    }
356 360
 
357 361
     ### normalize km/split and row_km/row_split
358 362
     if(missing(row_km)) row_km = km
... ...
@@ -1138,3 +1138,16 @@ normalize_comb_mat = function(...) {
1138 1138
 	}
1139 1139
 	return(lt)
1140 1140
 }
1141
+
1142
+# == title
1143
+# str method
1144
+#
1145
+# == param
1146
+# -object A combination matrix returned by `make_comb_mat`.
1147
+# -... Other arguments.
1148
+#
1149
+str.comb_mat = function(object, ...) {
1150
+	class(object) = "matrix"
1151
+	cat(" A comb_mat class object\n")
1152
+	str(object)
1153
+}
1141 1154
deleted file mode 100644
... ...
@@ -11,8 +11,8 @@ Method dispatch page for \code{add_heatmap}.
11 11
 
12 12
 \itemize{
13 13
 \item \code{\link{add_heatmap,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
14
-\item \code{\link{add_heatmap,Heatmap-method}}, \code{\link{Heatmap-class}} class method
15 14
 \item \code{\link{add_heatmap,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
15
+\item \code{\link{add_heatmap,Heatmap-method}}, \code{\link{Heatmap-class}} class method
16 16
 }
17 17
 }
18 18
 \examples{
... ...
@@ -10,8 +10,8 @@ Method dispatch page for \code{column_dend}.
10 10
 \code{column_dend} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{column_dend,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14 13
 \item \code{\link{column_dend,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14
+\item \code{\link{column_dend,Heatmap-method}}, \code{\link{Heatmap-class}} class method
15 15
 }
16 16
 }
17 17
 \examples{
... ...
@@ -10,8 +10,8 @@ Method dispatch page for \code{component_width}.
10 10
 \code{component_width} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{component_width,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14 13
 \item \code{\link{component_width,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14
+\item \code{\link{component_width,Heatmap-method}}, \code{\link{Heatmap-class}} class method
15 15
 }
16 16
 }
17 17
 \examples{
... ...
@@ -10,12 +10,12 @@ Method dispatch page for \code{draw}.
10 10
 \code{draw} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{draw,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
14
-\item \code{\link{draw,Heatmap-method}}, \code{\link{Heatmap-class}} class method
15
-\item \code{\link{draw,Legends-method}}, \code{\link{Legends-class}} class method
16 13
 \item \code{\link{draw,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method
17
-\item \code{\link{draw,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14
+\item \code{\link{draw,Legends-method}}, \code{\link{Legends-class}} class method
15
+\item \code{\link{draw,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
18 16
 \item \code{\link{draw,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method
17
+\item \code{\link{draw,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
18
+\item \code{\link{draw,Heatmap-method}}, \code{\link{Heatmap-class}} class method
19 19
 }
20 20
 }
21 21
 \examples{
... ...
@@ -10,8 +10,8 @@ Method dispatch page for \code{draw_title}.
10 10
 \code{draw_title} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{draw_title,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14 13
 \item \code{\link{draw_title,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14
+\item \code{\link{draw_title,Heatmap-method}}, \code{\link{Heatmap-class}} class method
15 15
 }
16 16
 }
17 17
 \examples{
... ...
@@ -10,8 +10,8 @@ Method dispatch page for \code{row_order}.
10 10
 \code{row_order} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{row_order,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14 13
 \item \code{\link{row_order,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14
+\item \code{\link{row_order,Heatmap-method}}, \code{\link{Heatmap-class}} class method
15 15
 }
16 16
 }
17 17
 \examples{
... ...
@@ -10,12 +10,12 @@ Method dispatch page for \code{show}.
10 10
 \code{show} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{show,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
13
+\item \code{\link{show,ColorMapping-method}}, \code{\link{ColorMapping-class}} class method
14 14
 \item \code{\link{show,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method
15
-\item \code{\link{show,Heatmap-method}}, \code{\link{Heatmap-class}} class method
16 15
 \item \code{\link{show,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
17 16
 \item \code{\link{show,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method
18
-\item \code{\link{show,ColorMapping-method}}, \code{\link{ColorMapping-class}} class method
17
+\item \code{\link{show,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
18
+\item \code{\link{show,Heatmap-method}}, \code{\link{Heatmap-class}} class method
19 19
 }
20 20
 }
21 21
 \examples{
22 22
new file mode 100644
... ...
@@ -0,0 +1,22 @@
1
+\name{str.comb_mat}
2
+\alias{str.comb_mat}
3
+\title{
4
+str method
5
+}
6
+\description{
7
+str method
8
+}
9
+\usage{
10
+\method{str}{comb_mat}(object, ...)
11
+}
12
+\arguments{
13
+
14
+  \item{object}{A combination matrix returned by \code{\link{make_comb_mat}}.}
15
+  \item{...}{Other arguments.}
16
+
17
+}
18
+\examples{
19
+# There is no example
20
+NULL
21
+
22
+}