annotate heatmap_script.R @ 2:b1667c118127 draft default tip

planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit bbfc13f2e4fa9e7e5b562c96d0e570318d3482d9
author ethevenot
date Tue, 06 Jun 2017 11:58:43 -0400
parents ad06aeed02c9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
1 ## Etienne Thevenot
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
2 ## CEA, MetaboHUB
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
3 ## W4M Core Development Team
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
4 ## etienne.thevenot@cea.fr
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
5 ## 2015-05-30
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
6
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
7
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
8 heatmapF <- function(proMN,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
9 obsDF,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
10 feaDF,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
11 disC, ## dissimilarity
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
12 cutSamN, ## number of sample clusters
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
13 cutVarN, ## number of variable clusters
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
14 fig.pdfC,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
15 corMetC, ## correlation method
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
16 aggMetC, ## agglomeration method
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
17 colC, ## color scale
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
18 scaL,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
19 cexN) {
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
20
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
21 ncaN <- 14 ## Sample and variable name truncature for display
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
22
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
23 if(aggMetC == "ward") {
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
24
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
25 rvsLs <- R.Version()
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
26 aggMetC <- paste0(aggMetC,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
27 ifelse(as.numeric(rvsLs[["major"]]) > 3 ||
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
28 as.numeric(rvsLs[["major"]]) == 3 && as.numeric(rvsLs[["minor"]]) > 0.3,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
29 ".D",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
30 ""))
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
31
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
32 }
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
33
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
34 if(disC %in% c("euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski")) {
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
35
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
36 obsHcl <- hclust(dist(proMN, method = disC),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
37 method = aggMetC)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
38
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
39 feaHcl <- hclust(dist(t(proMN), method = disC),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
40 method = aggMetC)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
41
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
42 } else if(disC == "1-cor") {
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
43
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
44 obsHcl <- hclust(as.dist(1-cor(t(proMN),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
45 method = corMetC,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
46 use = "pairwise.complete.obs")),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
47 method = aggMetC)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
48
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
49 feaHcl <- hclust(as.dist(1-cor(proMN,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
50 method = corMetC,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
51 use = "pairwise.complete.obs")),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
52 method = aggMetC)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
53
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
54 } else if(disC == "1-abs(cor)") {
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
55
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
56 obsHcl <- hclust(as.dist(1-abs(cor(t(proMN),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
57 method = corMetC,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
58 use = "pairwise.complete.obs"))),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
59 method = aggMetC)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
60
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
61 feaHcl <- hclust(as.dist(1-abs(cor(proMN,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
62 method = corMetC,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
63 use = "pairwise.complete.obs"))),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
64 method = aggMetC)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
65
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
66 }
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
67
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
68 heaMN <- proMN <- proMN[obsHcl[["order"]], feaHcl[["order"]]]
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
69
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
70 if(scaL)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
71 heaMN <- scale(heaMN)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
72
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
73 heaMN <- heaMN[, rev(1:ncol(heaMN)), drop = FALSE]
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
74
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
75 switch(colC,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
76 blueOrangeRed = {
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
77 imaPalVn <- colorRampPalette(c("blue", "orange", "red"),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
78 space = "rgb")(5)[1:5]
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
79 },
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
80 redBlackGreen = {
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
81 imaPalVn <- colorRampPalette(c("red", "black", "green"),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
82 space = "rgb")(5)[1:5]
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
83 })
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
84
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
85
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
86 ## figure
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
87 ##-------
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
88
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
89 pdf(fig.pdfC,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
90 width = 14,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
91 height = 14)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
92
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
93 layout(matrix(1:4, nrow = 2),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
94 widths = c(1, 9), heights = c(1, 9))
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
95
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
96 ## Color scale
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
97
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
98 scaN <- length(imaPalVn)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
99
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
100 par(mar = c(0.6, 0.6, 0.6, 4.1))
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
101
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
102 ylimVn <- c(0, scaN)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
103 ybottomVn <- 0:(scaN - 1)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
104 ytopVn <- 1:scaN
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
105
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
106 plot(x = 0,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
107 y = 0,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
108 bty = "n",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
109 font.axis = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
110 font.lab = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
111 type = "n",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
112 xlim = c(0, 1),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
113 ylim = ylimVn,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
114 xlab = "",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
115 ylab = "",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
116 xaxs = "i",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
117 yaxs = "i",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
118 xaxt = "n",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
119 yaxt = "n")
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
120
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
121 rect(xleft = 0.8,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
122 ybottom = ybottomVn,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
123 xright = 1,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
124 ytop = ytopVn,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
125 col = imaPalVn,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
126 border = NA)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
127
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
128 prtVn <- pretty(range(heaMN, na.rm = TRUE))
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
129 axis(at = scaN / diff(range(prtVn)) * (prtVn - min(prtVn)),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
130 font = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
131 font.axis = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
132 labels = prtVn,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
133 las = 1,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
134 lwd = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
135 lwd.ticks = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
136 side = 4,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
137 xpd = TRUE)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
138
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
139 arrows(par("usr")[2],
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
140 par("usr")[4],
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
141 par("usr")[2],
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
142 par("usr")[3],
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
143 code = 0,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
144 lwd = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
145 xpd = TRUE)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
146
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
147 ## Feature dendrogram
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
148
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
149 par(mar = c(7.1, 0.6, 0, 0.1),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
150 lwd = 2)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
151
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
152 plot(rev(as.dendrogram(feaHcl)), horiz = TRUE,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
153 leaflab = "none",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
154 main = "", xaxs = "i", yaxs = "i",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
155 xaxt = "n", yaxt = "n", xlab = "", ylab = "")
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
156
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
157 revFeaHcl <- list(merge = cbind(feaHcl[["merge"]][, 2], feaHcl[["merge"]][, 1]),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
158 height = feaHcl[["height"]],
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
159 order = rev(feaHcl[["order"]]),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
160 labels = feaHcl[["labels"]])
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
161
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
162 if(cutVarN > 1) {
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
163 cluFeaVn <- cutree(revFeaHcl, k = cutVarN)[revFeaHcl[["order"]]]
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
164 cutFeaVn <- which(abs(diff(cluFeaVn)) > 0)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
165 cutFeaTxtVn <- c(cutFeaVn[1] / 2, cutFeaVn + diff(c(cutFeaVn, length(cluFeaVn))) / 2) + 0.5
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
166 cutFeaLinVn <- cutFeaVn + 0.5
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
167 text(par("usr")[1] + 0.2 * diff(par("usr")[1:2]),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
168 cutFeaTxtVn,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
169 labels = unique(cluFeaVn),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
170 cex = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
171 font = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
172 las = 2)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
173 }
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
174
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
175 ## Observation dendrogram
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
176
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
177 par(mar = c(0.1, 0, 0.6, 7.1),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
178 lwd = 2)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
179
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
180 plot(as.dendrogram(obsHcl), leaflab = "none",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
181 main = "", xaxs = "i", yaxs = "i",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
182 yaxt = "n", xlab = "", ylab = "")
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
183
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
184 if(cutSamN > 1) {
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
185 cluObsVn <- cutree(obsHcl, k = cutSamN)[obsHcl[["order"]]]
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
186 cutObsVn <- which(abs(diff(cluObsVn)) > 0)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
187 cutObsTxtVn <- c(cutObsVn[1] / 2, cutObsVn + diff(c(cutObsVn, length(cluObsVn))) / 2) + 0.5
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
188 cutObsLinVn <- cutObsVn + 0.5
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
189 text(cutObsTxtVn,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
190 0.8 * par("usr")[4],
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
191 labels = unique(cluObsVn),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
192 cex = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
193 font = 2)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
194 }
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
195
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
196 ## Heatmap
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
197
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
198 par(mar = c(7.1, 0, 0, 7.1))
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
199
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
200 image(x = 1:nrow(heaMN),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
201 y = 1:ncol(heaMN),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
202 z = round(heaMN),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
203 col = imaPalVn,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
204 font.axis = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
205 font.lab = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
206 xaxt = "n",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
207 yaxt = "n",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
208 xlab = "",
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
209 ylab = "")
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
210
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
211 obsOrdVc <- obsHcl[["labels"]][obsHcl[["order"]]]
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
212 obsOrdLenVn <- sapply(obsOrdVc, nchar)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
213 obsOrdVc <- substr(obsOrdVc, 1, ncaN)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
214 obsOrdVc <- paste0(obsOrdVc, ifelse(obsOrdLenVn > ncaN, ".", ""), " ")
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
215
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
216 mtext(obsOrdVc,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
217 at = 1:nrow(heaMN),
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
218 cex = cexN,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
219 las = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
220 side = 1)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
221
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
222 feaOrdVc <- feaHcl[["labels"]][feaHcl[["order"]]]
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
223 feaOrdLenVn <- sapply(feaOrdVc, nchar)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
224 feaOrdVc <- substr(feaOrdVc, 1, ncaN)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
225 feaOrdVc <- paste0(" ", feaOrdVc, ifelse(feaOrdLenVn > ncaN, ".", ""))
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
226
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
227 mtext(feaOrdVc,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
228 at = ncol(heaMN):1,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
229 cex = cexN,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
230 las = 2,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
231 side = 4)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
232
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
233 if(cutVarN > 1)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
234 abline(h = cutFeaLinVn)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
235 if(cutSamN > 1)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
236 abline(v = cutObsLinVn)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
237
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
238 box()
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
239
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
240 dev.off()
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
241
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
242 ## Returning
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
243 ##----------
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
244
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
245 if(cutSamN > 1)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
246 obsDF[, "heat_clust"] <- cutree(obsHcl, k = cutSamN)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
247 obsDF <- obsDF[obsHcl[["order"]], , drop = FALSE]
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
248
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
249 if(cutVarN > 1)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
250 feaDF[, "heat_clust"] <- cutree(feaHcl, k = cutVarN)
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
251 feaDF <- feaDF[feaHcl[["order"]], , drop = FALSE]
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
252
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
253 return(invisible(list(proMN = proMN,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
254 obsDF = obsDF,
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
255 feaDF = feaDF)))
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
256
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
257
ad06aeed02c9 planemo upload for repository https://github.com/workflow4metabolomics/heatmap.git commit 7e599d006e53fefb7e1b923ba8894b4fb19f9cfa-dirty
ethevenot
parents:
diff changeset
258 } ## end of heatmapF