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
188193bwa_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
219230File list can be full file names or wildcard, e.g.
220231
0 commit comments