-
Notifications
You must be signed in to change notification settings - Fork 0
/
analysis3.R
207 lines (155 loc) · 7.47 KB
/
analysis3.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
orgList <- c("ce10.chrV", "hg38.chr22", "ce10.chrV", "hg38.chr18.sim")
read.file <- function(file) {
T <- read.table(file, header = TRUE)
return(T)
}
read.stats <- function() {
seeds32 <<- read.table("seeds32.stats.txt", header = TRUE)
RptSct <<- read.table("RptSct.stats.txt", header = TRUE)
TList <<- lapply(orgList, function(o) subset(seeds32, org == o))
names(TList) <<- orgList;
}
add.legend <- function(position) {
legend(position, c("RM", "PRA"), col = c('blue', 'green'),
lty = c('solid', 'solid', 'solid', 'solid'))
}
plot.gen <- function(org_name, x_col, y_col, xlab = NA, ylab = NA, main = NA,
xlim = NA, ylim = NA, legend_position = "topleft", new_plot = TRUE,
reverse_x = FALSE, reverse_y = FALSE) {
PH = subset(seeds32, org == org_name, select = c(x_col,y_col))
RS = subset(RptSct, org == org_name, select = c(x_col,y_col))
if (is.na(xlim)) {
xlim = range(PH[[x_col]], rm.na = TRUE)
}
if (is.na(ylim)) {
ylim = range(c(PH[[y_col]], RS[[y_col]]));
}
if (reverse_x) {
xlim = rev(xlim)
}
if (reverse_y) {
ylim = rev(ylim)
}
if (new_plot) {
plot(c(), c(), xlim = xlim, ylim = ylim, xlab = xlab, ylab = ylab, main = main)
}
abline(h = RS[1,y_col], col = 'red')
points(PH[[x_col]], PH[[y_col]], col = 'blue')
}
plot.test <- function(org_name, x_axis = "w.l", x_label = "w/l") {
par(mfrow=c(2,2))
PH = subset(seeds32, org == org_name)
RS = subset(RptSct, org == org_name)
# First the Masking-metric
xlim = range(PH$x_axis)
ylim = range(c(PH$tpr, PH$QuCoverage, RS$tpr, RS$QuCoverage))
plot(c(), c(), xlim = xlim, ylim = ylim, xlab = "x_label", ylab = "", main = "Sensitivity")
}
fixed_plots <- function() {
par(mfrow=c(3,3))
plot.sen.by.len("ce10.chrV", stats1)
plot.sen.by.ratio("ce10.chrV", stats2)
plot.sen.by.ratio("ce10.chrV", stats3)
plot.sen.by.ratio("ce10.chrV", stats4)
plot.sen.by.ratio("ce10.chrV", stats5)
plot.sen.by.ratio("ce10.chrV", stats6)
plot.sen.by.ratio("ce10.chrV", stats7)
}
############################################
plot.runtimes <- function() {
RT <- read.table("runtime.txt", header=TRUE)
RT$size = RT$size / 1000000
RT <- RT[RT$size > 0,]
plot(c(), c(), xlim = range(RT$size), ylim = range(RT$time, na.rm = TRUE), main="Runtime",
xlab = "Genome size (Mb)", ylab = "Tool runtime (seconds)")
#LMER = RT[RT$tool=="LMER",]
#points(LMER$size, LMER$time, col = 'green')
RS = RT[RT$tool=="RepeatScout",]
points(RS$size, RS$time, col='red')
PHRA = RT[RT$tool=="phRAIDER" & RT$seed==1,]
points(PHRA$size, PHRA$time, col='blue')
RA = RT[RT$tool=="RAIDER" & RT$seed==1,]
points(RA$size, RA$time, col='purple')
PRE = RT[RT$tool=="pre-phRAIDER" & RT$seed==1,]
points(PRE$size, PRE$time, col='black')
}
plot.mem <- function() {
RT <- read.table("runtime.txt", header=TRUE)
RT$size = RT$size / 1000000
RT$mem = RT$mem / 1000000
RT <- RT[RT$size > 0,]
plot(c(), c(), xlim = range(RT$size), ylim = range(RT$mem, na.rm = TRUE), main="Memory",
xlab = "Genome size (Mb)", ylab = "Tool memory (GB)")
#LMER = RT[RT$tool=="LMER",]
#points(LMER$size, LMER$mem, col = 'green')
RS = RT[RT$tool=="RepeatScout",]
points(RS$size, RS$mem, col='red')
PHRA = RT[RT$tool=="phRAIDER" & RT$seed==1,]
points(PHRA$size, PHRA$mem, col='blue')
RA = RT[RT$tool=="RAIDER" & RT$seed==1,]
points(RA$size, RA$mem, col='purple')
PRE = RT[RT$tool=="pre-phRAIDER" & RT$seed==1,]
points(PRE$size, PRE$mem, col='black')
}
plot.by_seed <- function(tool, column = "time") {
RT <- read.table("runtime.txt", header=TRUE)
RT$size = RT$size / 1000000
RT$mem = RT$mem / 1000000
RT <- RT[RT$size > 0,]
RT <- RT[RT$tool == tool,]
plot(c(), c(), xlim = range(RT$size), ylim = range(RT[[column]]))
R1 <- RT[RT$seed == 0,]
points(R1$size, R1[[column]], col = 'blue')
R2 <- RT[RT$seed == 1,]
points(R2$size, R2[[column]], col = 'red')
return(list(RT, R1, R2))
}
fig1Plot <- function() {
RT <- read.table("runtime.txt", header=TRUE)
RT <- subset(RT, size > 20000)
RT$size <- RT$size / 1000000
RT$mem <- RT$mem / 1000000
#quartz()
par(mfrow=c(4,2))
# Make RS table. (Need to add lmer and RS times/mem.)
RS = subset(RT, tool == "RepeatScout")
LM = subset(RT, tool == "LMER")
RSLM = merge(RS, LM, by = c("label","size","seed","f"), suffixes = c(".RS", ".LM"))
PH0 <- subset(RT, tool == "phRAIDER" & seed == 0)
PH1 <- subset(RT, tool == "phRAIDER" & seed == 1)
PPH1 <- subset(RT, tool == 'pre-phRAIDER' & seed == 1)
# First: runtimes for phRAIDER and RptScout
plot(c(), c(), xlim = range(c(RS$size, PH1$size)), ylim = range(c(RSLM$time.RS, RSLM$timeLM, PH1$time)), xlab = "Genome size (Mb)", ylab = "Runtime (seconds)", main = "Runtime: phRAIDER v. RptScout")
with(RSLM, points(size, time.RS + time.LM, col = 'red'))
with(PH1, points(size, time, col = 'blue', pch = 2))
with(PPH1, points(size, time, col = 'green', pch = 3))
legend("topleft", c("RepeatScout", "phRAIDER", "pre-phRAIDER"), col = c('red', 'blue', 'green'), pch = c(1,2,3))
# Second: memory usage for phRAIDER and RptScout
plot(c(), c(), xlim = range(c(RS$size, PH1$size)), ylim = range(c(RSLM$mem.RS, RSLM$mem.LM, PH1$mem)), xlab = "Genome size (Mb)", ylab = "Memory required (Gb)", main = "Memory: phRAIDER v. RptScout")
with(RSLM, points(size, mem.RS + mem.LM, col = 'red'))
with(PH1, points(size, mem, col = 'blue', pch = 2))
with(PPH1, points(size, mem, col = 'green', pch = 3))
legend("topleft", c("RepeatScout", "phRAIDER", "pre-phRAIDER"), col = c('red', 'blue', 'green'), pch = c(1,2,3))
# Third: runtime for phRAIDER on different seeds
plot(c(), c(), xlim = range(RT$size), ylim = range(c(PH0$time, PH1$time), na.rm = TRUE), xlab = "Genome size (Mb)", ylab = "Runtime (seconds)", main = "Runtime for phRAIDER on different seeds")
colors = c('blue', 'black')
for (s in c(0,1)) {
with(subset(RT, tool=='phRAIDER' & seed==s), points(size, time, col = colors[[s+1]], pch = s))
}
legend("topleft", c("phRAIDER seed 1", "phRAIDER seed 2"), col = c('blue', 'black'), pch = c(1,2))
plot(c(), c(), xlim = range(RT$size), ylim = range(c(PH0$mem, PH1$mem), na.rm = TRUE), xlab = "Genome size Mb)", ylab = "Runtime (seconds)", main = "Memory usage for phRAIDER on different seeds")
colors = c('blue', 'black')
for (s in c(0,1)) {
with(subset(RT, tool=='phRAIDER' & seed==s), points(size, mem, col = colors[[s+1]], pch = s+1))
}
legend("topleft", c("phRAIDER seed 1", "phRAIDER seed 2"), col = c('blue', 'black'), pch = c(1,2))
RT <- read.table("runtime2.txt", header=TRUE)
T1 <- subset(RT, w==l)
with(T1, plot(l, time, xlim = range(l), ylim = range(time), xlab = "Seed length (w/l = 1)", ylab = "Runtime (seconds)", main = "Runtime for phRAIDER as a function of seed length (ungapped)"))
with(T1, plot(l, mem, xlim = range(l), ylim = range(mem), xlab = "Seed length (w/l = 1)", ylab = "Memory (Gb)", main = "Memory usage for phRAIDER as a function of seed length (ungapped)"))
RT <- read.table("runtime2.txt", header=TRUE)
T1 <- subset(RT, w==40)
with(T1, plot(w/l, time, xlim = range(w/l), ylim = range(time), xlab = "w/l (w = 40)", ylab = "Runtime (seconds)", main = "Runtime for phRAIDER as a function of seed width/length ratio"))
with(T1, plot(w/l, mem, xlim = range(w/l), ylim = range(mem), xlab = "w/l (w = 40)", ylab = "Memory (Gb)", main = "Memory usage for phRAIDER as a function of seed width/length ratio"))
return(T1);
}