Browse code

check arguments from old versions

jokergoo authored on 02/11/2018 11:11:30
Showing16 changed files

... ...
@@ -1,31 +1,31 @@
1
-setGeneric('map_to_colors', function(object, ...) standardGeneric('map_to_colors'))
2
-setGeneric('set_component_height', function(object, ...) standardGeneric('set_component_height'))
3
-setGeneric('draw_heatmap_body', function(object, ...) standardGeneric('draw_heatmap_body'))
4
-setGeneric('component_height', function(object, ...) standardGeneric('component_height'))
5
-setGeneric('re_size', function(object, ...) standardGeneric('re_size'))
6
-setGeneric('make_layout', function(object, ...) standardGeneric('make_layout'))
7 1
 setGeneric('heatmap_legend_size', function(object, ...) standardGeneric('heatmap_legend_size'))
2
+setGeneric('adjust_heatmap_list', function(object, ...) standardGeneric('adjust_heatmap_list'))
3
+setGeneric('set_component_height', function(object, ...) standardGeneric('set_component_height'))
8 4
 setGeneric('get_legend_param_list', function(object, ...) standardGeneric('get_legend_param_list'))
5
+setGeneric('draw_heatmap_legend', function(object, ...) standardGeneric('draw_heatmap_legend'))
6
+setGeneric('draw_annotation', function(object, ...) standardGeneric('draw_annotation'))
7
+setGeneric('re_size', function(object, ...) standardGeneric('re_size'))
8
+setGeneric('row_order', function(object, ...) standardGeneric('row_order'))
9
+setGeneric('draw_dend', function(object, ...) standardGeneric('draw_dend'))
9 10
 setGeneric('color_mapping_legend', function(object, ...) standardGeneric('color_mapping_legend'))
10 11
 setGeneric('make_column_cluster', function(object, ...) standardGeneric('make_column_cluster'))
11
-setGeneric('column_dend', function(object, ...) standardGeneric('column_dend'))
12
-setGeneric('row_order', function(object, ...) standardGeneric('row_order'))
12
+setGeneric('draw_title', function(object, ...) standardGeneric('draw_title'))
13
+setGeneric('make_layout', function(object, ...) standardGeneric('make_layout'))
13 14
 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 15
 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'))
16
+setGeneric('draw', function(object, ...) standardGeneric('draw'))
20 17
 setGeneric('annotation_legend_size', function(object, ...) standardGeneric('annotation_legend_size'))
21
-setGeneric('draw_annotation', function(object, ...) standardGeneric('draw_annotation'))
18
+setGeneric('draw_annotation_legend', function(object, ...) standardGeneric('draw_annotation_legend'))
19
+setGeneric('column_dend', function(object, ...) standardGeneric('column_dend'))
20
+setGeneric('copy_all', function(object, ...) standardGeneric('copy_all'))
21
+setGeneric('component_height', function(object, ...) standardGeneric('component_height'))
22
+setGeneric('map_to_colors', function(object, ...) standardGeneric('map_to_colors'))
23
+setGeneric('set_component_width', function(object, ...) standardGeneric('set_component_width'))
22 24
 setGeneric('prepare', function(object, ...) standardGeneric('prepare'))
23
-setGeneric('draw_dimnames', function(object, ...) standardGeneric('draw_dimnames'))
24
-setGeneric('draw', function(object, ...) standardGeneric('draw'))
25
-setGeneric('draw_title', function(object, ...) standardGeneric('draw_title'))
25
+setGeneric('add_heatmap', function(object, ...) standardGeneric('add_heatmap'))
26 26
 setGeneric('make_row_cluster', function(object, ...) standardGeneric('make_row_cluster'))
27
-setGeneric('component_width', function(object, ...) standardGeneric('component_width'))
27
+setGeneric('draw_dimnames', function(object, ...) standardGeneric('draw_dimnames'))
28
+setGeneric('row_dend', function(object, ...) standardGeneric('row_dend'))
28 29
 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'))
