Fix misc issues in new protosharder regarding proper iterator termination when
an unexpectedly small amount of data is present. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5338 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
abab23350f
commit
c869d1c9cf
|
|
@ -160,14 +160,16 @@ class BinTreeIterator implements Iterator<BinTree> {
|
||||||
final int firstBinInLowestLevel = GATKBAMIndex.getFirstBinInLevel(lowestLevel);
|
final int firstBinInLowestLevel = GATKBAMIndex.getFirstBinInLevel(lowestLevel);
|
||||||
final int binsInLowestLevel = index.getLevelSize(lowestLevel);
|
final int binsInLowestLevel = index.getLevelSize(lowestLevel);
|
||||||
|
|
||||||
currentBinInLowestLevel++;
|
|
||||||
|
|
||||||
GATKBin[] bins = new GATKBin[GATKBAMIndex.getNumIndexLevels()];
|
GATKBin[] bins = new GATKBin[GATKBAMIndex.getNumIndexLevels()];
|
||||||
nextBinTree = null;
|
nextBinTree = null;
|
||||||
while(nextBinTree == null) {
|
while(nextBinTree == null) {
|
||||||
|
currentBinInLowestLevel++;
|
||||||
|
boolean levelIteratorsExhausted = true;
|
||||||
|
|
||||||
for(int level = lowestLevel; level >= 0; level--) {
|
for(int level = lowestLevel; level >= 0; level--) {
|
||||||
if(!levelIterators[level].hasNext())
|
if(!levelIterators[level].hasNext())
|
||||||
continue;
|
continue;
|
||||||
|
levelIteratorsExhausted = false;
|
||||||
|
|
||||||
final int firstBinInThisLevel = GATKBAMIndex.getFirstBinInLevel(level);
|
final int firstBinInThisLevel = GATKBAMIndex.getFirstBinInLevel(level);
|
||||||
final int binsInThisLevel = index.getLevelSize(level);
|
final int binsInThisLevel = index.getLevelSize(level);
|
||||||
|
|
@ -180,6 +182,11 @@ class BinTreeIterator implements Iterator<BinTree> {
|
||||||
bins[level] = levelIterators[level].peek();
|
bins[level] = levelIterators[level].peek();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No more bins available for this reference sequence? Break out of the loop.
|
||||||
|
if(levelIteratorsExhausted)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Found a compelling bin tree? Break out of the loop.
|
||||||
for(int level = 0; level <= lowestLevel; level++) {
|
for(int level = 0; level <= lowestLevel; level++) {
|
||||||
if(bins[level] != null) {
|
if(bins[level] != null) {
|
||||||
nextBinTree = new BinTree(index,bins);
|
nextBinTree = new BinTree(index,bins);
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,13 @@ public class LowMemoryIntervalSharder implements Iterator<FilePointer> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Early exit if no bins were found.
|
||||||
|
if(coveredRegion == null) {
|
||||||
|
nextFilePointer.addLocation(currentLocus);
|
||||||
|
currentLocus = locusIterator.next();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Define the initial range of the file pointer, aka the region where the locus currently being processed intersects the BAM list.
|
// Define the initial range of the file pointer, aka the region where the locus currently being processed intersects the BAM list.
|
||||||
GenomeLoc initialLocation = currentLocus.intersect(coveredRegion);
|
GenomeLoc initialLocation = currentLocus.intersect(coveredRegion);
|
||||||
nextFilePointer.addLocation(initialLocation);
|
nextFilePointer.addLocation(initialLocation);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue