bwa
bwa copied to clipboard
[mem] reads are not labelled as proper pair
In bwa mem, when the insertion size cutoff is set as [a, b]
(using the -I
option), only the reads with the insertion size of [a + 1, b + 1]
will have the change to be labeled with "proper pair" (flag 2).
Reason:
The dist
variable (the distance between R1 and R2 starting position) instead of the insertion size
was used to compare with the cutoff.
https://github.com/lh3/bwa/blob/master/bwamem_pair.c#L239-L242
Solution: From:
if (dist > pes[dir].high) break;
if (dist < pes[dir].low) continue;
To:
if (dist + 1 > pes[dir].high) break;
if (dist + 1 < pes[dir].low) continue;