-
Notifications
You must be signed in to change notification settings - Fork 0
/
round_filter_assoc.pl
executable file
·64 lines (59 loc) · 1.96 KB
/
round_filter_assoc.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
57
58
59
60
61
62
63
64
#!/usr/bin/env perl
use strict;
use warnings;
use IO::File;
my $fh = IO::File->new($ARGV[0]);
while(my $line = $fh->getline) {
chomp($line);
if($line =~ /^CHR/) {
print $line."\n";
next;
}
else {
my @lineContents = split(/\s+/, $line);
my $chromosome = $lineContents[0];
my $position = $lineContents[1];
my $snp = $lineContents[2];
my $a1 = $lineContents[3];
my $a2 = $lineContents[4];
my $ac_a2 = sprintf("%.0f", $lineContents[5]);
my $af_a2 = sprintf("%.2f", $lineContents[6]);
my $info = sprintf("%.2f", $lineContents[7]);
my $n = $lineContents[8];
my $beta = sprintf("%.2f", $lineContents[9]);
my $se = sprintf("%.2f", $lineContents[10]);
my $t_stat = sprintf("%.2f", $lineContents[11]);
my $p1 = $lineContents[12];
my $p2 = $lineContents[13];
my $spa = $lineContents[14];
my $varT = sprintf("%.2f", $lineContents[15]);
my $varTstar = sprintf("%.2f", $lineContents[16]);
my $af_cases = sprintf("%.2f", $lineContents[17]);
my $af_controls = sprintf("%.2f", $lineContents[18]);
if($af_a2 >= 0.01 && $af_a2 <= 0.99) {
print $chromosome." ";
print $position." ";
print $snp." ";
print $a1." ";
print $a2." ";
print $ac_a2." ";
print $af_a2." ";
print $info." ";
print $n." ";
print $beta." ";
print $se." ";
print $t_stat." ";
print $p1." ";
print $p2." ";
print $spa." ";
print $varT." ";
print $varTstar." ";
print $af_cases." ";
print $af_controls."\n";
}
else {
next;
}
}
}
$fh->close;