Merge branch 'master' of http://pakal.ccg.unam.mx/cmendezc/automatic-extraction-growth-conditions
Showing
7 changed files
with
384 additions
and
0 deletions
CRF/figures/.RData
0 → 100644
No preview for this file type
CRF/figures/.Rhistory
0 → 100644
1 | +library(ggplot2) | ||
2 | +# Run1 | ||
3 | +dfa <- data.frame(Measure=rep(c("Precision", "Recall", "F1-score"), each=4), | ||
4 | +Strategy=rep(c("OD", "Ph", "Technique", "Med", "Temp", "Vess", "Agit", "Phase", "Air", "Anti", "Strain", "Gtype", "Substrain", "Supp", "Gversion"),3), | ||
5 | +Score=c( | ||
6 | +1, 0.405, 0.577, | ||
7 | +1, 1, 1, | ||
8 | +0.88, 1, 0.936, | ||
9 | +0.852, 0.912, 0.881, | ||
10 | +0.818, 1, 0.9, | ||
11 | +0, 0, 0, | ||
12 | +0, 0, 0, | ||
13 | +1, 0.947, 0.973, | ||
14 | +0.92, 0.742, 0.821, | ||
15 | +1, 0.444, 0.615, | ||
16 | +1, 1, 1, | ||
17 | +0.905, 0.811, 0.856, | ||
18 | +0, 0, 0, | ||
19 | +0.883, 0.669, 0.762, | ||
20 | +0, 0, 0 | ||
21 | +)) | ||
22 | +# ECO-DEV-WITH-EFFECT-COMBINATION: Combination of strategies with effect in E. coli development dataset | ||
23 | +dfa <- data.frame(Measure=rep(c("Precision", "Recall", "F1-score"), each=4), | ||
24 | +Strategy=rep(c("Dev", "Dev+Vrb", "Dev+Vrb+Att", "Dev+Vrb+Att+Aut"),3), | ||
25 | +Score=c(0.78, 0.79, 0.81, 0.81, 0.41, 0.56, 0.63, 0.63, 0.53, 0.65, 0.71, 0.71)) | ||
26 | +head(dfa) | ||
27 | +# Run1 | ||
28 | +dfa <- data.frame(Measure=rep(c("Precision", "Recall", "F1-score"), each=15), | ||
29 | +Strategy=rep(c("OD", "Ph", "Technique", "Med", "Temp", "Vess", "Agit", "Phase", "Air", "Anti", "Strain", "Gtype", "Substrain", "Supp", "Gversion"),3), | ||
30 | +Score=c( | ||
31 | +1, 1, 0.88, 0.852, 0.818, 0, 0, 1, 0.92, 1, 1, 0.905, 0, 0.883, 0, | ||
32 | +0.405, 1, 1, 0.912, 1, 0, 0, 0.947, 0.742, 0.444, 1, 0.811, 0, 0.669, 0 | ||
33 | +0.577, 1, 0.936, 0.881, 0.9, 0, 0, 0.973, 0.821, 0.615, 1, 0.856, 0, 0.762, 0 | ||
34 | +)) | ||
35 | +# Run1 | ||
36 | +dfa <- data.frame(Measure=rep(c("Precision", "Recall", "F1-score"), each=15), | ||
37 | +Strategy=rep(c("OD", "Ph", "Technique", "Med", "Temp", "Vess", "Agit", "Phase", "Air", "Anti", "Strain", "Gtype", "Substrain", "Supp", "Gversion"),3), | ||
38 | +Score=c( | ||
39 | +1, 1, 0.88, 0.852, 0.818, 0, 0, 1, 0.92, 1, 1, 0.905, 0, 0.883, 0, | ||
40 | +0.405, 1, 1, 0.912, 1, 0, 0, 0.947, 0.742, 0.444, 1, 0.811, 0, 0.669, 0, | ||
41 | +0.577, 1, 0.936, 0.881, 0.9, 0, 0, 0.973, 0.821, 0.615, 1, 0.856, 0, 0.762, 0 | ||
42 | +)) | ||
43 | +head(dfa) | ||
44 | +pa<-ggplot(dfa, aes(x=Strategy, y=Score, group=Measure)) + | ||
45 | +geom_line(aes(color=Measure))+ | ||
46 | +geom_point(aes(color=Measure))+ | ||
47 | +scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))+ | ||
48 | +#scale_color_manual(values=c("#e6194b", "#3cb44b", "#0082c8"))+ | ||
49 | +geom_text(aes(label = Score))+ | ||
50 | +labs(title="Combination of strategies with effect in E. coli development dataset",x="Combination of strategies", y = "Score")+ | ||
51 | +#labs(title="(a)",x="Combination of strategies", y = "Score")+ | ||
52 | +theme_classic() | ||
53 | +pa | ||
54 | +title_plot = "Salmonella evaluation dataset" | ||
55 | +pa<-ggplot(df, aes(x=Strategy, y=Score, group=Measure)) + | ||
56 | +geom_line(aes(color=Measure))+ | ||
57 | +geom_point(aes(color=Measure))+ | ||
58 | +scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))+ | ||
59 | +#scale_color_manual(values=c("#e6194b", "#3cb44b", "#0082c8"))+ | ||
60 | +geom_text(aes(label = Score))+ | ||
61 | +labs(title=title_plot,x="Strategies", y = "Score")+ | ||
62 | +#theme_classic()+ | ||
63 | +theme( | ||
64 | +legend.position="top", | ||
65 | +# Centrar título: plot.title = element_text(hjust = 0.5), | ||
66 | +axis.line = element_line(colour = "gray"), | ||
67 | +panel.background = element_blank(), | ||
68 | +panel.grid.major = element_blank(), | ||
69 | +panel.grid.minor = element_blank(), | ||
70 | +panel.border = element_blank(), | ||
71 | +) | ||
72 | +pa<-ggplot(dfa, aes(x=Strategy, y=Score, group=Measure)) + | ||
73 | +geom_line(aes(color=Measure))+ | ||
74 | +geom_point(aes(color=Measure))+ | ||
75 | +scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))+ | ||
76 | +#scale_color_manual(values=c("#e6194b", "#3cb44b", "#0082c8"))+ | ||
77 | +geom_text(aes(label = Score))+ | ||
78 | +labs(title="Combination of strategies with effect in E. coli development dataset",x="Combination of strategies", y = "Score")+ | ||
79 | +#labs(title="(a)",x="Combination of strategies", y = "Score")+ | ||
80 | +theme( | ||
81 | +legend.position="top", | ||
82 | +# Centrar título: plot.title = element_text(hjust = 0.5), | ||
83 | +axis.line = element_line(colour = "gray"), | ||
84 | +panel.background = element_blank(), | ||
85 | +panel.grid.major = element_blank(), | ||
86 | +panel.grid.minor = element_blank(), | ||
87 | +panel.border = element_blank() | ||
88 | +) | ||
89 | +pa | ||
90 | +ggsave(".png") | ||
91 | +pa | ||
92 | +pa<-ggplot(dfa, aes(x=Strategy, y=Score, group=Measure)) + | ||
93 | +geom_line(aes(color=Measure))+ | ||
94 | +geom_point(aes(color=Measure))+ | ||
95 | +scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))+ | ||
96 | +#scale_color_manual(values=c("#e6194b", "#3cb44b", "#0082c8"))+ | ||
97 | +geom_text(aes(label = Score))+ | ||
98 | +labs(title="Prediction of best model (Run1)",x="Conditions", y = "Score")+ | ||
99 | +#labs(title="(a)",x="Combination of strategies", y = "Score")+ | ||
100 | +theme( | ||
101 | +legend.position="top", | ||
102 | +# Centrar título: plot.title = element_text(hjust = 0.5), | ||
103 | +axis.line = element_line(colour = "gray"), | ||
104 | +panel.background = element_blank(), | ||
105 | +panel.grid.major = element_blank(), | ||
106 | +panel.grid.minor = element_blank(), | ||
107 | +panel.border = element_blank() | ||
108 | +) | ||
109 | +pa | ||
110 | +# Run1 | ||
111 | +dfa <- data.frame(Measure=rep(c("Precision", "Recall", "F1-score"), each=15), | ||
112 | +Strategy=rep(c( | ||
113 | +"Agit", | ||
114 | +"Gversion", | ||
115 | +"Substrain", | ||
116 | +"Vess", | ||
117 | +"OD", | ||
118 | +"Anti", | ||
119 | +"Supp", | ||
120 | +"Air", | ||
121 | +"Gtype", | ||
122 | +"Med", | ||
123 | +"Temp", | ||
124 | +"Technique", | ||
125 | +"Phase", | ||
126 | +"pH", | ||
127 | +"Strain" | ||
128 | +),3), | ||
129 | +Score=c( | ||
130 | +0, | ||
131 | +0, | ||
132 | +0, | ||
133 | +0, | ||
134 | +1, | ||
135 | +1, | ||
136 | +0.883, | ||
137 | +0.92, | ||
138 | +0.905, | ||
139 | +0.852, | ||
140 | +0.818, | ||
141 | +0.88, | ||
142 | +1, | ||
143 | +1, | ||
144 | +1, | ||
145 | +0, | ||
146 | +0, | ||
147 | +0, | ||
148 | +0, | ||
149 | +0.405, | ||
150 | +0.444, | ||
151 | +0.669, | ||
152 | +0.742, | ||
153 | +0.811, | ||
154 | +0.912, | ||
155 | +1, | ||
156 | +1, | ||
157 | +0.947, | ||
158 | +1, | ||
159 | +1, | ||
160 | +0, | ||
161 | +0, | ||
162 | +0, | ||
163 | +0, | ||
164 | +0.577, | ||
165 | +0.615, | ||
166 | +0.762, | ||
167 | +0.821, | ||
168 | +0.856, | ||
169 | +0.881, | ||
170 | +0.9, | ||
171 | +0.936, | ||
172 | +0.973, | ||
173 | +1, | ||
174 | +1 | ||
175 | +)) | ||
176 | +head(dfa) | ||
177 | +pa<-ggplot(dfa, aes(x=Strategy, y=Score, group=Measure)) + | ||
178 | +geom_line(aes(color=Measure))+ | ||
179 | +geom_point(aes(color=Measure))+ | ||
180 | +scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))+ | ||
181 | +#scale_color_manual(values=c("#e6194b", "#3cb44b", "#0082c8"))+ | ||
182 | +geom_text(aes(label = Score))+ | ||
183 | +labs(title="Prediction of the best model (Run1)",x="Conditions", y = "Score")+ | ||
184 | +theme( | ||
185 | +legend.position="top", | ||
186 | +# Centrar título: plot.title = element_text(hjust = 0.5), | ||
187 | +axis.line = element_line(colour = "gray"), | ||
188 | +panel.background = element_blank(), | ||
189 | +panel.grid.major = element_blank(), | ||
190 | +panel.grid.minor = element_blank(), | ||
191 | +panel.border = element_blank() | ||
192 | +) | ||
193 | +pa | ||
194 | +pa<-ggplot(dfa, aes(x=Strategy, y=Score, group=Measure)) + | ||
195 | +geom_line(aes(color=Measure, stat="identity"))+ | ||
196 | +geom_point(aes(color=Measure))+ | ||
197 | +scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))+ | ||
198 | +#scale_color_manual(values=c("#e6194b", "#3cb44b", "#0082c8"))+ | ||
199 | +geom_text(aes(label = Score))+ | ||
200 | +labs(title="Prediction of the best model (Run1)",x="Conditions", y = "Score")+ | ||
201 | +theme( | ||
202 | +legend.position="top", | ||
203 | +# Centrar título: plot.title = element_text(hjust = 0.5), | ||
204 | +axis.line = element_line(colour = "gray"), | ||
205 | +panel.background = element_blank(), | ||
206 | +panel.grid.major = element_blank(), | ||
207 | +panel.grid.minor = element_blank(), | ||
208 | +panel.border = element_blank() | ||
209 | +) | ||
210 | +pa<-ggplot(dfa, aes(x=Strategy, y=Score, group=Measure)) + | ||
211 | +geom_line(aes(color=Measure), stat="identity")+ | ||
212 | +geom_point(aes(color=Measure))+ | ||
213 | +scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))+ | ||
214 | +#scale_color_manual(values=c("#e6194b", "#3cb44b", "#0082c8"))+ | ||
215 | +geom_text(aes(label = Score))+ | ||
216 | +labs(title="Prediction of the best model (Run1)",x="Conditions", y = "Score")+ | ||
217 | +theme( | ||
218 | +legend.position="top", | ||
219 | +# Centrar título: plot.title = element_text(hjust = 0.5), | ||
220 | +axis.line = element_line(colour = "gray"), | ||
221 | +panel.background = element_blank(), | ||
222 | +panel.grid.major = element_blank(), | ||
223 | +panel.grid.minor = element_blank(), | ||
224 | +panel.border = element_blank() | ||
225 | +) | ||
226 | +pa |
CRF/figures/line-plots-CRF.R
0 → 100644
1 | +# Based on http://www.sthda.com/english/wiki/ggplot2-line-plot-quick-start-guide-r-software-and-data-visualization | ||
2 | + | ||
3 | +library(ggplot2) | ||
4 | +#library(ggpubr) | ||
5 | +#library(cowplot) | ||
6 | + | ||
7 | +######### BEST MODELS ########## | ||
8 | + | ||
9 | +# Run1 | ||
10 | +dfa <- data.frame(Measure=rep(c("Precision", "Recall", "F1-score"), each=15), | ||
11 | + Strategy=rep(c( | ||
12 | + "Agit", | ||
13 | + "Gversion", | ||
14 | + "Substrain", | ||
15 | + "Vess", | ||
16 | + "OD", | ||
17 | + "Anti", | ||
18 | + "Supp", | ||
19 | + "Air", | ||
20 | + "Gtype", | ||
21 | + "Med", | ||
22 | + "Temp", | ||
23 | + "Technique", | ||
24 | + "Phase", | ||
25 | + "pH", | ||
26 | + "Strain" | ||
27 | + ),3), | ||
28 | + Score=c( | ||
29 | + 0, | ||
30 | + 0, | ||
31 | + 0, | ||
32 | + 0, | ||
33 | + 1, | ||
34 | + 1, | ||
35 | + 0.883, | ||
36 | + 0.92, | ||
37 | + 0.905, | ||
38 | + 0.852, | ||
39 | + 0.818, | ||
40 | + 0.88, | ||
41 | + 1, | ||
42 | + 1, | ||
43 | + 1, | ||
44 | + 0, | ||
45 | + 0, | ||
46 | + 0, | ||
47 | + 0, | ||
48 | + 0.405, | ||
49 | + 0.444, | ||
50 | + 0.669, | ||
51 | + 0.742, | ||
52 | + 0.811, | ||
53 | + 0.912, | ||
54 | + 1, | ||
55 | + 1, | ||
56 | + 0.947, | ||
57 | + 1, | ||
58 | + 1, | ||
59 | + 0, | ||
60 | + 0, | ||
61 | + 0, | ||
62 | + 0, | ||
63 | + 0.577, | ||
64 | + 0.615, | ||
65 | + 0.762, | ||
66 | + 0.821, | ||
67 | + 0.856, | ||
68 | + 0.881, | ||
69 | + 0.9, | ||
70 | + 0.936, | ||
71 | + 0.973, | ||
72 | + 1, | ||
73 | + 1 | ||
74 | + )) | ||
75 | +head(dfa) | ||
76 | + | ||
77 | +pa<-ggplot(dfa, aes(x=Strategy, y=Score, group=Measure)) + | ||
78 | + geom_line(aes(color=Measure))+ | ||
79 | + geom_point(aes(color=Measure))+ | ||
80 | + scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))+ | ||
81 | + #scale_color_manual(values=c("#e6194b", "#3cb44b", "#0082c8"))+ | ||
82 | + geom_text(aes(label = Score))+ | ||
83 | + labs(title="Prediction of the best model (Run1)",x="Conditions", y = "Score")+ | ||
84 | + theme( | ||
85 | + legend.position="top", | ||
86 | + # Centrar título: plot.title = element_text(hjust = 0.5), | ||
87 | + axis.line = element_line(colour = "gray"), | ||
88 | + panel.background = element_blank(), | ||
89 | + panel.grid.major = element_blank(), | ||
90 | + panel.grid.minor = element_blank(), | ||
91 | + panel.border = element_blank() | ||
92 | + ) | ||
93 | +pa | ||
94 | + | ||
95 | +ggsave(".png") | ||
96 | + |
CRF/figures/line-plots-milti-panel.R
0 → 100644
1 | +# Based on http://zevross.com/blog/2019/04/02/easy-multi-panel-plots-in-r-using-facet_wrap-and-facet_grid-from-ggplot2/ | ||
2 | + | ||
3 | +library(ggplot2) | ||
4 | +#library(ggpubr) | ||
5 | +#library(cowplot) | ||
6 | + | ||
7 | +organism = 'ECO' | ||
8 | + | ||
9 | +if (organism == 'ECO') { | ||
10 | +######### ECO DEVELOPMENT DATASET ########## | ||
11 | + | ||
12 | +# ECO-DEV-WITH-EFFECT-COMBINATION: Combination of strategies with effect in E. coli development dataset | ||
13 | +df <- data.frame(Panel=rep(c("Combination of strategies (effect)", "Separated strategies (effect)", "Combination of strategies (no effect)", "Separated strategies (no effect)"), each=12), | ||
14 | + Measure=rep(c("Precision", "Recall", "F1-score"), each=4), | ||
15 | + Strategy=c(rep(c("D", "D+V", "D+V+At", "D+V+At+Au"),3),rep(c("D", "V", "At", "Au"),3)), | ||
16 | + Score=c( | ||
17 | + 0.78, 0.79, 0.81, 0.81, 0.41, 0.56, 0.63, 0.63, 0.53, 0.65, 0.71, 0.71, | ||
18 | + 0.78, 0.89, 0.93, 1.00, 0.41, 0.35, 0.13, 0.01, 0.53, 0.50, 0.23, 0.02, | ||
19 | + 0.82, 0.82, 0.84, 0.84, 0.55, 0.66, 0.72, 0.72, 0.66, 0.73, 0.78, 0.78, | ||
20 | + 0.82, 0.88, 0.94, 1.00, 0.55, 0.39, 0.20, 0.01, 0.66, 0.54, 0.33, 0.02)) | ||
21 | +filename = "ECO-dev-multi-panel.png" | ||
22 | +title_plot = "E. coli development dataset" | ||
23 | +} else if (organism == 'STM') | ||
24 | +{ | ||
25 | +######### STM DEVELOPMENT DATASET ########## | ||
26 | + | ||
27 | +# STM-DEV-WITH-EFFECT-COMBINATION: Combination of strategies with effect in Salmonella evaluation dataset | ||
28 | +df <- data.frame(Panel=rep(c("Combination of strategies (effect)", "Separated strategies (effect)", "Combination of strategies (no effect)", "Separated strategies (no effect)"), each=12), | ||
29 | + Measure=rep(c("Precision", "Recall", "F1-score"), each=4), | ||
30 | + Strategy=c(rep(c("D", "D+V", "D+V+At", "D+V+At+Au"),3),rep(c("D", "V", "At", "Au"),3)), | ||
31 | + Score=c( | ||
32 | + 0.78, 0.77, 0.76, 0.76, 0.33, 0.49, 0.54, 0.54, 0.47, 0.60, 0.63, 0.63, | ||
33 | + 0.78, 0.81, 0.70, 0.88, 0.33, 0.33, 0.10, 0.01, 0.47, 0.47, 0.18, 0.02, | ||
34 | + 0.84, 0.82, 0.81, 0.81, 0.47, 0.59, 0.65, 0.65, 0.60, 0.68, 0.72, 0.72, | ||
35 | + 0.84, 0.84, 0.77, 0.86, 0.47, 0.40, 0.17, 0.01, 0.60, 0.55, 0.27, 0.02)) | ||
36 | +filename = "STM-dev-multi-panel.png" | ||
37 | +title_plot = "Salmonella evaluation dataset" | ||
38 | +} | ||
39 | + | ||
40 | +head(df) | ||
41 | + | ||
42 | +pa<-ggplot(df, aes(x=Strategy, y=Score, group=Measure)) + | ||
43 | + geom_line(aes(color=Measure))+ | ||
44 | + geom_point(aes(color=Measure))+ | ||
45 | + scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"))+ | ||
46 | + #scale_color_manual(values=c("#e6194b", "#3cb44b", "#0082c8"))+ | ||
47 | + geom_text(aes(label = Score))+ | ||
48 | + labs(title=title_plot,x="Strategies", y = "Score")+ | ||
49 | + #theme_classic()+ | ||
50 | + theme( | ||
51 | + legend.position="top", | ||
52 | + # Centrar título: plot.title = element_text(hjust = 0.5), | ||
53 | + axis.line = element_line(colour = "gray"), | ||
54 | + panel.background = element_blank(), | ||
55 | + panel.grid.major = element_blank(), | ||
56 | + panel.grid.minor = element_blank(), | ||
57 | + panel.border = element_blank(), | ||
58 | + )+ | ||
59 | + facet_wrap(~Panel, scale="free") | ||
60 | + | ||
61 | +ggsave(filename) | ||
62 | + |
CRF/figures/scores-by-condition-Run1.jpeg
0 → 100644

86.5 KB
CRF/figures/scores-by-condition-Run7.jpeg
0 → 100644

90.7 KB
CRF/figures/scores_Run1.pdf
0 → 100644
No preview for this file type
-
Please register or login to post a comment