Browse code

Commit made by the Bioconductor Git-SVN bridge.

Commit id: 4cbce102eabb1633fc8980b1374795bfb44507df

Merge branch 'master' of https://github.com/jokergoo/ComplexHeatmap


Commit id: a15bbec76c85c15bc27273ce15f5118ea087132f

refreshed documentatinos


Commit id: b1fe0a94aa09a4a47e5a02383ce662580f057bdc

ColorMapping object has default value for name slot



git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ComplexHeatmap@106487 bc3139a8-67e5-0310-9ffc-ced21a209358

z.gu authored on 16/07/2015 15:21:23
Showing 62 changed files

... ...
@@ -1,5 +1,6 @@
1 1
 CHANGES in VERSION 1.2.4
2 2
 
3
+* name for ColorMapping object has default value now. 
3 4
 * legend for continuous values can be set as continuous legends
4 5
 * row title and column title as well as legend title support expression
5 6
 * add `heatmap_legend_title` in `Heatmap` and `ColorMapping`
... ...
@@ -67,8 +67,9 @@ ColorMapping = function(name, colors = NULL, levels = NULL,
67 67
 
68 68
 	.Object = new("ColorMapping")
69 69
 
70
-	if(is.null(name)) {
71
-		stop("You should provide name.")
70
+	if(missing(name)) {
71
+		increase_color_mapping_index()
72
+		name = get_color_mapping_index()
72 73
 	}
73 74
 	if(!is.null(colors)) {
74 75
 		if(is.null(levels)) {
... ...
@@ -5,6 +5,7 @@ INDEX_ENV = new.env()
5 5
 INDEX_ENV$I_HEATMAP = 0
6 6
 INDEX_ENV$I_ANNOTATION = 0
7 7
 INDEX_ENV$I_ROW_ANNOTATION = 0
8
+INDEX_ENV$I_COLOR_MAPPING = 0
8 9
 
9 10
 get_heatmap_index = function() {
10 11
 	INDEX_ENV$I_HEATMAP
... ...
@@ -30,6 +31,13 @@ increase_row_annotation_index = function() {
30 31
 	INDEX_ENV$I_ROW_ANNOTATION = INDEX_ENV$I_ROW_ANNOTATION + 1
31 32
 }
32 33
 
34
+get_color_mapping_index = function() {
35
+    INDEX_ENV$I_COLOR_MAPPING
36
+}
37
+
38
+increase_color_mapping_index = function() {
39
+    INDEX_ENV$I_COLOR_MAPPING = INDEX_ENV$I_COLOR_MAPPING + 1
40
+}
33 41
 
34 42
 # default colors for matrix or annotations
35 43
 # this function should be improved later
... ...
@@ -15,5 +15,6 @@ It is only designed for \code{+} generic method so that above three classes can
15 15
 
16 16
 }
17 17
 \examples{
18
+
18 19
 # no example
19 20
 NULL}
... ...
@@ -27,5 +27,6 @@ Zuguang Gu <z.gu@dkfz.de>
27 27
 
28 28
 }
29 29
 \examples{
30
+
30 31
 # no example
31 32
 NULL}
... ...
@@ -30,5 +30,6 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
+
33 34
 # for examples, please go to `ColorMapping` method page
34 35
 NULL}
... ...
@@ -38,6 +38,7 @@ Zuguang Gu <z.gu@dkfz.de>
38 38
 
39 39
 }
40 40
 \examples{
41
+
41 42
 # discrete color mapping for characters
42 43
 cm = ColorMapping(name = "test",
43 44
     colors = c("blue", "white", "red"),
... ...
@@ -72,5 +72,6 @@ Zuguang Gu <z.gu@dkfz.de>
72 72
 
73 73
 }
74 74
 \examples{
75
+
75 76
 # for examples, please go to `Heatmap` method page
76 77
 NULL}
... ...
@@ -115,6 +115,7 @@ Zuguang Gu <z.gu@dkfz.de>
115 115
 
116 116
 }
117 117
 \examples{
118
+
118 119
 mat = matrix(rnorm(80, 2), 8, 10)
119 120
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
120 121
 rownames(mat) = letters[1:12]
... ...
@@ -29,5 +29,6 @@ Zuguang Gu <z.gu@dkfz.de>
29 29
 
30 30
 }
31 31
 \examples{
32
+
32 33
 # for examples, please go to `HeatmapAnnotation` method page
33 34
 NULL}
... ...
@@ -48,6 +48,7 @@ Zuguang Gu <z.gu@dkfz.de>
48 48
 
49 49
 }
