Fixing problems with SAMQueryIterator and reads

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@263 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2009-04-02 18:04:28 +00:00
parent d202264b23
commit 93fc768c38
4 changed files with 14 additions and 11 deletions

View File

@ -125,8 +125,8 @@ public class ReferenceIterator implements Iterator<ReferenceIterator> {
// we're somewhere on this contig
if ( seekOffset < offset ) {
// bad boy -- can't go backward safely
throw new IllegalArgumentException(String.format("Invalid seek to %s from %s, which is usually due to out of order reads%n",
new GenomeLoc(currentContig.getName(), seekOffset), new GenomeLoc(currentContig.getName(), offset)));
throw new IllegalArgumentException(String.format("Invalid seek %s => %s, which is usually due to out of order reads%n",
new GenomeLoc(currentContig.getName(), offset), new GenomeLoc(currentContig.getName(), seekOffset)));
}
else if ( seekOffset >= currentContig.length() ) {
// bad boy -- can't go beyond the contig length
@ -154,8 +154,8 @@ public class ReferenceIterator implements Iterator<ReferenceIterator> {
if ( cmpContigs == -1 && false ) { // todo: fixed
// The contig we are looking for is before the currentContig -- it's an error
throw new IllegalArgumentException(String.format("Invalid seek to %s from %s, which is usually due to out of order reads%n",
new GenomeLoc(currentContig.getName(), seekOffset), new GenomeLoc(currentContig.getName(), offset)));
throw new IllegalArgumentException(String.format("Invalid seek %s => %s, which is usually due to out of order reads%n",
new GenomeLoc(currentContig.getName(), offset), new GenomeLoc(currentContig.getName(), seekOffset)));
}
else if ( cmpContigs == 1 ) {
// we need to jump forward
@ -163,8 +163,8 @@ public class ReferenceIterator implements Iterator<ReferenceIterator> {
if ( ! refFile.seekToContig(seekContigName) ) { // ok, do the seek
// a false result indicates a failure, throw a somewhat cryptic call
throw new RuntimeIOException(String.format("Unexpected seek failure from %s from %s%n",
new GenomeLoc(currentContig.getName(), seekOffset), new GenomeLoc(currentContig.getName(), offset)));
throw new RuntimeIOException(String.format("Unexpected seek failure from %s to %s%n",
new GenomeLoc(currentContig.getName(), offset), new GenomeLoc(currentContig.getName(), seekOffset)));
}
readNextContig(); // since we haven't failed, we just read in the next contig (which is seekContigName)

View File

@ -75,6 +75,8 @@ public class SamQueryIterator implements Iterator<SAMRecord> {
(int)currentLoc.getStop() );
if( recordIter.hasNext() )
break;
else
recordIter.close();
}
}

View File

@ -345,11 +345,11 @@ public abstract class TraversalEngine {
logger.fatal("Couldn't open file in sam file list: " + readsFile);
}
}
if (samReader.hasIndex()) {
return new SamQueryIterator(samReader, locs);
} else {
return samReader.iterator();
}
//if (samReader.hasIndex()) {
// return new SamQueryIterator(samReader, locs);
//} else {
return samReader.iterator();
//}
}
protected Iterator<SAMRecord> WrapReadsIterator( final Iterator<SAMRecord> rawIterator, final boolean enableVerification ) {

View File

@ -5,6 +5,7 @@ import org.broadinstitute.sting.gatk.LocusContext;
public class CountReadsWalker extends ReadWalker<Integer, Integer> {
public Integer map(LocusContext context, SAMRecord read) {
//System.out.println(read.format());
return 1;
}