limit fstBC to 30bp in Python3 ver.
[GalaxyCodeBases.git] / perl / etc / WoodyMiaoLin / PbeBefore2015 / make_makefile.pl
blobac63144fe19a1503c394c3c1189e7c4cec6fdcca
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 open I, "-|", "find ../b.bwa/ -name *.sam.gz";
6 open O, ">", "makefile";
8 my %sam;
9 while (<I>) {
10 chomp;
11 /^\.\.\/b\.bwa\/(\w{10})\/(\w{12})\.sam\.gz$/;
12 $sam{$1}{$2} = 1;
14 close I;
16 print O "bam:";
17 print O " $_.bam" foreach sort keys %sam;
18 print O "\n";
20 foreach my $a (sort keys %sam) {
21 $a =~ /(^\w{6})/;
22 my $sm = $1;
23 my $ss;
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";
28 $ss .= " $s.bam";
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";
34 close O;