3 Author: Hu Xuesong @ BIOPIC <galaxy001@gmail.com>
4 Version: 1.0.0 @ 20120330
8 #use Data::Dump qw(ddx);
10 die "Usage: $0 <sam in> <out prefix>\n" if @ARGV<2;
17 if ($filename=~/.bz2$/) {
18 open( $infile,"-|","bzip2 -dc $filename") or die "Error opening $filename: $!\n";
19 } elsif ($filename=~/.gz$/) {
20 open( $infile,"-|","gzip -dc $filename") or die "Error opening $filename: $!\n";
21 } else {open( $infile,"<",$filename) or die "Error opening $filename: $!\n";}
25 my $samin = openfile
($in);
26 open O
,'|-',"gzip -9c >$outp.sam.gz" or die "Error opening $outp.sam.gz with gzip: $!\n";
27 open L
,'>',$outp.'.log' or die "Error opening $outp.log: $!\n";
30 print L
"From [$in] to [$outp.sam.gz]\n";
31 my ($Total,$Out,$notOut)=(0,0,0);
34 if (/^@\w\w\t\w\w:/) {
39 if (($read1[1] & 64) == 64) {
42 } elsif (($read1[1] & 128) == 128) {
50 print L
"Read_1: $Out , ",$Out/$Total,"\nRead_2: $notOut , ",$notOut/$Total,"\nTotal: $Total\nRemain: ",$Total-$Out-$notOut,"\n";