Hi all,
I was wondering if the order of records in a bamfile produced by bwa aln/mem/sampe is guaranteed to be the same as in the fastq files that were used as input.
I checked the bwa manual but the only thing I found is this: "Repetitive read pairs will be placed randomly" (part of sampe description).
If anyone has an idea, I'd welcome your feedback!
Best,
~Lina
3 answers
Yes, the same.
Not necessarily. Sometime this can be in sorted in target mapping position. You can check this easily by command;
samtools view file.bam
Thanks for the feedback!
It looks like the default order matches the input for my data, but I just wanted to find out if that is guaranteed by bwa. To be on the safe side, I'll assume it's not guaranteed.
A wild guess without having checked anything...: If bwa runs on one thread then output order = input order. If bwa runs on multiple threads input and output orders might differ.
Sounds reasonable! Currently I'm running bwa on a single thread but I might have to move to more than one in the future...
Log in to answer this question.