Browse code

update

jokergoo authored on 08/10/2018 15:30:35
Showing3 changed files

... ...
@@ -142,6 +142,7 @@ subset_vector = function(x, i) x[i]
142 142
 anno_simple = function(x, col, na_col = "grey", 
143 143
 	which = c("column", "row"), border = FALSE, gp = gpar(col = NA),
144 144
 	pch = NULL, pt_size = unit(1, "snpc")*0.8, pt_gp = gpar(), 
145
+	anno_simple_size = ht_opt$anno_simple_size,
145 146
 	width = NULL, height = NULL) {
146 147
 
147 148
 	if(is.null(.ENV$current_annotation_which)) {
... ...
@@ -159,7 +160,7 @@ anno_simple = function(x, col, na_col = "grey",
159 160
 	input_is_matrix = is.matrix(x)
160 161
 
161 162
 	anno_size = anno_width_and_height(which, width, height, 
162
-		ht_opt$anno_simple_size*ifelse(input_is_matrix, ncol(x), 1))
163
+		anno_simple_size*ifelse(input_is_matrix, ncol(x), 1))
163 164
 	
164 165
 	if(missing(col)) {
165 166
 		col = default_col(x)
... ...
@@ -297,6 +297,7 @@ HeatmapAnnotation = function(...,
297 297
 			arg_list$legend_param = annotation_legend_param[[i_simple + 1]]
298 298
 			arg_list$value = anno_value_list[[ag]]
299 299
 			arg_list$na_col = na_col
300
+			arg_list$anno_simple_size = anno_simple_size
300 301
 			if(missing(col)) {
301 302
 				anno_list[[ag]] = do.call(SingleAnnotation, arg_list)
302 303
 		    } else {
... ...
@@ -1108,7 +1109,6 @@ setMethod(f = "resize",
1108 1109
 	}
1109 1110
 
1110 1111
 	# from here `annotation_size_adjusted` contains absolute units if it is called.
1111
-
1112 1112
 	gap = convertUnitFun(gap, "mm", valueOnly = TRUE)
1113 1113
 
1114 1114
 	if(is_size_set) {
... ...
@@ -1144,7 +1144,6 @@ setMethod(f = "resize",
1144 1144
 			} else {
1145 1145
 				anno_simple_size = convertUnitFun(anno_simple_size, "mm", valueOnly = TRUE)
1146 1146
 			}
1147
-
1148 1147
 			if(size_adjusted <= sum(gap)) {
1149 1148
 				stop(paste0(size_name, " you set is smaller than sum of gaps."))
1150 1149
 			}
... ...
@@ -151,6 +151,7 @@ SingleAnnotation = function(name, value, col, fun,
151 151
 	name_offset = unit(1, "mm"),
152 152
 	name_side = ifelse(which == "column", "right", "bottom"),
153 153
     name_rot = ifelse(which == "column", 0, 90),
154
+    anno_simple_size = ht_opt$anno_simple_size,
154 155
     width = NULL, height = NULL) {
155 156
 
156 157
     .ENV$current_annotation_which = NULL
... ...
@@ -457,7 +458,7 @@ SingleAnnotation = function(name, value, col, fun,
457 458
         value = value
458 459
 
459 460
         if(verbose) qqcat("@{name}: generate AnnotationFunction for simple annotation values by anno_simple()\n")
460
-        .Object@fun = anno_simple(value, col = color_mapping, which = which, na_col = na_col, gp = gp, border = border)
461
+        .Object@fun = anno_simple(value, col = color_mapping, which = which, na_col = na_col, gp = gp, border = border, anno_simple_size = anno_simple_size)
461 462
         if(missing(width)) {
462 463
             .Object@width = .Object@fun@width
463 464
         } else {