Number of threads in BWA
3
0
Entering edit mode
6.1 years ago

Hi to all I have a question about Number of threads in bwa. Does it (Number of threads) any effect on the final result? or only affect on analyzing time.

BWA NGS alignment • 3.4k views
ADD COMMENT
4
Entering edit mode
6.1 years ago
Rob 6.5k

Ok, as d-cameron points out below the situation I originally described is the case for Bowtie2, but not BWA. Apparently, BWA guarantees deterministic output order even when running concurrently with many threads (as Heng points out here). Thanks, d-cameron, for pointing this out.

Original (wrong) assumption preserved for posterity: <del>What do you mean by affect the final result? If you increase the number of threads, the _order_ in which alignments appear in the resulting BAM file may be different. This is because each thread will grab a group of reads and align them, and there is no strict ordering on the order in which these threads will finish aligning. Thus, if you run BWA in parallel with different numbers of threads (and don't sort the output), then you can expect that records can appear in the output in different orders for different runs. However, there should be no difference on the actual alignments that are returned for the reads --- that is, mapping quality will certainly not decrease in any way as the number of threads increases.</del>

ADD COMMENT
0
Entering edit mode

Thank you, much more relevant answer than mine.

ADD REPLY
0
Entering edit mode

Thank you so much. I mean if once I run bwa with 6 threads and once again repeat this with 12 threads then I have different results(output)?

ADD REPLY
0
Entering edit mode

Technically, yes - the output will be "different". But will that affect downstream analysis? Not if both runs were run properly with the same input data and parameters (except number of threads of course).

ADD REPLY
1
Entering edit mode

bwa alignment is deterministic and the output will be the same. It will only be different if you reorder your input fastq.

ADD REPLY
1
Entering edit mode

Thank you. I should have had more faith in the developer :-)

ADD REPLY
0
Entering edit mode

Your results will be the same regardless of the number of threads used.

ADD REPLY
0
Entering edit mode

This is incorrect. bwa mem outputs SAM record in the same order as the input fastq regardless of the number of threads. Bowtie2 on the other hand requires an extra parameter (--reorder) to ensure deterministic ordering.

ADD REPLY
4
Entering edit mode
6.1 years ago
d-cameron ★ 2.9k

It does not. Heng Li, the author of bwa has previously commented on the determinism (or lack thereof) in bwa: A: BWA mem output inconsistent on same but re-ordered FASTQ input

ADD COMMENT
3
Entering edit mode
6.1 years ago
Ram 43k

Ideally, multithreading should not have any significant effect on the quality of the final output. This is bwa and Heng Li is an accomplished developer, so I daresay there will be no downside to using multiple threads. Maybe he can give you a better idea? lh3

ADD COMMENT

Login before adding your answer.

Traffic: 2607 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6