Skip to content

Commit 592e132

Browse files
committed
Merge branch 'release/v3.3.0'
2 parents 1c91c63 + c98264f commit 592e132

5 files changed

Lines changed: 44 additions & 25 deletions

File tree

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 3.3.0
2+
* adds `map_threads|mt` option to `bwa_mem.pl` to allow more control of parallel processing in one shot submission.
3+
* adds `bwa_pl|l` option to `bwa_mem.pl` to allow preload of different malloc libraries.
4+
15
### 3.2.0
26
* Move from legacy kent bigwig manipulation code and to [`cgpBigWig`](https://github.com/cancerit/cgpBigWig)
37
* Faster and handles the huge number of contigs in many new reference builds.

bin/bwa_mem.pl

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
# register processes
5858
$threads->add_function('split', \&PCAP::Bwa::split_in);
59-
$threads->add_function('bwamem', \&PCAP::Bwa::bwa_mem, exists $options->{'index'} ? 1 : &PCAP::Bwa::bwa_mem_max_cores);
59+
$threads->add_function('bwamem', \&PCAP::Bwa::bwa_mem, exists $options->{'index'} ? 1 : $options->{'map_threads'});
6060

6161
PCAP::Bwa::mem_setup($options) if(!exists $options->{'process'} || $options->{'process'} eq 'setup');
6262

@@ -89,6 +89,7 @@ sub setup {
8989
'v|version' => \$opts{'v'},
9090
'j|jobs' => \$opts{'jobs'},
9191
't|threads=i' => \$opts{'threads'},
92+
'mt|map_threads=i' => \$opts{'map_threads'},
9293
'r|reference=s' => \$opts{'reference'},
9394
'o|outdir=s' => \$opts{'outdir'},
9495
's|sample=s' => \$opts{'sample'},
@@ -99,6 +100,7 @@ sub setup {
99100
'b|bwa=s' => \$opts{'bwa'},
100101
'c|cram' => \$opts{'cram'},
101102
'sc|scramble=s' => \$opts{'scramble'},
103+
'l|bwa_pl=s' => \$opts{'bwa_pl'},
102104
) or pod2usage(2);
103105

104106
pod2usage(-verbose => 1, -exitval => 0) if(defined $opts{'h'});
@@ -129,6 +131,9 @@ sub setup {
129131
delete $opts{'index'} unless(defined $opts{'index'});
130132
delete $opts{'bwa'} unless(defined $opts{'bwa'});
131133
delete $opts{'scramble'} unless(defined $opts{'scramble'});
134+
delete $opts{'bwa_pl'} unless(defined $opts{'bwa_pl'});
135+
136+
$opts{'map_threads'} = &PCAP::Bwa::bwa_mem_max_cores unless(defined $opts{'map_threads'});
132137

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

@@ -188,33 +193,39 @@ =head1 SYNOPSIS
188193
bwa_mem.pl [options] [file(s)...]
189194
190195
Required parameters:
191-
-outdir -o Folder to output result to.
192-
-reference -r Path to reference genome file *.fa[.gz]
193-
-sample -s Sample name to be applied to output file.
194-
-threads -t Number of threads to use. [1]
196+
-outdir -o Folder to output result to.
197+
-reference -r Path to reference genome file *.fa[.gz]
198+
-sample -s Sample name to be applied to output file.
199+
-threads -t Number of threads to use. [1]
195200
196201
Optional parameters:
197-
-fragment -f Split input into fragements of X million repairs [10]
198-
-nomarkdup -n Don't mark duplicates
199-
-cram -c Output cram, see '-sc'
200-
-scramble -sc Single quoted string of parameters to pass to Scramble when '-c' used
201-
- '-I,-O' are used internally and should not be provided
202-
-bwa -b Single quoted string of additional parameters to pass to BWA
203-
- '-t,-p,-R' are used internally and should not be provided
202+
-fragment -f Split input into fragements of X million repairs [10]
203+
-nomarkdup -n Don't mark duplicates
204+
-cram -c Output cram, see '-sc'
205+
-scramble -sc Single quoted string of parameters to pass to Scramble when '-c' used
206+
- '-I,-O' are used internally and should not be provided
207+
-bwa -b Single quoted string of additional parameters to pass to BWA
208+
- '-t,-p,-R' are used internally and should not be provided
209+
-map_threads -mt Number of cores applied to each parallel BWA job when '-t' exceeds this value and '-i' is not in use[6]
204210
205211
Targeted processing:
206-
-process -p Only process this step then exit, optionally set -index
207-
bwamem - only applicable if input is bam
208-
mark - Run duplicate marking (-index N/A)
209-
stats - Generates the *.bas file for the final BAM.
212+
-process -p Only process this step then exit, optionally set -index
213+
bwamem - only applicable if input is bam
214+
mark - Run duplicate marking (-index N/A)
215+
stats - Generates the *.bas file for the final BAM.
216+
217+
-index -i Optionally restrict '-p' to single job
218+
bwamem - 1..<lane_count>
210219
211-
-index -i Optionally restrict '-p' to single job
212-
bwamem - 1..<lane_count>
220+
Performance variables
221+
-bwa_pl -l BWA runs ~8% quicker when using the tcmalloc library from
222+
https://github.com/gperftools/ (assuming number of cores not exceeded)
223+
If available specify the path to 'gperftools/lib/libtcmalloc_minimal.so'.
213224
214225
Other:
215-
-jobs -j For a parallel step report the number of jobs required
216-
-help -h Brief help message.
217-
-man -m Full documentation.
226+
-jobs -j For a parallel step report the number of jobs required
227+
-help -h Brief help message.
228+
-man -m Full documentation.
218229
219230
File list can be full file names or wildcard, e.g.
220231

docs.tar.gz

-325 Bytes
Binary file not shown.

lib/PCAP.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use FindBin qw($Bin);
2727
use File::Which qw(which);
2828
# don't use autodie, only core perl in here
2929

30-
our $VERSION = '3.2.0';
30+
our $VERSION = '3.3.0';
3131
our @EXPORT = qw($VERSION _which);
3232

3333
const my $LICENSE =>

lib/PCAP/Bwa.pm

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,14 @@ sub bwa_mem {
235235
$rg_line = q{'}.$rg_line.q{'};
236236
}
237237

238-
my $threads = $BWA_MEM_MAX_CORES;
239-
$threads = $options->{'threads'} if($options->{'threads'} < $BWA_MEM_MAX_CORES);
238+
my $threads = $options->{'map_threads'};
239+
$threads = $options->{'threads'} if($options->{'threads'} < $options->{'map_threads'});
240240

241-
my $bwa = _which('bwa') || die "Unable to find 'bwa' in path";
241+
my $bwa = q{};
242+
if(exists $options->{'bwa_pl'}) {
243+
$bwa .= 'LD_PRELOAD='.$options->{'bwa_pl'}.' ';
244+
}
245+
$bwa .= _which('bwa') || die "Unable to find 'bwa' in path";
242246

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

0 commit comments

Comments
 (0)