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