/usr/lib/WigeoN/util/smooth.pl is in wigeon 20101212+dfsg-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/usr/bin/env perl
use strict;
use warnings;
use lib ($ENV{EUK_MODULES});
use BHStats;
my $usage = "usage: $0 pointsFile windowSize\n\n";
my $pointsFile = $ARGV[0] or die $usage;
my $windowSize = $ARGV[1] or die $usage;
main: {
my @pos;
open (my $fh, $pointsFile) or die "Error, cannot open file $pointsFile";
while (<$fh>) {
chomp;
my ($position, $val) = split (/\t/);
if ($position > 10000) { die "Error, pos out of range: $position"; } # avoid creating a massive array
$pos[$position] = $val;
}
close $fh;
for (my $i = 1; $i <= $#pos - $windowSize +1; $i++) {
my $midpt = $i + ($windowSize/2);
my @vals = @pos[$i..$i+$windowSize-1];
#print join (" ", @vals) . "\n";
my $avg = &BHStats::avg(@vals);
#print "AVG: $avg\n\n";
print "$midpt\t$avg\n";
}
}
exit(0);
|