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() 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.