lh3 / bwa

Burrow-Wheeler Aligner for short-read alignment (see minimap2 for long-read alignment)
GNU General Public License v3.0
1.55k stars 556 forks source link

How is isize calculated for PE reads? #201

Closed sfchen closed 6 years ago

sfchen commented 6 years ago

For PE reads, I supposed the isize is calculated by most_right_ref_pos - most_left_ref_pos + 1, where most_right_ref_pos is calculated by the right read and its CIGAR.

This formula works when the insert sizes are normal (i.e. < 500).

But sometimes, when the insert size is irregular, it fails. For example:

pos, mpos, isize, CIGAR
25725470, 25620894, -104576, M146S5
161642648, 161560941, -81561, S3M148
145273199, 120548225, -24724975, 146S5

Can anybody tell me how isize is calculated in such cases? I am developing a consensus reads generator, which highly relies on the alignment results.

Thank you in advance.

sfchen commented 6 years ago

I have understood it, closing