Fix bug in the interval sharder in cases where contigs specified in intervals are not present in any supplied BAM file.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3268 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2010-04-28 20:42:04 +00:00
parent b648e89096
commit 4617abf1ff
1 changed files with 6 additions and 1 deletions

View File

@ -105,6 +105,8 @@ public class IntervalSharder {
BinMergingIterator binMerger = new BinMergingIterator();
for(SAMReaderID id: dataSource.getReaderIDs()) {
final SAMSequenceRecord referenceSequence = dataSource.getHeader(id).getSequence(contig);
if(referenceSequence == null)
continue;
final CachingBAMFileIndex index = dataSource.getIndex(id);
binMerger.addReader(id,
index,
@ -119,6 +121,9 @@ public class IntervalSharder {
if(!location.getContig().equals(contig))
throw new StingException("Location outside bounds of contig");
if(!binIterator.hasNext())
break;
int locationStart = (int)location.getStart();
final int locationStop = (int)location.getStop();
@ -195,7 +200,7 @@ public class IntervalSharder {
filePointers.add(lastFilePointer);
// Lookup the locations for every file pointer in the index.
for(SAMReaderID id: dataSource.getReaderIDs()) {
for(SAMReaderID id: readerToIndexMap.keySet()) {
CachingBAMFileIndex index = readerToIndexMap.get(id);
for(FilePointer filePointer: filePointers)
filePointer.addFileSpans(id,index.getChunksOverlapping(filePointer.overlap.getBin(id)));