Mercurial > repos > bioitcore > splicetrap
comparison bin/get.hist.pl @ 1:adc0f7765d85 draft
planemo upload
author | bioitcore |
---|---|
date | Thu, 07 Sep 2017 15:06:58 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:d4ca551ca300 | 1:adc0f7765d85 |
---|---|
1 use Getopt::Long; | |
2 use strict; | |
3 | |
4 my $InputFileName=$ARGV[0]; | |
5 my $OutputFileName = $ARGV[0].".hist"; | |
6 #$OutputFileName=$ARGV[1] if $ARGV[1] ne ""; | |
7 my $width=0.01; | |
8 my $verbose=1; | |
9 my $col=2; | |
10 my $start=0; | |
11 my $end=1.000; | |
12 | |
13 | |
14 GetOptions ( | |
15 'w:f'=>\$width, | |
16 'c:i'=>\$col, | |
17 'start:f'=>\$start, | |
18 'end:f'=>\$end, | |
19 'v'=>\$verbose | |
20 ); | |
21 | |
22 $width=$width*1; | |
23 #print "IRM: #Generate hist with delta width of $width \n"; | |
24 #print "IRM: #data source from col $col\n"; | |
25 | |
26 $col=$col-1; | |
27 | |
28 my @hist; | |
29 my $totalnum=0; | |
30 | |
31 open(Input, $InputFileName); | |
32 while(my $line=<Input>) | |
33 { | |
34 next if($line=~/^#/); | |
35 chomp($line); | |
36 my @array=split(/\s/,$line); | |
37 $hist[int($array[$col]/$width)]++; | |
38 $totalnum++; | |
39 | |
40 } | |
41 close(Input); | |
42 | |
43 open(OutputFile, ">$OutputFileName"); | |
44 print OutputFile "#Width:$width\n"; | |
45 for(my $i=0;$i<@hist;$i++) | |
46 { | |
47 print OutputFile $hist[$i]/$totalnum,"\n"; | |
48 } | |
49 close(OutputFile); |