Mercurial > repos > plus91-technologies-pvt-ltd > softsearch
comparison 2.4/src/reduce_redundancy.pl @ 16:8eb7d93f7e58 draft
Uploaded
author | plus91-technologies-pvt-ltd |
---|---|
date | Sat, 31 May 2014 11:23:36 -0400 |
parents | e3609c8714fb |
children |
comparison
equal
deleted
inserted
replaced
15:da93b6f4d684 | 16:8eb7d93f7e58 |
---|---|
1 open(BUFF,"$ARGV[0]") or die "no input file found\n"; | |
2 $range="$ARGV[1]"; | |
3 my %hash; | |
4 my %store; | |
5 $prev_chr=""; | |
6 $next=0; | |
7 while(<BUFF>) | |
8 { | |
9 chomp($_); | |
10 #print "$.\n"; | |
11 if($_ !~ m/^#/) | |
12 { | |
13 @array=split("\t",$_); | |
14 $chr=$array[0]; | |
15 $pos=$array[1]; | |
16 $value=$array[@array-1]; | |
17 if($prev_chr ne $chr ) | |
18 { | |
19 if($prev_chr ne "") | |
20 { | |
21 foreach $key (sort {$hash{$b} <=> $hash{$a} } keys %hash) | |
22 { | |
23 print "$store{$key}\n"; | |
24 last; | |
25 } | |
26 | |
27 } | |
28 $next = $pos+$range; | |
29 undef(%hash); | |
30 undef(%store); | |
31 } | |
32 if($next< $pos) | |
33 { | |
34 foreach $key (sort {$hash{$b} <=> $hash{$a} } keys %hash) | |
35 { | |
36 print "$store{$key}\n"; | |
37 last; | |
38 } | |
39 $next = $pos+$range; | |
40 undef(%hash); | |
41 undef(%store); | |
42 | |
43 } | |
44 if($value eq "NA") | |
45 { | |
46 $hash{$chr." ".$pos." ".$.}=0; | |
47 } | |
48 else | |
49 { | |
50 $hash{$chr." ".$pos." ".$.}=$value; | |
51 } | |
52 $store{$chr." ".$pos." ".$.}=$_; | |
53 } | |
54 else | |
55 { | |
56 print $_."\n"; | |
57 } | |
58 $prev_chr = $chr; | |
59 } | |
60 foreach $key (sort {$hash{$b} <=> $hash{$a} } keys %hash) | |
61 { | |
62 print "$store{$key}\n"; | |
63 last; | |
64 } | |
65 |