modified: pixi.toml
[GalaxyCodeBases.git] / released / pIRS.old / bwasam / snpmerge.pl
blob64caaf25e272d0be607b24f6e1c9d5d952596199
1 #!/bin/env perl
2 #use lib "/ifs1/ST_ASMB/USER/huxuesong/public/lib";
3 use strict;
4 use warnings;
5 use Time::HiRes qw ( gettimeofday tv_interval );
6 use Galaxy::ShowHelp;
8 $main::VERSION=0.0.1;
9 our $opts='o:';
10 our($opt_o);
12 #our $desc='';
13 our $help=<<EOH;
14 \t-o output prefix (./matrix).{mcount,mratio}
15 EOH
16 our $ARG_DESC='{sam,soap}pe_files';
18 ShowHelp();
19 $opt_o='./mchrpos.lst' if ! $opt_o;
21 print STDERR "From [@ARGV] to [$opt_o]\n";
22 my $start_time = [gettimeofday];
23 #BEGIN
24 my %Dat;
25 while(<>) {
26 chomp;
27 my ($chr,$pos)=split /\s+/;
28 ++$Dat{$chr}{$pos};
30 open O,'>',$opt_o or die "Error: $!\n";
31 my %Stat;
32 for my $chr (sort keys %Dat) {
33 for my $pos (sort {$a<=>$b} keys %{$Dat{$chr}}) {
34 print O "$chr\t$pos\t$Dat{$chr}{$pos}\n";
35 ++$Stat{$Dat{$chr}{$pos}};
38 print "Stat:\n";
39 print "$_\t$Stat{$_}\n" for sort {$a<=>$b} keys %Stat;
40 #END
41 my $stop_time = [gettimeofday];
43 print STDERR "\nTime Elapsed:\t",tv_interval( $start_time, $stop_time )," second(s).\n";
44 __END__