... | ... |
@@ -1,17 +1,24 @@ |
1 |
+ |
|
2 |
+stop_wrap = ComplexHeatmap:::stop_wrap |
|
3 |
+warning_wrap = ComplexHeatmap:::warning_wrap |
|
1 | 4 |
|
2 |
-# `object` and `new_class` should have the same classes |
|
3 |
-changeClassName = function(object, new_class) { |
|
4 |
- new_object = new(new_class) |
|
5 |
- for(sn in slotNames(object)) { |
|
6 |
- slot(new_object, sn) = slot(object, sn) |
|
7 |
- } |
|
8 |
- return(new_object) |
|
9 |
-} |
|
10 | 5 |
|
6 |
+recycle_gp = function(gp, n = 1) { |
|
7 |
+ g = lapply(gp, function(x) { |
|
8 |
+ if(length(x) == 1 && n > 1) { |
|
9 |
+ rep(x, n) |
|
10 |
+ } else { |
|
11 |
+ x |
|
12 |
+ } |
|
13 |
+ }) |
|
14 |
+ class(g) = "gpar" |
|
15 |
+ return(g) |
|
16 |
+} |
|
11 | 17 |
|
12 |
-compare_height = function(u1, u2) { |
|
13 |
- x1 = convertHeight(u1, "mm", valueOnly = TRUE) |
|
14 |
- x2 = convertHeight(u2, "mm", valueOnly = TRUE) |
|
15 |
- ifelse(x1 > x2, 1, ifelse(x1 < x2, -1, 0)) |
|
18 |
+subset_gp = function(gp, i = 1) { |
|
19 |
+ g = lapply(gp, function(x) { |
|
20 |
+ x[i] |
|
21 |
+ }) |
|
22 |
+ class(g) = "gpar" |
|
23 |
+ return(g) |
|
16 | 24 |
} |
17 |
- |
... | ... |
@@ -9,9 +9,9 @@ changeClassName = function(object, new_class) { |
9 | 9 |
} |
10 | 10 |
|
11 | 11 |
|
12 |
-compare_unit = function(u1, u2) { |
|
13 |
- x1 = convertUnit(u1, "mm", valueOnly = TRUE) |
|
14 |
- x2 = convertUnit(u2, "mm", valueOnly = TRUE) |
|
12 |
+compare_height = function(u1, u2) { |
|
13 |
+ x1 = convertHeight(u1, "mm", valueOnly = TRUE) |
|
14 |
+ x2 = convertHeight(u2, "mm", valueOnly = TRUE) |
|
15 | 15 |
ifelse(x1 > x2, 1, ifelse(x1 < x2, -1, 0)) |
16 | 16 |
} |
17 | 17 |
|
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,17 @@ |
1 |
+ |
|
2 |
+# `object` and `new_class` should have the same classes |
|
3 |
+changeClassName = function(object, new_class) { |
|
4 |
+ new_object = new(new_class) |
|
5 |
+ for(sn in slotNames(object)) { |
|
6 |
+ slot(new_object, sn) = slot(object, sn) |
|
7 |
+ } |
|
8 |
+ return(new_object) |
|
9 |
+} |
|
10 |
+ |
|
11 |
+ |
|
12 |
+compare_unit = function(u1, u2) { |
|
13 |
+ x1 = convertUnit(u1, "mm", valueOnly = TRUE) |
|
14 |
+ x2 = convertUnit(u2, "mm", valueOnly = TRUE) |
|
15 |
+ ifelse(x1 > x2, 1, ifelse(x1 < x2, -1, 0)) |
|
16 |
+} |
|
17 |
+ |