50 50
 \examples{
51
+
51 52
 df = data.frame(type = c("a", "a", "a", "b", "b", "b"))
52 53
 ha = HeatmapAnnotation(df = df)
53 54
 
... ...
@@ -68,6 +68,7 @@ Zuguang Gu <z.gu@dkfz.de>
68 68
 
69 69
 }
70 70
 \examples{
71
+
71 72
 mat = matrix(rnorm(80, 2), 8, 10)
72 73
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
73 74
 rownames(mat) = letters[1:12]
... ...
@@ -27,7 +27,9 @@ Zuguang Gu <z.gu@dkfz.de>
27 27
 
28 28
 }
29 29
 \section{Detailes}{
30
+
30 31
 There is no public constructor method for the \code{\link{HeatmapList-class}}.}
31 32
 \examples{
33
+
32 34
 # no example
33 35
 NULL}
... ...
@@ -39,5 +39,6 @@ Zuguang Gu <z.gu@dkfz.de>
39 39
 
40 40
 }
41 41
 \examples{
42
+
42 43
 # for examples, please go to `SingleAnnotation` method page
43 44
 NULL}
... ...
@@ -49,6 +49,7 @@ Zuguang Gu <z.gu@dkfz.de>
49 49
 
50 50
 }
51 51
 \examples{
52
+
52 53
 # discrete character
53 54
 SingleAnnotation(name = "test", value = c("a", "a", "a", "b", "b", "b"))
54 55
 SingleAnnotation(name = "test", value = c("a", "a", "a", "b", "b", "b"), 
... ...
@@ -31,6 +31,7 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
+
34 35
 mat = matrix(rnorm(80, 2), 8, 10)
35 36
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
36 37
 rownames(mat) = letters[1:12]
... ...
@@ -28,6 +28,7 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
+
31 32
 mat = matrix(rnorm(80, 2), 8, 10)
32 33
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
33 34
 rownames(mat) = letters[1:12]
... ...
@@ -28,6 +28,7 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
+
31 32
 mat = matrix(rnorm(80, 2), 8, 10)
32 33
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
33 34
 rownames(mat) = letters[1:12]
... ...
@@ -28,6 +28,7 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
+
31 32
 mat = matrix(rnorm(80, 2), 8, 10)
32 33
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
33 34
 rownames(mat) = letters[1:12]
... ...
@@ -31,6 +31,7 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
+
34 35
 f = anno_barplot(rnorm(10))
35 36
 grid.newpage(); f(1:10)
36 37
 
... ...
@@ -32,6 +32,7 @@ Zuguang Gu <z.gu@dkfz.de>
32 32
 
33 33
 }
34 34
 \examples{
35
+
35 36
 mat = matrix(rnorm(32), nrow = 4)
36 37
 f = anno_boxplot(mat)
37 38
 grid.newpage(); f(1:8)
... ...
@@ -28,6 +28,7 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
+
31 32
 mat = matrix(rnorm(32), nrow = 4)
32 33
 f = anno_density(mat)
33 34
 grid.newpage(); f(1:8)
... ...
@@ -26,6 +26,7 @@ Zuguang Gu <z.gu@dkfz.de>
26 26
 
27 27
 }
28 28
 \examples{
29
+
29 30
 mat = matrix(rnorm(32), nrow = 4)
30 31
 f = anno_histogram(mat)
31 32
 grid.newpage(); f(1:8)
... ...
@@ -33,5 +33,6 @@ Zuguang Gu <z.gu@dkfz.de>
33 33
 
34 34
 }
35 35
 \examples{
36
+
36 37
 f = anno_points(rnorm(10))
37 38
 grid.newpage(); f(1:10)}
... ...
@@ -29,6 +29,7 @@ Zuguang Gu <z.gu@dkfz.de>
29 29
 
30 30
 }