30
+setGeneric('draw_heatmap_body', function(object, ...) standardGeneric('draw_heatmap_body'))
31
+setGeneric('component_width', function(object, ...) standardGeneric('component_width'))
... ...
@@ -620,6 +620,7 @@ construct_axis_grob = function(axis_param, which, data_scale) {
620 620
 # -axis_param parameters for controlling axis. See `default_axis_param` for all possible settings and default parameters.
621 621
 # -width Width of the annotation. The value should be an absolute unit. Width is not allowed to be set for column annotation.
622 622
 # -height Height of the annotation. The value should be an absolute unit. Height is not allowed to be set for row annotation.
623
+# -... Other arguments.
623 624
 #
624 625
 # == value
625 626
 # An annotation function which can be used in `HeatmapAnnotation`.
... ...
@@ -634,7 +635,17 @@ construct_axis_grob = function(axis_param, which, data_scale) {
634 635
 # draw(anno, test = "matrix")
635 636
 anno_points = function(x, which = c("column", "row"), border = TRUE, gp = gpar(), pch = 16, 
636 637
 	size = unit(2, "mm"), ylim = NULL, extend = 0.05, axis = TRUE,
637
-	axis_param = default_axis_param(which), width = NULL, height = NULL) {
638
+	axis_param = default_axis_param(which), width = NULL, height = NULL, ...) {
639
+
640
+	other_args = list(...)
641
+	if(length(other_args)) {
642
+		if("axis_gp" %in% names(other_args)) {
643
+			stop_wrap("`axis_gp` is removed from the arguments. Use `axis_param = list(gp = ...)` instead.")
644
+		}
645
+		if("axis_direction" %in% names(other_args)) {
646
+			stop_wrap("`axis_direction` is not supported any more.")
647
+		}
648
+	}
638 649
 
639 650
 	if(is.null(.ENV$current_annotation_which)) {
640 651
 		which = match.arg(which)[1]
... ...
@@ -1020,6 +1031,7 @@ anno_lines = function(x, which = c("column", "row"), border = TRUE, gp = gpar(),
1020 1031
 # -axis_param parameters for controlling axis. See `default_axis_param` for all possible settings and default parameters.
1021 1032
 # -width Width of the annotation. The value should be an absolute unit. Width is not allowed to be set for column annotation.
1022 1033
 # -height Height of the annotation. The value should be an absolute unit. Height is not allowed to be set for row annotation.
1034
+# -... Other arguments.
1023 1035
 #
1024 1036
 # == value
1025 1037
 # An annotation function which can be used in `HeatmapAnnotation`.
... ...
@@ -1038,7 +1050,20 @@ anno_lines = function(x, which = c("column", "row"), border = TRUE, gp = gpar(),
1038 1050
 anno_barplot = function(x, baseline = 0, which = c("column", "row"), border = TRUE, bar_width = 0.6,
1039 1051
 	gp = gpar(fill = "#CCCCCC"), ylim = NULL, extend = 0.05, axis = TRUE, 
1040 1052
 	axis_param = default_axis_param(which),
1041
-	width = NULL, height = NULL) {
1053
+	width = NULL, height = NULL, ...) {
1054
+
1055
+	other_args = list(...)
1056
+	if(length(other_args)) {
1057
+		if("axis_gp" %in% names(other_args)) {
1058
+			stop_wrap("`axis_gp` is removed from the arguments. Use `axis_param = list(gp = ...)` instead.")
1059
+		}
1060
+		if("axis_side" %in% names(other_args)) {
1061
+			stop_wrap("`axis_side` is removed from the arguments. Use `axis_param = list(side = ...)` instead.")
1062
+		}
1063
+		if("axis_direction" %in% names(other_args)) {
1064
+			stop_wrap("`axis_direction` is not supported any more.")
1065
+		}
1066
+	}
1042 1067
 
1043 1068
 	if(inherits(x, "list")) x = do.call("cbind", x)
1044 1069
 	if(inherits(x, "data.frame")) x = as.matrix(x)
... ...
@@ -1193,6 +1218,7 @@ anno_barplot = function(x, baseline = 0, which = c("column", "row"), border = TR
1193 1218
 # -axis_param parameters for controlling axis. See `default_axis_param` for all possible settings and default parameters.
1194 1219
 # -width Width of the annotation. The value should be an absolute unit. Width is not allowed to be set for column annotation.
1195 1220
 # -height Height of the annotation. The value should be an absolute unit. Height is not allowed to be set for row annotation.
1221
+# -... Other arguments.
1196 1222
 #
1197 1223
 # == value
1198 1224
 # An annotation function which can be used in `HeatmapAnnotation`.
... ...
@@ -1210,7 +1236,20 @@ anno_barplot = function(x, baseline = 0, which = c("column", "row"), border = TR
1210 1236
 anno_boxplot = function(x, which = c("column", "row"), border = TRUE,
1211 1237
 	gp = gpar(fill = "#CCCCCC"), ylim = NULL, extend = 0.05, outline = TRUE, box_width = 0.6,
1212 1238
 	pch = 1, size = unit(2, "mm"), axis = TRUE, axis_param = default_axis_param(which),
1213
-	width = NULL, height = NULL) {
1239
+	width = NULL, height = NULL, ...) {
1240
+
1241
+	other_args = list(...)
1242
+	if(length(other_args)) {
1243
+		if("axis_gp" %in% names(other_args)) {
1244
+			stop_wrap("`axis_gp` is removed from the arguments. Use `axis_param = list(gp = ...)` instead.")
1245
+		}
1246
+		if("axis_side" %in% names(other_args)) {
1247
+			stop_wrap("`axis_side` is removed from the arguments. Use `axis_param = list(side = ...)` instead.")
1248
+		}
1249
+		if("axis_direction" %in% names(other_args)) {
1250
+			stop_wrap("`axis_direction` is not supported any more.")
1251
+		}
1252
+	}
1214 1253
 
1215 1254
 	if(is.null(.ENV$current_annotation_which)) {
1216 1255
 		which = match.arg(which)[1]
... ...
@@ -293,6 +293,16 @@ Heatmap = function(matrix, col, name,
293 293
         }
294 294
     }
295 295
 
296
+    if("top_annotation_height" %in% called_args) {
297
+        stop_wrap("`top_annotation_height` is removed. Set the height directly in `HeatmapAnnotation()`.")
298
+    }
299
+    if("bottom_annotation_height" %in% called_args) {
300
+        stop_wrap("`bottom_annotation_height` is removed. Set the height directly in `HeatmapAnnotation()`.")
301
+    }
302
+    if("combined_name_fun" %in% called_args) {
303
+        stop_wrap("`combined_name_fun` is removed. Please directly set `row_names_title`. See https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#titles-for-splitting")
304
+    }
305
+
296 306
     if("heatmap_legend_param" %in% called_args) {
297 307
         for(opt_name in setdiff(c("title_gp", "title_position", "labels_gp", "grid_width", "grid_height", "border"), names(heatmap_legend_param))) {
298 308
             opt_name2 = paste0("legend_", opt_name)
... ...
@@ -250,7 +250,7 @@ SingleAnnotation = function(name, value, col, fun,
250 250
     } else {
251 251
         name_offset = unit(1, "mm")
252 252
     }
253
-    name_rot = ifelse(which == "column", 0, 90)
253
+    if(is.null(name_rot)) name_rot = ifelse(which == "column", 0, 90)
254 254
 
255 255
     anno_name = name
256 256
     if(which == "column") {
... ...
@@ -94,6 +94,9 @@ densityHeatmap = function(data,
94 94
 		if(any(grepl("row", names(arg_list)))) {
95 95
 			stop_wrap("density heatmaps do not allow to set rows.")
96 96
 		}
97
+		if("anno" %in% names(arg_list)) {
98
+			stop_wrap("`anno` is removed from the argument. Please directly construct a `HeatmapAnnotation` object and set to `top_annotation` or `bottom_annotation`.")
99
+		}
97 100
 	}
98 101
 
99 102
 	ylab = ylab
... ...
@@ -88,6 +88,28 @@ oncoPrint = function(mat,
88 88
 	arg_list = as.list(match.call())[-1]
89 89
 	arg_names = names(arg_list)
90 90
 
91
+	if("alter_fun_list" %in% arg_names) {
92
+		stop_wrap("`alter_fun_list` is removed from the arguments.")
93
+	}
94
+	if("axis_gp" %in% arg_names) {
95
+		stop_wrap("`axis_gp` is removed from the arguments. Please set `axis_param(gp = ...)` in `anno_oncoprint_barplot()` when you define the `top_annotation` or `right_annotation`.")
96
+	}
97
+	if("show_row_names" %in% arg_names) {
98
+		stop_wrap("`show_row_names` is removed from the arguments. Please directly remove `anno_oncoprint_barplot()` in `right_annotation` to remove barplots on the left of the oncoPrint.")
99
+	}
100
+	if("row_barplot_width" %in% arg_names) {
101
+		stop_wrap("`row_barplot_width` is removed from the arguments. Please directly set `width` in `anno_oncoprint_barplot()` in `right_annotation`.")
102
+	}
103
+	if("top_annotation_height" %in% arg_names) {
104
+		stop_wrap("`top_annotation_height` is removed from the arguments. Please directly set `height` in `anno_oncoprint_barplot()` in `top_annotation`.")
105
+	}
106
+	if("bottom_annotation_height" %in% arg_names) {
107
+		stop_wrap("`bottom_annotation_height` is removed from the arguments. Please directly set `height` in `bottom_annotation`.")
108
+	}
109
+	if("barplot_ignore" %in% arg_names) {
110
+		stop_wrap("`barplot_ignore` is removed from the arguments. The subset of alterations now can be controlled in `anno_oncoprint_barplot()`.")
111
+	}
112
+
91 113
 	# convert mat to mat_list
92 114
 	if(inherits(mat, "data.frame")) {
93 115
 		mat = as.matrix(mat)
... ...
@@ -10,9 +10,9 @@ Method dispatch page for \code{add_heatmap}.
10 10
 \code{add_heatmap} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{add_heatmap,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
14 13
 \item \code{\link{add_heatmap,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
15 14
 \item \code{\link{add_heatmap,Heatmap-method}}, \code{\link{Heatmap-class}} class method
15
+\item \code{\link{add_heatmap,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
16 16
 }
17 17
 }
18 18
 \examples{
... ...
@@ -10,7 +10,7 @@ Barplot Annotation
10 10
 anno_barplot(x, baseline = 0, which = c("column", "row"), border = TRUE, bar_width = 0.6,
11 11
     gp = gpar(fill = "#CCCCCC"), ylim = NULL, extend = 0.05, axis = TRUE,
12 12
     axis_param = default_axis_param(which),
13
-    width = NULL, height = NULL)
13
+    width = NULL, height = NULL, ...)
14 14
 }
15 15
 \arguments{
16 16
 
... ...
@@ -26,6 +26,7 @@ anno_barplot(x, baseline = 0, which = c("column", "row"), border = TRUE, bar_wid
26 26
   \item{axis_param}{parameters for controlling axis. See \code{\link{default_axis_param}} for all possible settings and default parameters.}
27 27
   \item{width}{Width of the annotation. The value should be an absolute unit. Width is not allowed to be set for column annotation.}
28 28
   \item{height}{Height of the annotation. The value should be an absolute unit. Height is not allowed to be set for row annotation.}
29
+  \item{...}{Other arguments.}
29 30
 
30 31
 }
31 32
 \value{
... ...
@@ -10,7 +10,7 @@ Boxplot Annotation
10 10
 anno_boxplot(x, which = c("column", "row"), border = TRUE,
11 11
     gp = gpar(fill = "#CCCCCC"), ylim = NULL, extend = 0.05, outline = TRUE, box_width = 0.6,
12 12
     pch = 1, size = unit(2, "mm"), axis = TRUE, axis_param = default_axis_param(which),
13
-    width = NULL, height = NULL)
13
+    width = NULL, height = NULL, ...)
14 14
 }
15 15
 \arguments{
16 16
 
... ...
@@ -28,6 +28,7 @@ anno_boxplot(x, which = c("column", "row"), border = TRUE,
28 28
   \item{axis_param}{parameters for controlling axis. See \code{\link{default_axis_param}} for all possible settings and default parameters.}
29 29
   \item{width}{Width of the annotation. The value should be an absolute unit. Width is not allowed to be set for column annotation.}
30 30
   \item{height}{Height of the annotation. The value should be an absolute unit. Height is not allowed to be set for row annotation.}
31
+  \item{...}{Other arguments.}
31 32
 
32 33
 }
33 34
 \value{
... ...
@@ -9,7 +9,7 @@ Points Annotation
9 9
 \usage{
10 10
 anno_points(x, which = c("column", "row"), border = TRUE, gp = gpar(), pch = 16,
11 11
     size = unit(2, "mm"), ylim = NULL, extend = 0.05, axis = TRUE,
12
-    axis_param = default_axis_param(which), width = NULL, height = NULL)
12
+    axis_param = default_axis_param(which), width = NULL, height = NULL, ...)
13 13
 }
14 14
 \arguments{
15 15
 
... ...
@@ -25,6 +25,7 @@ anno_points(x, which = c("column", "row"), border = TRUE, gp = gpar(), pch = 16,
25 25
   \item{axis_param}{parameters for controlling axis. See \code{\link{default_axis_param}} for all possible settings and default parameters.}
26 26
   \item{width}{Width of the annotation. The value should be an absolute unit. Width is not allowed to be set for column annotation.}
27 27
   \item{height}{Height of the annotation. The value should be an absolute unit. Height is not allowed to be set for row annotation.}
28
+  \item{...}{Other arguments.}
28 29
 
29 30
 }
30 31
 \value{
... ...
@@ -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,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14 13
 \item \code{\link{column_dend,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14
+\item \code{\link{column_dend,HeatmapList-method}}, \code{\link{HeatmapList-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,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14 13
 \item \code{\link{component_width,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14
+\item \code{\link{component_width,HeatmapList-method}}, \code{\link{HeatmapList-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,AnnotationFunction-method}}, \code{\link{AnnotationFunction-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
16 13
 \item \code{\link{draw,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method
14
+\item \code{\link{draw,Legends-method}}, \code{\link{Legends-class}} class method
17 15
 \item \code{\link{draw,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
18 16
 \item \code{\link{draw,Heatmap-method}}, \code{\link{Heatmap-class}} class method
17
+\item \code{\link{draw,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method
18
+\item \code{\link{draw,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-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,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14 13
 \item \code{\link{draw_title,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14
+\item \code{\link{draw_title,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
15 15
 }
16 16
 }
17 17
 \examples{
... ...
@@ -10,8 +10,8 @@ Method dispatch page for \code{make_layout}.
10 10
 \code{make_layout} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{make_layout,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14 13
 \item \code{\link{make_layout,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14
+\item \code{\link{make_layout,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
15 15
 }
16 16
 }
17 17
 \examples{
... ...
@@ -11,11 +11,11 @@ Method dispatch page for \code{show}.
11 11
 
12 12
 \itemize{
13 13
 \item \code{\link{show,ColorMapping-method}}, \code{\link{ColorMapping-class}} class method
14
-\item \code{\link{show,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method
15 14
 \item \code{\link{show,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
16
-\item \code{\link{show,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method
17
-\item \code{\link{show,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
15
+\item \code{\link{show,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method
18 16
 \item \code{\link{show,Heatmap-method}}, \code{\link{Heatmap-class}} class method
17
+\item \code{\link{show,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
18
+\item \code{\link{show,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method
19 19
 }
20 20
 }
21 21
 \examples{