Skip to content

Commit

Permalink
Merge branch 'hotfix/5.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranmraine committed Feb 19, 2020
2 parents 9898bc7 + 5d53751 commit 600b921
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 30 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGES

## 5.0.2

* bwa-mem2 only applied if you request it

## 5.0.1

* Fix for pushing data for threaded item to stdout/err on failure
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ FROM ubuntu:16.04

LABEL maintainer="cgphelp@sanger.ac.uk"\
uk.ac.sanger.cgp="Cancer, Ageing and Somatic Mutation, Wellcome Sanger Institute" \
version="5.0.1" \
version="5.0.2" \
description="pcap-core"

ENV OPT /opt/wtsi-cgp
Expand Down
61 changes: 37 additions & 24 deletions bin/bwa_mem.pl
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ sub setup {
'g|groupinfo=s' => \$opts{'groupinfo'},
'q|mmqc' => \$opts{'mmqc'},
'qf|mmqcfrac:f' => \$opts{'mmqcfrac'},
'bm2|bwamem2' => \$opts{'bwamem2'},
) or pod2usage(2);

pod2usage(-verbose => 1, -exitval => 0) if(defined $opts{'h'});
Expand All @@ -130,6 +131,11 @@ sub setup {
for(keys %opts) { $defined++ if(defined $opts{$_}); }
pod2usage(-msg => "\nERROR: Options must be defined.\n", -verbose => 1, -output => \*STDERR) unless($defined);

if($opts{'bwa_pl'} && $opts{'bwamem2'}) {
warn "INFO: -bwa_pl cannot be used with -bwamem2, ignoring\n";
delete $opts{'bwa_pl'};
}

PCAP::Cli::file_for_reading('reference', $opts{'reference'});
$opts{'outdir'} = abs_path($opts{'outdir'});
PCAP::Cli::out_dir_check('outdir', $opts{'outdir'});
Expand All @@ -146,6 +152,7 @@ sub setup {
delete $opts{'bwa_pl'} unless(defined $opts{'bwa_pl'});
delete $opts{'mmqc'} unless(defined $opts{'mmqc'});
delete $opts{'csi'} unless(defined $opts{'csi'});
delete $opts{'bwamem2'} unless(defined $opts{'bwamem2'});

PCAP::Cli::opt_requires_opts('scramble', \%opts, ['cram']);

Expand Down Expand Up @@ -205,41 +212,43 @@ =head1 SYNOPSIS
bwa_mem.pl [options] [file(s)...]
Required parameters:
-outdir -o Folder to output result to.
-reference -r Path to reference genome file *.fa[.gz]
-sample -s Sample name to be applied to output file.
-threads -t Number of threads to use. [1]
-outdir -o Folder to output result to.
-reference -r Path to reference genome file *.fa[.gz]
-sample -s Sample name to be applied to output file.
-threads -t Number of threads to use. [1]
Optional parameters:
-fragment -f Split input into fragments of X million repairs [10]
-nomarkdup -n Don't mark duplicates [flag]
-csi Use CSI index instead of BAI for BAM files [flag].
-cram -c Output cram, see '-sc' [flag]
-scramble -sc Single quoted string of parameters to pass to Scramble when '-c' used
- '-I,-O' are used internally and should not be provided
-bwa -b Single quoted string of additional parameters to pass to BWA
- '-t,-p,-R' are used internally and should not be provided.
- '-v' is set to 1 unless '-bwa' is set.
-map_threads -mt Number of cores applied to each parallel BWA job when '-t' exceeds this value
and '-i' is not in use [6]
-groupinfo -g Readgroup information metadata file, values are not validated (yaml) [file]
-mmqc -q Mark reads as QCFAIL (0x200, 512) if mismatch rate exceeded [flag]
- Please see 'bwa_mem.pl -m'
-mmqcfrac -qf Mismatch fraction for -mmqc [0.05]
-bwamem2 -bm2 Use bwa-mem2 instead of bwa.
-fragment -f Split input into fragments of X million repairs [10]
-nomarkdup -n Don't mark duplicates [flag]
-csi Use CSI index instead of BAI for BAM files [flag].
-cram -c Output cram, see '-sc' [flag]
-scramble -sc Single quoted string of parameters to pass to Scramble when '-c' used
- '-I,-O' are used internally and should not be provided
-bwa -b Single quoted string of additional parameters to pass to BWA
- '-t,-p,-R' are used internally and should not be provided.
- '-v' is set to 1 unless '-bwa' is set.
-map_threads -mt Number of cores applied to each parallel BWA job when '-t' exceeds this value
and '-i' is not in use [6]
-groupinfo -g Readgroup information metadata file, values are not validated (yaml) [file]
-mmqc -q Mark reads as QCFAIL (0x200, 512) if mismatch rate exceeded [flag]
- Please see 'bwa_mem.pl -m'
-mmqcfrac -qf Mismatch fraction for -mmqc [0.05]
Targeted processing:
-process -p Only process this step then exit, optionally set -index
-process -p Only process this step then exit, optionally set -index
bwamem - only applicable if input is bam
mark - Run duplicate marking (-index N/A)
stats - Generates the *.bas file for the final BAM.
-index -i Optionally restrict '-p' to single job
-index -i Optionally restrict '-p' to single job
bwamem - 1..<lane_count>
Performance variables
-bwa_pl -l BWA runs ~8% quicker when using the tcmalloc library from
https://github.com/gperftools/ (assuming number of cores not exceeded)
If available specify the path to 'gperftools/lib/libtcmalloc_minimal.so'.
-bwa_pl -l BWA runs ~8% quicker when using the tcmalloc library from
https://github.com/gperftools/ (assuming number of cores not exceeded)
If available specify the path to 'gperftools/lib/libtcmalloc_minimal.so'.
- NOT APPLIED TO bwa-mem2
Other:
-jobs -j For a parallel step report the number of jobs required
Expand Down Expand Up @@ -307,6 +316,10 @@ =head2 OPTIONAL parameters
=over 4
=item B<-bwamem2>
Use binary `bwa-mem2` instead of original implementation of `bwa`. Significant speed improvement.
=item B<-fragment>
Split input into fragements of X million repairs. To prevent variability in data processing either
Expand Down
2 changes: 1 addition & 1 deletion lib/PCAP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use FindBin qw($Bin);
use File::Which qw(which);
# don't use autodie, only core perl in here

our $VERSION = '5.0.1';
our $VERSION = '5.0.2';
our @EXPORT = qw($VERSION _which);

const my $LICENSE =>
Expand Down
12 changes: 8 additions & 4 deletions lib/PCAP/Bwa.pm
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,15 @@ sub bwa_mem {
$threads = $options->{'threads'} if($options->{'threads'} < $options->{'map_threads'});

my $bwa = q{};
if(exists $options->{'bwa_pl'}) {
$bwa .= 'LD_PRELOAD='.$options->{'bwa_pl'}.' ';
if(exists $options->{'bwamem2'}) {
$bwa .= _which('bwa-mem2') || die "Unable to find 'bwa-mem2' in path";
}
else {
if(exists $options->{'bwa_pl'}) {
$bwa .= 'LD_PRELOAD='.$options->{'bwa_pl'}.' ';
}
$bwa .= _which('bwa') || die "Unable to find 'bwa' in path";
}
# may want to test for chipset abilities
$bwa .= _which('bwa-mem2') || die "Unable to find 'bwa-mem2' in path";

$ENV{SHELL} = '/bin/bash'; # ensure bash to allow pipefail
my $command = 'set -o pipefail; ';
Expand Down

0 comments on commit 600b921

Please sign in to comment.