-
Notifications
You must be signed in to change notification settings - Fork 0
/
table.pl
56 lines (47 loc) · 948 Bytes
/
table.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#usr/bin/perl
#use strict;
#use warnings;
my $filename = "uniq_final.txt";
open(FILE, $filename) || die "Couldn't open file: " . $filename . "\n";
my @file = <FILE>;
close FILE;
%over;
%under;
%none;
$output;
foreach(@file)
{
my @temp = split("\t",$_);
if (@temp[2]==0)
{
$over{@temp[0]}=$over{@temp[0]}.="," . @temp[1];
}
elsif (@temp[2]==1)
{
$over{@temp[0]}=$under{@temp[0]}.="," . @temp[1];
}
else
{
$over{@temp[0]}=$none{@temp[0]}.="," . @temp[1];
}
}
my @keys_over = keys %over;
my @keys_under = keys %under;
my @keys_none = keys %none;
foreach(@keys_over)
{
$output.=$_ . "\tover\t" . $over{$_} . "\n";
$output.=$_ . "\tunder\t" . $under{$_} . "\n";
$output.=$_ . "\tnone\t" . $none{$_} . "\n";
}
foreach(@keys_under)
{
#$output.=$_ . "\tunder\t" . $under{$_} . "\n";
}
foreach(@keys_none)
{
#$output.=$_ . "\tnone\t" . $none{$_} . "\n";
}
open FILE, ">"."table.txt" or die $!;
print FILE $output;
close FILE;