Question: Extract the mate pair information with htsjdk
gravatar for mhasa006
12 months ago by
United States
mhasa00650 wrote:

I have a BAM file sorted by position. I need to process a group of reads from the BAM file at a time. To process that, I need to access the mate pair of each of these read at the same time. Is there a way using htsjdk to access the mate pair information using the information of the other pair.

I can get the Mate Pair record name with getMateReferenceName() and alignment start position by getMateAlignmentStart(). But I need to access the read sequence and the base quality string and the flag of the mate pair. How can I do that? Thanks.

samtools bam htsjdk • 424 views
ADD COMMENTlink modified 12 months ago by Pierre Lindenbaum122k • written 12 months ago by mhasa00650
gravatar for Pierre Lindenbaum
12 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum122k wrote:

SAMReader$queryMate :

Fetch the mate for the given read. Only valid to call this if hasIndex() == true. This will work whether the mate has a coordinate or not, so long as the given read has correct mate information. This method iterates over the SAM file, so there may not be an unclosed iterator on the SAM file when this method is called.

Note that it is not possible to call queryMate when iterating over the SamReader, because queryMate requires its own iteration, and there cannot be two simultaneous iterations on the same SamReader. The work-around is to open a second SamReader on the same input file, and call queryMate on the second reader.

ADD COMMENTlink written 12 months ago by Pierre Lindenbaum122k
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: 1274 users visited in the last hour