Mercurial > repos > yufei-luo > differential_expression_analysis_pipeline_for_rnaseq_data
diff DiffExpAnal/countNumber.pl @ 0:63799b789162 draft
Uploaded
author | yufei-luo |
---|---|
date | Tue, 22 Jan 2013 10:07:03 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DiffExpAnal/countNumber.pl Tue Jan 22 10:07:03 2013 -0500 @@ -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);