31 31
 \examples{
32
+
32 33
 mat = matrix(rnorm(100), 10)
33 34
 colnames(mat) = letters[1:10]
34 35
 rownames(mat) = LETTERS[1:10]
... ...
@@ -33,5 +33,6 @@ Zuguang Gu <z.gu@dkfz.de>
33 33
 
34 34
 }
35 35
 \examples{
36
+
36 37
 # no example for this internal method
37 38
 NULL}
... ...
@@ -38,6 +38,7 @@ Zuguang Gu <z.gu@dkfz.de>
38 38
 
39 39
 }
40 40
 \examples{
41
+
41 42
 # discrete color mapping for characters
42 43
 cm = ColorMapping(name = "test",
43 44
     colors = c("blue", "white", "red"),
... ...
@@ -31,5 +31,6 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
+
34 35
 df = data.frame(type = c("a", "a", "a", "b", "b", "b"))
35 36
 ha = rowAnnotation(df = df)}
... ...
@@ -28,4 +28,5 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
+
31 32
 # no example for this internal method}
... ...
@@ -24,4 +24,5 @@ Zuguang Gu <z.gu@dkfz.de>
24 24
 
25 25
 }
26 26
 \examples{
27
+
27 28
 # no example for this internal method}
... ...
@@ -20,6 +20,7 @@ This function is only for internal use.
20 20
 
21 21
 }
22 22
 \section{Detials}{
23
+
23 24
 This function is only for internal use.}
24 25
 \value{
25 26
 A \code{\link[grid]{unit}} object.
... ...
@@ -30,4 +31,5 @@ Zuguang Gu <z.gu@dkfz.de>
30 31
 
31 32
 }
32 33
 \examples{
34
+
33 35
 # no example for this internal method}
... ...
@@ -28,4 +28,5 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
+
31 32
 # no example for this internal method}
... ...
@@ -30,6 +30,7 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
+
33 34
 mat = matrix(rnorm(40), nr = 4, ncol = 10)
34 35
 rownames(mat) = letters[1:4]
35 36
 colnames(mat) = letters[1:10]
... ...
@@ -31,6 +31,7 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
+
34 35
 mat = matrix(rnorm(80, 2), 8, 10)
35 36
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
36 37
 rownames(mat) = letters[1:12]
... ...
@@ -30,6 +30,7 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
+
33 34
 df = data.frame(type = c("a", "a", "a", "b", "b", "b"))
34 35
 ha = HeatmapAnnotation(df = df)
35 36
 grid.newpage(); draw(ha, 1:6)
... ...
@@ -33,6 +33,7 @@ Zuguang Gu <z.gu@dkfz.de>
33 33
 
34 34
 }
35 35
 \examples{
36
+
36 37
 mat = matrix(rnorm(80, 2), 8, 10)
37 38
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
38 39
 rownames(mat) = letters[1:12]
... ...
@@ -31,6 +31,7 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
+
34 35
 anno = SingleAnnotation(name = "test", value = c("a", "a", "a", "b", "b", "b"))
35 36
 grid.newpage(); draw(anno, 1:5)
36 37
 grid.newpage(); draw(anno, c(1, 4, 3, 5, 2))
... ...
@@ -34,5 +34,6 @@ Zuguang Gu <z.gu@dkfz.de>
34 34
 
35 35
 }
36 36
 \examples{
37
+
37 38
 # no example for this internal method
38 39
 NULL}
... ...
@@ -32,5 +32,6 @@ Zuguang Gu <z.gu@dkfz.de>
32 32
 
33 33
 }
34 34
 \examples{
35
+
35 36
 # no example for this internal method
36 37
 NULL}
... ...
@@ -35,5 +35,6 @@ Zuguang Gu <z.gu@dkfz.de>
35 35
 
36 36
 }
37 37
 \examples{
38
+
38 39
 # no example for this internal method
39 40
 NULL}
... ...
@@ -42,5 +42,6 @@ Zuguang Gu <z.gu@dkfz.de>
42 42
 
43 43
 }
44 44
 \examples{
45
+
45 46
 # no example for this internal method
46 47
 NULL}
... ...
@@ -36,5 +36,6 @@ Zuguang Gu <z.gu@dkfz.de>
36 36
 
37 37
 }
