diff SMART/DiffExpAnal/countNumber.pl @ 31:0ab839023fe4

Uploaded
author m-zytnicki
date Tue, 30 Apr 2013 14:33:21 -0400
parents 94ab73e8a190
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SMART/DiffExpAnal/countNumber.pl	Tue Apr 30 14:33:21 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);