I am confused about how the insert length (9th column) was computed in SAM file, for instance, the two PE50 reads below were aligned to reference genome, and the 4th column is 1-based leftmost mapping POSition for each read. For CL200085426L1C001R001_4504, the insert size should be equal to the following equation,
87845148 - 87845071 + 50 = 127
the result is the same as the 9th column, while it is incorrect for CL200085426L1C001R001_4486 with insert length of 11 using the same computing method. So anyone knows how to fetch the insert size? Thanks very much!
CL200085426L1C001R001_4486 83 chr16 34103407 55 50M = 34103466 11 CL200085426L1C001R001_4486 163 chr16 34103466 59 50M = 34103407 -11 CL200085426L1C001R001_4504 99 chr5 87845071 60 50M = 87845148 127 CL200085426L1C001R001_4504 147 chr5 87845148 60 50M = 87845071 -127