comparison SMART/DiffExpAnal/countNumber.pl @ 18:94ab73e8a190

Uploaded
author m-zytnicki
date Mon, 29 Apr 2013 03:20:15 -0400
parents
children
comparison
equal deleted inserted replaced
17:b0e8584489e6 18:94ab73e8a190
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 my $in_file = $ARGV[0];
6 my $out_file = $ARGV[1];
7 my $sort_type = $ARGV[2]; # n(umeric) or a(lphanumeric)
8 my ($line,$ID,$nbOverlaps,%hash);
9
10 open(IN, $in_file);
11 while ($line = <IN>){
12 chomp($line);
13 $line=~s/\t/|/g;
14 my @part=split(/\|/,$line);
15 my @split=split(";",$part[$#part]);
16 $split[0] =~ m/^(\w+).+$/;
17
18 foreach my $i (@split){
19 if ($i=~m/nbOverlaps=(.+)/){
20 $nbOverlaps=$1;
21 }
22 if ($i=~m/gene_id=(.+)/){
23 $ID=$1;
24 $hash{$ID}=$nbOverlaps;
25 }
26 }
27 }
28 close(IN);
29
30 open(OUT, ">$out_file");
31 foreach my $key ( sort keys %hash) {
32 print OUT "$key\t$hash{$key}\n";
33 }
34 close(OUT);