Efficient processing of a read and its mate from bam file
1
0
Entering edit mode
6.3 years ago
mhasa006 ▴ 70

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.

BAM htsjdk samtools java SAM • 1.2k views
ADD COMMENT
1
Entering edit mode
6.3 years ago

Hello,

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 COMMENT

Login before adding your answer.

Traffic: 2633 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6