Fix for chartl's stale null representation issue.

This commit is contained in:
Matt Hanna 2011-12-06 18:05:17 -05:00
parent f5b977fc88
commit c9b2cd8ba5
1 changed files with 15 additions and 3 deletions

View File

@ -89,11 +89,10 @@ public class ReadShardBalancer extends ShardBalancer {
for(SAMReaderID id: shardPosition.keySet()) {
SAMFileSpan fileSpan = new GATKBAMFileSpan(shardPosition.get(id).removeContentsBefore(position.get(id)));
if(!fileSpan.isEmpty())
selectedReaders.put(id,fileSpan);
selectedReaders.put(id,fileSpan);
}
if(selectedReaders.size() > 0) {
if(!isEmpty(selectedReaders)) {
Shard shard = new ReadShard(parser,readsDataSource,selectedReaders,currentFilePointer.locations,currentFilePointer.isRegionUnmapped);
readsDataSource.fillShard(shard);
@ -109,6 +108,19 @@ public class ReadShardBalancer extends ShardBalancer {
position = readsDataSource.getCurrentPosition();
}
/**
* Detects whether the list of file spans contain any read data.
* @param selectedSpans Mapping of readers to file spans.
* @return True if file spans are completely empty; false otherwise.
*/
private boolean isEmpty(Map<SAMReaderID,SAMFileSpan> selectedSpans) {
for(SAMFileSpan fileSpan: selectedSpans.values()) {
if(!fileSpan.isEmpty())
return false;
}
return true;
}
};
}