This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Calculating fragment start and end in python

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.

python insert fragment

Actually, I'm fetching reads form a BAM file that is within a bed region. Then I'm trying to calculate the fragment start/end of the fetched reads

how about filtering the BAM file for the region on interest and then converting the output to a BED file which will contain the read start and stop coordinates?

Thanks for the reply, will try that.

Well, that is true, but it is part of a bigger project. And calling third-party tools can be problematic. Either way, thanks for the reply.

0 answers

No answers yet.

Log in to answer this question.