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