snakemake-wrappers
snakemake-wrappers copied to clipboard
number of threads in bwa mem wrapper
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
Yes, this is kind of right. One should definitely invest some time to find the best combination of threads and model this properly.
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.