Skip to content

Commit 2be3750

Browse files
committed
Added script for summary figures.
1 parent ae8fde9 commit 2be3750

File tree

3 files changed

+54
-4
lines changed

3 files changed

+54
-4
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@ Timing information will be recorded in files times1.dat and times2.dat within ea
3030
generated directories `singleThread`, `doubleThread`, `fourThread` and `GPU`.
3131

3232
Run the perl script `summarise*.pl` specific to your OS to produce the summary.
33+
34+
If you've run the `summariseLinux.pl` script, a table is produced in `data_frame.txt`
35+
which can be read into R. This can be visualized using the `plot_summary.R` R script.

plot_summary.R

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
require(ggplot2)
2+
library(gridExtra)
3+
4+
grid_arrange_shared_legend <- function(...) {
5+
plots <- list(...)
6+
g <- ggplotGrob(plots[[1]] + theme(legend.position="bottom"))$grobs
7+
legend <- g[[which(sapply(g, function(x) x$name) == "guide-box")]]
8+
lheight <- sum(legend$height)
9+
grid.arrange(
10+
do.call(arrangeGrob, lapply(plots, function(x)
11+
x + theme(legend.position="none"))),
12+
legend,
13+
ncol = 1,
14+
heights = unit.c(unit(1, "npc") - lheight, lheight))
15+
}
16+
17+
df <- read.table("data_frame.txt", header=T)
18+
19+
models <- c("GTR", "GTR.G", "GTR.I", "GTR.G.I")
20+
modelLabels <- c("GTR", "GTR+G", "GTR+I", "GTR+G+I")
21+
runs <- levels(df$run)
22+
23+
for (run in runs) {
24+
25+
pdf(paste(run,"_summary.pdf",sep=""), width=7, height=7, onefile=F)
26+
p <- list()
27+
for (m in 1:length(models)) {
28+
p[[m]] <- ggplot(df[df$run==run & df$model==models[m],])
29+
p[[m]] <- p[[m]] + geom_bar(aes(dataset, time, fill=version), stat="identity", position="dodge")
30+
p[[m]] <- p[[m]] + scale_y_log10()
31+
p[[m]] <- p[[m]] + theme(axis.text.x = element_text(angle=90, vjust=0.5, hjust=1))
32+
p[[m]] <- p[[m]] + labs(title=modelLabels[m], x="Dataset", y="Time (seconds)")
33+
}
34+
grid_arrange_shared_legend(p[[1]], p[[2]], p[[3]], p[[4]])
35+
dev.off()
36+
37+
}

summariseLinux.pl

100644100755
+14-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
@d = ("M1044 50 1133 493","M1366 41 1137 769","M1510 36 1812 1020","M1748 67 955 336","M1749 74 2253 1673","M1809 59 1824 1037","M336 27 1949 934","M3475 50 378 256","M501 29 2520 1253","M520 67 1098 534","M755 64 1008 407","M767 71 1082 446", "bench1 1441 987 593", "bench2 62 10869 5565", "old 17 1485 138");
1+
#!/usr/bin/env perl
2+
3+
@d = ("1044 50 1133 493","1366 41 1137 769","1510 36 1812 1020","1748 67 955 336","1749 74 2253 1673","1809 59 1824 1037","336 27 1949 934","3475 50 378 256","501 29 2520 1253","520 67 1098 534","755 64 1008 407","767 71 1082 446", "bench1 1441 987 593", "bench2 62 10869 5565", "old 17 1485 138");
4+
5+
@m = ("GTR.G.I", "GTR.G", "GTR.I", "GTR");
6+
7+
open(FOUT, ">data_frame.txt");
8+
print FOUT "version run dataset taxa sites patterns model time\n";
29

310
process("singleThread");
411
showResult();
@@ -12,6 +19,8 @@
1219
process("GPU");
1320
showResult();
1421

22+
close FOUT;
23+
1524
sub process {
1625
$dir = shift;
1726
undef(@beast1);
@@ -44,18 +53,19 @@ sub process {
4453
}
4554

4655

47-
48-
4956
sub showResult {
5057
print "\n\n$dir\n";
5158
print "dataset taxa sites patterns GTR . GTR+I . GTR+G . GTR+G+I\n";
5259
print ". . . . BEAST1 BEAST2 BEAST1 BEAST2 BEAST1 BEAST2 BEAST1 BEAST2\n";
5360
for ($i = 0; $i < 15; $i++) {
54-
print "M$d[$i]\t";
61+
print "$d[$i]\t";
5562
for ($j = 3; $j >= 0; $j--) {
5663
print "$beast1[$j][$i]\t$beast2[$j][$i]\t";
64+
print FOUT "BEAST1\t$dir\t$d[$i]\t$m[$j]\t$beast1[$j][$i]\n";
65+
print FOUT "BEAST2\t$dir\t$d[$i]\t$m[$j]\t$beast2[$j][$i]\n";
5766
}
5867
print "\n";
68+
5969
}
6070
print "\n";
6171
}

0 commit comments

Comments
 (0)