Phase 2 of Picard patch refactoring: kill off SAMFileReader2/BAMFileReader2, merging the changes back into the base classes.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3065 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2010-03-23 16:48:11 +00:00
parent 7462a0b2d1
commit 884a577013
11 changed files with 15 additions and 20 deletions

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.datasources.shards; package org.broadinstitute.sting.gatk.datasources.shards;
import net.sf.samtools.Chunk; import net.sf.samtools.Chunk;
import net.sf.samtools.SAMFileReader2; import net.sf.samtools.SAMFileReader;
import net.sf.samtools.SAMRecord; import net.sf.samtools.SAMRecord;
import net.sf.picard.filter.SamRecordFilter; import net.sf.picard.filter.SamRecordFilter;

View File

@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.datasources.shards; package org.broadinstitute.sting.gatk.datasources.shards;
import net.sf.samtools.Chunk; import net.sf.samtools.Chunk;
import net.sf.samtools.SAMFileReader2; import net.sf.samtools.SAMFileReader;
import net.sf.samtools.SAMRecord; import net.sf.samtools.SAMRecord;
import net.sf.picard.filter.SamRecordFilter; import net.sf.picard.filter.SamRecordFilter;

View File

@ -5,7 +5,7 @@ import org.broadinstitute.sting.utils.StingException;
import org.broadinstitute.sting.gatk.iterators.StingSAMIterator; import org.broadinstitute.sting.gatk.iterators.StingSAMIterator;
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.SAMReaderID; import org.broadinstitute.sting.gatk.datasources.simpleDataSources.SAMReaderID;
import net.sf.samtools.Chunk; import net.sf.samtools.Chunk;
import net.sf.samtools.SAMFileReader2; import net.sf.samtools.SAMFileReader;
import net.sf.samtools.SAMRecord; import net.sf.samtools.SAMRecord;
import net.sf.picard.filter.SamRecordFilter; import net.sf.picard.filter.SamRecordFilter;

View File

@ -12,7 +12,7 @@ import org.broadinstitute.sting.gatk.datasources.simpleDataSources.SAMReaderID;
import java.util.*; import java.util.*;
import net.sf.samtools.Chunk; import net.sf.samtools.Chunk;
import net.sf.samtools.SAMFileReader2; import net.sf.samtools.SAMFileReader;
import net.sf.samtools.SAMFileHeader; import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMSequenceRecord; import net.sf.samtools.SAMSequenceRecord;

View File

@ -132,7 +132,7 @@ public class BlockDrivenSAMDataSource extends SAMDataSource {
*/ */
public PreloadedBAMFileIndex getIndex(final SAMReaderID id) { public PreloadedBAMFileIndex getIndex(final SAMReaderID id) {
SAMReaders readers = resourcePool.getReadersWithoutLocking(); SAMReaders readers = resourcePool.getReadersWithoutLocking();
return ((SAMFileReader2)readers.getReader(id)).getIndex(PreloadedBAMFileIndex.class); return readers.getReader(id).getIndex(PreloadedBAMFileIndex.class);
} }
/** /**
@ -203,10 +203,8 @@ public class BlockDrivenSAMDataSource extends SAMDataSource {
} }
private void initializeReaderPositions(SAMReaders readers) { private void initializeReaderPositions(SAMReaders readers) {
for(SAMReaderID id: getReaderIDs()) { for(SAMReaderID id: getReaderIDs())
SAMFileReader2 reader2 = (SAMFileReader2)readers.getReader(id); readerPositions.put(id,readers.getReader(id).getCurrentPosition());
readerPositions.put(id,reader2.getCurrentPosition());
}
} }
public StingSAMIterator seek(Shard shard) { public StingSAMIterator seek(Shard shard) {
@ -238,13 +236,12 @@ public class BlockDrivenSAMDataSource extends SAMDataSource {
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>>(); Map<SAMFileReader,CloseableIterator<SAMRecord>> readerToIteratorMap = new HashMap<SAMFileReader,CloseableIterator<SAMRecord>>();
for(SAMReaderID id: getReaderIDs()) { for(SAMReaderID id: getReaderIDs()) {
SAMFileReader2 reader2 = (SAMFileReader2)readers.getReader(id);
if(shard.getChunks().get(id) == null) if(shard.getChunks().get(id) == null)
continue; continue;
CloseableIterator<SAMRecord> iterator = reader2.iterator(shard.getChunks().get(id)); CloseableIterator<SAMRecord> iterator = readers.getReader(id).iterator(shard.getChunks().get(id));
if(shard.getFilter() != null) if(shard.getFilter() != null)
iterator = new FilteringIterator(iterator,shard.getFilter()); iterator = new FilteringIterator(iterator,shard.getFilter());
readerToIteratorMap.put(reader2,iterator); readerToIteratorMap.put(readers.getReader(id),iterator);
} }
SamFileHeaderMerger headerMerger = new SamFileHeaderMerger(readers.values(),SAMFileHeader.SortOrder.coordinate,true); SamFileHeaderMerger headerMerger = new SamFileHeaderMerger(readers.values(),SAMFileHeader.SortOrder.coordinate,true);
@ -268,10 +265,8 @@ public class BlockDrivenSAMDataSource extends SAMDataSource {
SAMReaders readers = resourcePool.getAvailableReaders(); SAMReaders readers = resourcePool.getAvailableReaders();
Map<SAMFileReader,CloseableIterator<SAMRecord>> readerToIteratorMap = new HashMap<SAMFileReader,CloseableIterator<SAMRecord>>(); Map<SAMFileReader,CloseableIterator<SAMRecord>> readerToIteratorMap = new HashMap<SAMFileReader,CloseableIterator<SAMRecord>>();
for(SAMReaderID id: getReaderIDs()) { for(SAMReaderID id: getReaderIDs())
SAMFileReader2 reader2 = (SAMFileReader2)readers.getReader(id); readerToIteratorMap.put(readers.getReader(id),readers.getReader(id).iterator());
readerToIteratorMap.put(reader2,reader2.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);
@ -388,7 +383,7 @@ public class BlockDrivenSAMDataSource extends SAMDataSource {
*/ */
public SAMReaders(Reads sourceInfo) { public SAMReaders(Reads sourceInfo) {
for(File readsFile: sourceInfo.getReadsFiles()) { for(File readsFile: sourceInfo.getReadsFiles()) {
SAMFileReader2 reader = new SAMFileReader2(readsFile,true); SAMFileReader reader = new SAMFileReader(readsFile,true);
reader.setValidationStringency(sourceInfo.getValidationStringency()); reader.setValidationStringency(sourceInfo.getValidationStringency());
// If no read group is present, hallucinate one. // If no read group is present, hallucinate one.

View File

@ -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-1" status="integration" publication="20100319183800" /> <info organisation="edu.mit.broad" module="picard-private-parts" revision="1333-sharding-2" status="integration" publication="20100319183800" />
</ivy-module> </ivy-module>

View File

@ -1,3 +1,3 @@
<ivy-module version="1.0"> <ivy-module version="1.0">
<info organisation="net.sf" module="picard" revision="1.16.360-sharding" status="release" /> <info organisation="net.sf" module="picard" revision="1.16.362-sharding" status="release" />
</ivy-module> </ivy-module>

View File

@ -1,3 +1,3 @@
<ivy-module version="1.0"> <ivy-module version="1.0">
<info organisation="net.sf" module="sam" revision="1.16.360-sharding" status="release" /> <info organisation="net.sf" module="sam" revision="1.16.362-sharding" status="release" />
</ivy-module> </ivy-module>