Question: Efficient processing of a read and its mate from bam file
gravatar for mhasa006
6 months ago by
United States
mhasa00630 wrote:

I have BAM file sorted based on the position. But to process each read, I also need to access its mate information. I'm using htsjdk package and right now, I'm accessing the mate information with queryMate(). However, queryMate() is extremely expensive and for large BAM file it is taking a lot of time (as it should). Is there a faster way of handling a read its mate?

My idea is to create a index file. One swipe through the whole BAM file and store one-to-one information for each read with queryMate(). Still doesn't seem like the best idea. Is there any other way this can be done more efficiently? Thanks.

sam samtools bam java htsjdk • 234 views
ADD COMMENTlink modified 6 months ago by finswimmer10k • written 6 months ago by mhasa00630
gravatar for finswimmer
6 months ago by
finswimmer10k wrote:


you should sort your bam file by readname. Then you have the mates next to each other and can just iterate one time over your file to collect all information you need.

fin swimmer

ADD COMMENTlink written 6 months ago by finswimmer10k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1755 users visited in the last hour