5 open I
, "-|", "find ../b.bwa/ -name *.sam.gz";
6 open O
, ">", "makefile";
11 /^\.\.\/b\
.bwa\
/(\w{10})\/(\w
{12})\
.sam\
.gz
$/;
17 print O
" $_.bam" foreach sort keys %sam;
20 foreach my $a (sort keys %sam) {
24 foreach my $b (sort keys %{$sam{$a}}) {
25 my $g = "../b.bwa/${a}/$b.sam.gz";
26 my $u = "${a}_$b.bam";
27 my $s = "${a}_$b.sort";
29 print O
"$s.bam: $u\n\tsamtools sort $u $s\n\trm -f $u\n";
30 print O
"$u: $g\n\t./addRG.pl \"\@RG ID:$b PL:ILLUMINA SM:$sm\" $g $u\n";
32 print O
"$a.bam:$ss\n\tsamtools merge -$ss |samtools rmdup - $a.bam 2>$a.rmdup.log\n\trm -f $ss\n";