This commit is contained in:
Heng Li 2014-11-17 10:54:16 -05:00
parent 0071c4ab22
commit bf053c779b
1 changed files with 9 additions and 8 deletions

View File

@ -5,7 +5,7 @@ use warnings;
use Getopt::Std;
my %opts = (t=>1, n=>64);
getopts("SpAdsko:R:x:t:", \%opts);
getopts("Spadsko:R:x:t:", \%opts);
die('
Usage: run-bwamem [options] <idxbase> <file1> [file2]
@ -19,10 +19,10 @@ Options: -o STR prefix for output files [inferred from
-t INT number of threads [1]
-p input are paired-end reads if file2 absent
-A skip HiSeq2000/2500 PE resequencing adapter trimming (via trimadap)
-a trim HiSeq2000/2500 PE resequencing adapters (via trimadap)
-d mark duplicate (via samblaster)
-S for SAM/BAM input, don\'t shuffle
-s sort the output alignment (more RAM)
-s sort the output alignment (higher RAM footprint)
-k keep temporary files generated by typeHLA
Note: File type is determined by the file extension of the first input sequence file.
@ -95,8 +95,7 @@ my $is_sam = $ARGV[1] =~ /\.(sam|sam\.gz)$/? 1 : 0;
my $is_bam = $ARGV[1] =~ /\.bam$/? 1 : 0;
if (defined($opts{x})) {
$opts{A} = 1; delete($opts{d});
delete $opts{p};
delete($opts{d}); delete($opts{a}); delete $opts{p};
}
my $cmd = '';
@ -115,7 +114,7 @@ if ($is_sam || $is_bam) {
my $bwa_opts = ($opts{t} > 1? "-t$opts{t} " : "") . (defined($opts{x})? "-x $opts{x} " : "") . (defined($opts{R})? "-R'$opts{R}' " : "");
$cmd .= " | $root/trimadap \\\n" unless defined($opts{A});
$cmd .= " | $root/trimadap \\\n" if defined($opts{a});
$cmd .= " | $root/bwa mem $bwa_opts" . ($is_pe? "-p " : "") . "$ARGV[0] - 2> $prefix.log.bwamem \\\n";
$cmd .= " | $root/samblaster 2> $prefix.log.dedup \\\n" if defined($opts{d});
@ -136,8 +135,10 @@ $cmd .= defined($opts{s})? " | $root/samtools sort -@ $t_sort -m1G - $prefix.al
# map single end reads
if ($cmd =~ /$prefix.oph.fq.gz/) {
$cmd .= "[ -s $prefix.oph.fq.gz ] && ";
$cmd .= "$root/bwa mem $bwa_opts$ARGV[0] $prefix.oph.fq.gz 2>> $prefix.log.bwamem | gzip -1 > $prefix.oph.sam.gz; rm -f $prefix.oph.fq.gz;\n";
$cmd .= "[ -s $prefix.oph.fq.gz ] && zcat $prefix.oph.fq.gz \\\n";
$cmd .= " | $root/trimadap \\\n" if defined($opts{a});
$cmd .= " | $root/bwa mem $bwa_opts$ARGV[0] - 2>> $prefix.log.bwamem | gzip -1 > $prefix.oph.sam.gz;\n";
$cmd .= "rm -f $prefix.oph.fq.gz;\n";
}
if ($has_hla && (!defined($opts{x}) || $opts{x} eq 'intractg')) {