-
Notifications
You must be signed in to change notification settings - Fork 0
/
stat.pl
33 lines (26 loc) · 810 Bytes
/
stat.pl
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
use strict;
use warnings;
my $c = 0;
my @stats;
print join("\t", 'Pop', 'Y', 'y', 'p'), "\n";
#my @bands = (1000000,100000,50000,10000,5000,2500,1000);
my $width = 20;
<>;
while (<>) {
chomp;
my ($name, undef, $loc, undef, $pop, $what, $sp) = split "\t";
next unless $name;
#next unless $name =~ /^[A-Za-z']+$/;
$c++;
$stats[int($c/$width)]{max} = $pop unless defined $stats[int($c/$width)];
$stats[int($c/$width)]{$sp}++;
#my @accum = (0,0,0);
#$accum[0] = $stats{Y};
#$accum[1] = $accum[0] + $stats{y};
#$accum[2] = $accum[1] + $stats{p};
#print join("\t", $pop, $accum[0]/$c, $accum[1]/$c, $accum[2]/$c),"\n";
}
no warnings 'uninitialized';
foreach (@stats) {
print join("\t", $_->{max}, $_->{Y}/$width, ($_->{y})/$width, ($_->{p})/$width)."\n";
}