Another round of cleanup and simplification in Picard -- Picard's unit tests
are now passing for my branch. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3100 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
40f8e7644c
commit
b60197ae10
|
|
@ -237,23 +237,21 @@ public class BlockDrivenSAMDataSource extends SAMDataSource {
|
||||||
* @return An iterator over the selected data.
|
* @return An iterator over the selected data.
|
||||||
*/
|
*/
|
||||||
private StingSAMIterator getIterator(SAMReaders readers, BAMFormatAwareShard shard, boolean enableVerification) {
|
private StingSAMIterator getIterator(SAMReaders readers, BAMFormatAwareShard shard, boolean enableVerification) {
|
||||||
Map<SAMFileReader,CloseableIterator<SAMRecord>> readerToIteratorMap = new HashMap<SAMFileReader,CloseableIterator<SAMRecord>>();
|
SamFileHeaderMerger headerMerger = new SamFileHeaderMerger(readers.values(),SAMFileHeader.SortOrder.coordinate,true);
|
||||||
|
|
||||||
|
// Set up merging to dynamically merge together multiple BAMs.
|
||||||
|
MergingSamRecordIterator mergingIterator = new MergingSamRecordIterator(headerMerger,true);
|
||||||
for(SAMReaderID id: getReaderIDs()) {
|
for(SAMReaderID id: getReaderIDs()) {
|
||||||
if(shard.getFileSpans().get(id) == null)
|
if(shard.getFileSpans().get(id) == null)
|
||||||
continue;
|
continue;
|
||||||
CloseableIterator<SAMRecord> iterator = readers.getReader(id).iterator(shard.getFileSpans().get(id));
|
CloseableIterator<SAMRecord> iterator = readers.getReader(id).iterator(shard.getFileSpans().get(id));
|
||||||
if(shard.getFilter() != null)
|
if(shard.getFilter() != null)
|
||||||
iterator = new FilteringIterator(iterator,shard.getFilter());
|
iterator = new FilteringIterator(iterator,shard.getFilter());
|
||||||
readerToIteratorMap.put(readers.getReader(id),iterator);
|
mergingIterator.addIterator(readers.getReader(id),iterator);
|
||||||
}
|
}
|
||||||
|
|
||||||
SamFileHeaderMerger headerMerger = new SamFileHeaderMerger(readers.values(),SAMFileHeader.SortOrder.coordinate,true);
|
|
||||||
|
|
||||||
// Set up merging to dynamically merge together multiple BAMs.
|
|
||||||
CloseableIterator<SAMRecord> iterator = new MergingSamRecordIterator(headerMerger,readerToIteratorMap,true);
|
|
||||||
|
|
||||||
return applyDecoratingIterators(enableVerification,
|
return applyDecoratingIterators(enableVerification,
|
||||||
new ReleasingIterator(readers,StingSAMIteratorAdapter.adapt(reads,iterator)),
|
new ReleasingIterator(readers,StingSAMIteratorAdapter.adapt(reads,mergingIterator)),
|
||||||
reads.getDownsamplingFraction(),
|
reads.getDownsamplingFraction(),
|
||||||
reads.getValidationExclusionList().contains(ValidationExclusion.TYPE.NO_READ_ORDER_VERIFICATION),
|
reads.getValidationExclusionList().contains(ValidationExclusion.TYPE.NO_READ_ORDER_VERIFICATION),
|
||||||
reads.getSupplementalFilters());
|
reads.getSupplementalFilters());
|
||||||
|
|
@ -267,16 +265,14 @@ public class BlockDrivenSAMDataSource extends SAMDataSource {
|
||||||
private StingSAMIterator seekMonolithic(Shard shard) {
|
private StingSAMIterator seekMonolithic(Shard shard) {
|
||||||
SAMReaders readers = resourcePool.getAvailableReaders();
|
SAMReaders readers = resourcePool.getAvailableReaders();
|
||||||
|
|
||||||
Map<SAMFileReader,CloseableIterator<SAMRecord>> readerToIteratorMap = new HashMap<SAMFileReader,CloseableIterator<SAMRecord>>();
|
|
||||||
for(SAMReaderID id: getReaderIDs())
|
|
||||||
readerToIteratorMap.put(readers.getReader(id),readers.getReader(id).iterator());
|
|
||||||
|
|
||||||
// Set up merging and filtering to dynamically merge together multiple BAMs and filter out records not in the shard set.
|
// Set up merging and filtering to dynamically merge together multiple BAMs and filter out records not in the shard set.
|
||||||
SamFileHeaderMerger headerMerger = new SamFileHeaderMerger(readers.values(),SAMFileHeader.SortOrder.coordinate,true);
|
SamFileHeaderMerger headerMerger = new SamFileHeaderMerger(readers.values(),SAMFileHeader.SortOrder.coordinate,true);
|
||||||
CloseableIterator<SAMRecord> iterator = new MergingSamRecordIterator(headerMerger,readerToIteratorMap,true);
|
MergingSamRecordIterator mergingIterator = new MergingSamRecordIterator(headerMerger,true);
|
||||||
|
for(SAMReaderID id: getReaderIDs())
|
||||||
|
mergingIterator.addIterator(readers.getReader(id),readers.getReader(id).iterator());
|
||||||
|
|
||||||
return applyDecoratingIterators(shard instanceof ReadShard,
|
return applyDecoratingIterators(shard instanceof ReadShard,
|
||||||
new ReleasingIterator(readers,StingSAMIteratorAdapter.adapt(reads,iterator)),
|
new ReleasingIterator(readers,StingSAMIteratorAdapter.adapt(reads,mergingIterator)),
|
||||||
reads.getDownsamplingFraction(),
|
reads.getDownsamplingFraction(),
|
||||||
reads.getValidationExclusionList().contains(ValidationExclusion.TYPE.NO_READ_ORDER_VERIFICATION),
|
reads.getValidationExclusionList().contains(ValidationExclusion.TYPE.NO_READ_ORDER_VERIFICATION),
|
||||||
reads.getSupplementalFilters());
|
reads.getSupplementalFilters());
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,3 +1,3 @@
|
||||||
<ivy-module version="1.0">
|
<ivy-module version="1.0">
|
||||||
<info organisation="edu.mit.broad" module="picard-private-parts" revision="1333-sharding-6" status="integration" publication="20100330130700" />
|
<info organisation="edu.mit.broad" module="picard-private-parts" revision="1333-sharding-7" status="integration" publication="20100330191500" />
|
||||||
</ivy-module>
|
</ivy-module>
|
||||||
Binary file not shown.
|
|
@ -1,3 +1,3 @@
|
||||||
<ivy-module version="1.0">
|
<ivy-module version="1.0">
|
||||||
<info organisation="net.sf" module="picard" revision="1.16.366-sharding" status="release" />
|
<info organisation="net.sf" module="picard" revision="1.16.367-sharding" status="release" />
|
||||||
</ivy-module>
|
</ivy-module>
|
||||||
Binary file not shown.
|
|
@ -1,3 +1,3 @@
|
||||||
<ivy-module version="1.0">
|
<ivy-module version="1.0">
|
||||||
<info organisation="net.sf" module="sam" revision="1.16.366-sharding" status="release" />
|
<info organisation="net.sf" module="sam" revision="1.16.367-sharding" status="release" />
|
||||||
</ivy-module>
|
</ivy-module>
|
||||||
Loading…
Reference in New Issue