From fff15944fe9eebfe6faf4bd50659f35c096247ed Mon Sep 17 00:00:00 2001 From: hanna Date: Tue, 23 Feb 2010 15:58:54 +0000 Subject: [PATCH] Bug fix. Stopping condition of recurrence stopped too soon in some cases where an interval *contained* zero reads but *overlapped* with some reads. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2874 348d0f76-0448-11de-a6fe-93d51630548a --- .../shards/IndexDelimitedLocusShardStrategy.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/shards/IndexDelimitedLocusShardStrategy.java b/java/src/org/broadinstitute/sting/gatk/datasources/shards/IndexDelimitedLocusShardStrategy.java index 2b90a8a16..cadcb8b32 100755 --- a/java/src/org/broadinstitute/sting/gatk/datasources/shards/IndexDelimitedLocusShardStrategy.java +++ b/java/src/org/broadinstitute/sting/gatk/datasources/shards/IndexDelimitedLocusShardStrategy.java @@ -94,17 +94,25 @@ public class IndexDelimitedLocusShardStrategy implements ShardStrategy { List bins = findBinsAtLeastAsDeepAs(blockDrivenDataSource.getOverlappingBins(location),binsDeeperThan); + // Recursive stopping condition -- algorithm is at the zero point and no bins have been found. + if(binsDeeperThan == 0 && bins.size() == 0) { + filePointers.add(new FilePointer(location)); + continue; + } + + // No bins found; step up a level and search again. if(bins.size() == 0) { if(filePointer != null && filePointer.locations.size() > 0) { filePointers.add(filePointer); filePointer = null; } - filePointers.add(new FilePointer(location)); + filePointers.addAll(batchLociIntoBins(Collections.singletonList(location),binsDeeperThan-1)); continue; } - Collections.sort(bins); + // Bins found; try to match bins with locations. + Collections.sort(bins); Iterator binIterator = bins.iterator(); while(locationStop >= locationStart) {