Mercurial > repos > yufei-luo > s_mart
diff SMART/DiffExpAnal/countNumber.pl @ 18:94ab73e8a190
Uploaded
author | m-zytnicki |
---|---|
date | Mon, 29 Apr 2013 03:20:15 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SMART/DiffExpAnal/countNumber.pl Mon Apr 29 03:20:15 2013 -0400 @@ -0,0 +1,34 @@ +#!/usr/bin/perl -w + +use strict; + +my $in_file = $ARGV[0]; +my $out_file = $ARGV[1]; +my $sort_type = $ARGV[2]; # n(umeric) or a(lphanumeric) +my ($line,$ID,$nbOverlaps,%hash); + +open(IN, $in_file); +while ($line = <IN>){ + chomp($line); + $line=~s/\t/|/g; + my @part=split(/\|/,$line); + my @split=split(";",$part[$#part]); + $split[0] =~ m/^(\w+).+$/; + + foreach my $i (@split){ + if ($i=~m/nbOverlaps=(.+)/){ + $nbOverlaps=$1; + } + if ($i=~m/gene_id=(.+)/){ + $ID=$1; + $hash{$ID}=$nbOverlaps; + } + } +} +close(IN); + +open(OUT, ">$out_file"); +foreach my $key ( sort keys %hash) { + print OUT "$key\t$hash{$key}\n"; +} +close(OUT);