I'm trying to calculate the fragment information for Illumina pair-end sequences. For that, I need to calculate the fragment start and fragment end. There are two ways I'm calculating the fragment start/end
fragmentStart = min(read.pos, read.pnext) + 1 fragmentEnd = fragmentStart + abs(read.isize)
and the second
fragmentStart = read.reference_start fragmentEnd = fragmentStart + abs(read.isize)
Can anybody tell me which one is the correct way? Also, how can I verify the numbers I'm getting? Currently, I'm trying to manually check the BAM files to find the positions.