38 38
 \examples{
39
+
39 40
 # no example for this internal method
40 41
 NULL}
... ...
@@ -32,5 +32,6 @@ Zuguang Gu <z.gu@dkfz.de>
32 32
 
33 33
 }
34 34
 \examples{
35
+
35 36
 # no example for this internal method
36 37
 NULL}
... ...
@@ -30,5 +30,6 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
+
33 34
 # no example for this internal method
34 35
 NULL}
... ...
@@ -33,5 +33,6 @@ Zuguang Gu <z.gu@dkfz.de>
33 33
 
34 34
 }
35 35
 \examples{
36
+
36 37
 # no example for this internal method
37 38
 NULL}
... ...
@@ -31,5 +31,6 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
+
34 35
 # no example for this internal method
35 36
 NULL}
... ...
@@ -30,5 +30,6 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
+
33 34
 # no example for this internal method
34 35
 NULL}
... ...
@@ -34,6 +34,7 @@ Zuguang Gu <z.gu@dkfz.de>
34 34
 
35 35
 }
36 36
 \examples{
37
+
37 38
 hc = hclust(dist(USArrests[1:5, ]))
38 39
 dend = as.dendrogram(hc)
39 40
 
... ...
@@ -30,5 +30,6 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
+
33 34
 # no example for this internal method
34 35
 NULL}
... ...
@@ -30,5 +30,6 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
+
33 34
 # no example for this internal method
34 35
 NULL}
... ...
@@ -33,5 +33,6 @@ Zuguang Gu <z.gu@dkfz.de>
33 33
 
34 34
 }
35 35
 \examples{
36
+
36 37
 # no example for this internal method
37 38
 NULL}
... ...
@@ -59,5 +59,6 @@ Zuguang Gu <z.gu@dkfz.de>
59 59
 
60 60
 }
61 61
 \examples{
62
+
62 63
 # no example for this internal method
63 64
 NULL}
... ...
@@ -32,5 +32,6 @@ Zuguang Gu <z.gu@dkfz.de>
32 32
 
33 33
 }
34 34
 \examples{
35
+
35 36
 # no example for this internal method
36 37
 NULL}
... ...
@@ -29,6 +29,7 @@ Zuguang Gu <z.gu@dkfz.de>
29 29
 
30 30
 }
31 31
 \examples{
32
+
32 33
 # discrete color mapping for characters
33 34
 cm = ColorMapping(name = "test",
34 35
     colors = c("blue", "white", "red"),
... ...
@@ -25,5 +25,6 @@ This function returns no value.
25 25
 
26 26
 }
27 27
 \examples{
28
+
28 29
 # no example 
29 30
 NULL}
... ...
@@ -46,6 +46,7 @@ Zuguang Gu <z.gu@dkfz.de>
46 46
 
47 47
 }
48 48
 \examples{
49
+
49 50
 df = data.frame(matrix(rnorm(40), nrow = 10, dimnames = list(letters[1:10], letters[1:4])),
50 51
                 large = runif(10)*100,
51 52
                 t1 = sample(letters[1:3], 10, replace = TRUE),
... ...
@@ -37,5 +37,6 @@ Zuguang Gu <z.gu@dkfz.de>
37 37
 
38 38
 }
39 39
 \examples{
40
+
40 41
 # no example for this internal method
41 42
 NULL}
... ...
@@ -25,5 +25,6 @@ This function returns no value.
25 25
 
26 26
 }
27 27
 \examples{
28
+
28 29
 # no example 
29 30
 NULL}
... ...
@@ -31,5 +31,6 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
+
34 35
 df = data.frame(type = c("a", "a", "a", "b", "b", "b"))
35 36
 ha = columnAnnotation(df = df)}
... ...
@@ -30,5 +30,6 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
+
33 34
 # no example for this internal method
34 35
 NULL}
... ...
@@ -28,6 +28,7 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
+
31 32
 mat = matrix(rnorm(80, 2), 8, 10)
32 33
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
33 34
 rownames(mat) = letters[1:12]
... ...
@@ -24,4 +24,5 @@ This function returns no value.
24 24
 
25 25
 }
26 26
 \author{
27
+
27 28
 Zuguang Gu <z.gu@dkfz.de>}