Mercurial > repos > yufei-luo > differential_expression_analysis_pipeline_for_rnaseq_data
comparison DiffExpAnal/countNumber.pl @ 0:63799b789162 draft
Uploaded
| author | yufei-luo |
|---|---|
| date | Tue, 22 Jan 2013 10:07:03 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:63799b789162 |
|---|---|
| 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); |
