-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathparse_benchmarks.pl
More file actions
63 lines (52 loc) · 1.18 KB
/
Copy pathparse_benchmarks.pl
File metadata and controls
63 lines (52 loc) · 1.18 KB
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
=pod
Parse out the benchmark data for the prophage callers and make a table
Rob Edwards, 2020
=cut
use strict;
use Getopt::Std;
use Data::Dumper;
use FindBin qw($RealBin);
use lib "$RealBin/../ProphagePredictionsLib";
use Rob;
my $rob = new Rob;
my %opts;
getopts('d:c:hv', \%opts);
unless ($opts{d} && $opts{c}) {
die <<EOF;
$0
-d directory of benchmark results (required)
-c prophage caller (required)
-h print header
-v verbose output
EOF
}
opendir(DIR, $opts{d}) || die "CAn't open $opts{d}";
foreach my $f (grep {$_ !~ /^\./} readdir(DIR)) {
open(IN, "$opts{d}/$f") || die "can't open $opts{d}/$f";
my $first = 1;
while (<IN>) {
if ($first && $_ !~ /mean_load/) {
print STDERR "$f does not appear to be a benchmark file. Skipped\n";
close IN;
next;
}
if ($first) {
if ($opts{h}) {
chomp;
my @p = split /\s+/;
print join("\t", "Prophage Caller", "Genome", @p), "\n";
undef $opts{h};
}
$first = 0;
next}
chomp;
my @p = split /\s+/;
unless ($#p == 9) {
print STDERR "$f does not appear to be a benchmark file. Too many columns in $_. Skipped\n";
next;
}
print join("\t", "$opts{c}", $f, @p);
print "\n";
}
close IN;
}