diff deseq/differential_expression_analysis_pipeline_for_rnaseq_data-a03838a6eb54/DiffExpAnal/countNumber.pl @ 10:6e573fd3c41b draft

Uploaded
author yufei-luo
date Mon, 13 May 2013 10:06:30 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deseq/differential_expression_analysis_pipeline_for_rnaseq_data-a03838a6eb54/DiffExpAnal/countNumber.pl	Mon May 13 10:06:30 2013 -0400
@@ -0,0 +1,37 @@
+#!/usr/bin/perl -w
+###
+###Yufei LUO
+###
+
+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);