-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathRegressionSampleSolutions-ShowPlot.R
65 lines (57 loc) · 1.87 KB
/
RegressionSampleSolutions-ShowPlot.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# RegressionSampleSolutions-ShowPlot.R
#
# Purpose: show the final plot for the EDA Regression unit
# Version: 1.0
# Date: 2019 05
# Author: Boris Steipe
#
# Input: NA
# Output: NA - plot as side-effect
# Dependencies: ./sampleSolutions/dat3c7be868.RData must exist
#
# ToDo:
# Notes:
#
# ==============================================================================
# Prepare:
# load("./data/CCgenes.RData")
# load("./data/ygProfiles.RData")
# dat3c7be868 <- CCgenes
# datd294e201 <- ygProfiles
# rm(CCgenes)
# rm(ygProfiles)
#
# save(dat3c7be868, datd294e201, file = "./sampleSolutions/dat3c7be868.RData")
load("./sampleSolutions/dat3c7be868.RData")
exVals <- matrix(numeric(ncol(datd294e201) * nrow(dat3c7be868)),
nrow = ncol(datd294e201), ncol = nrow(dat3c7be868))
# ... load it with (scaled) expression profiles, from CCgenes - i.e. ordered by
# expression peak
N <- nrow(dat3c7be868)
for (iRow in 1:N) {
exVals[ , N - iRow + 1] <- scale(datd294e201[dat3c7be868$i[iRow], ])
}
rownames(exVals) <- colnames(datd294e201)
colnames(exVals) <- dat3c7be868$ID
# ... plot as image
image(exVals,
col = colorRampPalette(c("#1cacf3",
"#1cacf3",
"#0f8a94",
"#000000",
"#000000",
"#9f388a",
"#de2f5d",
"#de2f5d"))(256),
xaxt = "n", yaxt = "n", xlab = "time (min.)", ylab= "rank of phase",
main = "Cell cycle progression")
axis(1, at = seq(0, 1, length.out = 25),
labels = seq(0, 120, by = 5), cex.axis = 0.5)
abline(v = 0.5 + (1/50), col = "white", lwd = 0.5)
yTicks <- 1 - (c(100, 300, 500, 700) / N)
axis(2, at = yTicks, labels = c("100", "300", "500", "700"))
# clean up
rm(exVals, iRow, N, yTicks)
rm(dat3c7be868)
rm(datd294e201)
# [END]