Question: Efficient processing of a read and its mate from bam file
gravatar for mhasa006
12 months ago by
United States
mhasa00650 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 • 329 views
ADD COMMENTlink modified 12 months ago by finswimmer12k • written 12 months ago by mhasa00650
gravatar for finswimmer
12 months ago by
finswimmer12k 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 12 months ago by finswimmer12k
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: 1510 users visited in the last hour