5 die "Usage: $0 <ori-fq> <B-masked-fq> <outprefix>.(fq.xz|log)\n" if @ARGV <2;
6 my ($inA,$inB,$out)=@ARGV;
7 $out=$inA.'.merge' unless $out;
8 warn "From [$inA]&[$inB] to [$out].(fq.xz|log)\n";
13 if ($filename=~/.bz2$/) {
14 open( $infile,"-|","bzip2 -dc $filename") or die "Error opening $filename: $!\n";
15 } elsif ($filename=~/.gz$/) {
16 open( $infile,"-|","gzip -dc $filename") or die "Error opening $filename: $!\n";
17 } else {open( $infile,"<",$filename) or die "Error opening $filename: $!\n";}
23 defined($a=<$fh>) or return 0;
24 defined($b=<$fh>) or return 0;
25 defined($c=<$fh>) or return 0;
26 defined($d=<$fh>) or return 0;
31 my ($id,$seq)=($$a[0],$$a[1]);
40 return "${id}${seq}$$a[3]$$b[3]";
43 my ($Count1,$Count2,$CountPairs)=(0,0,0);
44 my $fhA=openfile
($inA);
45 my $fhB=openfile
($inB);
47 open(OUT
,"|-","xz -c9e > \"${out}.fq.xz\"") or die "Error opening $out:$!\n";
50 $dat1=getFQitem
($fhA);
51 $dat2=getFQitem
($fhB);
53 print OUT CnM
($dat1,$dat2);
56 print OUT
join('',@
$dat1);
59 print OUT
join('',@
$dat2);
69 open LOG
,'>',"${out}.log" or die "Error opening $out.log:$!\n";
70 my $str = "Out Pairs: $CountPairs\nFQ1 over hang: $Count1\nFQ2 over hang:$Count2\n";
72 print LOG
"From [$inA]&[$inB] to [$out.fq.xz]\n$str";
74 #print $Count{1}+$Count{-1}," ,RF:$CountRF\t+$Count{1},-$Count{-1},z$Count{0}\t$Reads\n";
76 find
. -name
'*.r'|xargs
-n1
./samrstat
.pl
77 find
. -name
'*.ro'|xargs
-n1 cat
|sort -n