Accessing Mate Of Samrecord Using Gatk
1
1
Entering edit mode
12.7 years ago
Johan ▴ 890

I'm wondering how to access the mate of a sam record using GATK. Right now I'm doing this:

if(samRecord.getReadPairedFlag()){ 
    SAMFileReader samfileReader = samRecord.getFileSource().getReader(); 
    SAMRecord mate = samfileReader.queryMate(samRecord); 
    mates.add(mate); 
}

Whoever, this fails with the error message: java.lang.RuntimeException: java.lang.IllegalStateException: Iteration in progress

This lead me to have a closer look at the documentation of SamFileReader in SAM JDK, and it states that there cannot be any open iterators over the sam file while calling this method.

Does anyone know if the walker keeps a iterator open over this file? And if so, is there any way for me to close it? Or better still, is there a GATK method for accessing the mate of the record?

gatk java • 2.0k views
ADD COMMENT
2
Entering edit mode
12.7 years ago

You could open another SAMFileReader and query the mate with this second instance.

ADD COMMENT
0
Entering edit mode

Thanks. I got basically the same answer from the the GATK group, for future reference here's a link to their answer. http://getsatisfaction.com/gsa/topics/how_to_access_the_mate_of_a_record

ADD REPLY

Login before adding your answer.

Traffic: 2046 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