snakemake-wrappers icon indicating copy to clipboard operation
snakemake-wrappers copied to clipboard

number of threads in bwa mem wrapper

Open RvV1979 opened this issue 5 years ago • 2 comments

Hi, apologies for this very basic question but I am wondering how snakemake deals with the threads parameter in the bwa mem wrapper. The wrapper uses this parameter to specify the number of threads used by bwa mem. But when also applying a sort the output is piped to either samtools or picard and this I assume also requires at least one additional thread.

So my question is whether the this causes a mismatch between the number of threads anticipated by snakemake (i.e. the threads parameter) and the actual threads used (i.e. the thread parameter + 1) and if this could have unwanted effects?

Thanks

RvV1979 avatar Nov 24 '19 23:11 RvV1979

Yes, this is kind of right. One should definitely invest some time to find the best combination of threads and model this properly.

johanneskoester avatar Mar 10 '20 11:03 johanneskoester

From my experience you can have as much threads fro the sorting as you have for bwa. If you observe the mapping behaviour, you can see it performs its operation chunkwise. You have a time block where bwa uses all available threads. Then a timespan with no cpu usage follows, where data is piped out and new data is retrieved. This is exactly the moment, when you need cpu for sorting as samtools gets data. There is another third block at the end, where bwa is finished and samtools needs to finish the sorting. But again, bwa is done and samtools may get all the threads. Its a perfect coexistance.

christopher-schroeder avatar Jul 06 '22 16:07 christopher-schroeder