Browse code

set limit for smoothing

Zuguang Gu authored on 29/09/2021 10:21:47
Showing 1 changed files
... ...
@@ -1,6 +1,7 @@
1 1
  
2 2
 stop_wrap = ComplexHeatmap:::stop_wrap
3 3
 warning_wrap = ComplexHeatmap:::warning_wrap
4
+message_wrap = ComplexHeatmap:::message_wrap
4 5
 
5 6
 
6 7
 recycle_gp = function(gp, n = 1) {
Browse code

update with ComplexHeatmap

Zuguang Gu authored on 08/11/2018 19:21:58
Showing 1 changed files
... ...
@@ -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
- 
Browse code

local changes

jokergoo authored on 08/12/2015 14:31:27
Showing 1 changed files
1 1
old mode 100644
2 2
new mode 100755
Zuguang Gu authored on 08/09/2015 10:50:32
Showing 1 changed files
... ...
@@ -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
  
Browse code

move functions to units.R

jokergoo authored on 19/06/2015 16:58:35
Showing 1 changed files
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
+