From c2858c898841de081aa9bc6c4fade7bc89e1636f Mon Sep 17 00:00:00 2001 From: hanna Date: Tue, 8 Jun 2010 21:39:39 +0000 Subject: [PATCH] Minor performance enhancement. Checkpoint commit before major performance overhaul. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3504 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/iterators/DownsamplingLocusIteratorByState.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/iterators/DownsamplingLocusIteratorByState.java b/java/src/org/broadinstitute/sting/gatk/iterators/DownsamplingLocusIteratorByState.java index 11167860e..ec32ef32b 100755 --- a/java/src/org/broadinstitute/sting/gatk/iterators/DownsamplingLocusIteratorByState.java +++ b/java/src/org/broadinstitute/sting/gatk/iterators/DownsamplingLocusIteratorByState.java @@ -406,9 +406,10 @@ public class DownsamplingLocusIteratorByState extends LocusIterator { ArrayList pile = new ArrayList(readStates.size()); // todo -- performance problem -- should be lazy, really + GenomeLoc location = getLocation(); for ( SAMRecordState state : readStates ) { if ( state.getCurrentCigarOperator() != CigarOperator.D && state.getCurrentCigarOperator() != CigarOperator.N ) { - if ( filterRead(state.getRead(), getLocation().getStart(), filters ) ) { + if ( filterRead(state.getRead(), location.getStart(), filters ) ) { discarded_bases++; //printStatus("Adaptor bases", discarded_adaptor_bases); continue; @@ -429,10 +430,9 @@ public class DownsamplingLocusIteratorByState extends LocusIterator { } } - GenomeLoc loc = getLocation(); updateReadStates(); // critical - must be called after we get the current state offsets and location // if we got reads with non-D/N over the current position, we are done - if ( pile.size() != 0 ) nextAlignmentContext = new AlignmentContext(loc, new ReadBackedPileup(loc, pile, size, nDeletions, nMQ0Reads)); + if ( pile.size() != 0 ) nextAlignmentContext = new AlignmentContext(location, new ReadBackedPileup(location, pile, size, nDeletions, nMQ0Reads)); } } } @@ -751,7 +751,7 @@ public class DownsamplingLocusIteratorByState extends LocusIterator { List readStatesBySample = new LinkedList(); int readCount = 0; for(SAMRecord read: reads) { - if(readCount < maxReads) { + if(readCount <= maxReads) { SAMRecordState state = new SAMRecordState(read, readInfo.generateExtendedEvents()); state.stepForwardOnGenome(); readStatesBySample.add(state);