Added a constructor, took out a copy constructor, and changed some SAMBAM code.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@335 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2009-04-08 19:53:20 +00:00
parent 0b81a76420
commit d4ab95c098
3 changed files with 13 additions and 22 deletions

View File

@ -103,7 +103,7 @@ public class SAMBAMDataSource implements SimpleDataSource {
* @return an iterator for that region
*/
public MergingSamRecordIterator2 seek(GenomeLoc location) {
MergingSamRecordIterator2 iter = new MergingSamRecordIterator2(this.mergeIterator);
MergingSamRecordIterator2 iter = null; // new MergingSamRecordIterator2(this.mergeIterator.getMergedHeader().);
if (locusMode) {
iter.query(location.getContig(), (int) location.getStart(), (int) location.getStop(), true);
} else {

View File

@ -1,6 +1,7 @@
package org.broadinstitute.sting.gatk.iterators;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.FastaSequenceFile2;
import java.util.Iterator;
@ -30,7 +31,7 @@ import java.util.Iterator;
* <p/>
* This class is a decorator class from Reference Iterator (though it is constrained
* by the fact that referenceIterator.seekForwardOffset explicitly returns a referenceIterator
* for now
* for now).
* <p/>
* TODO: Fix the underlying iterator and this class to model a real decorator pattern
*/
@ -51,6 +52,16 @@ public class BoundedReferenceIterator implements Iterator<ReferenceIterator> {
}
/**
* Create a BoundedReferenceIterator from a fasta seq and a genome loc
* @param refFile the fasta file, see the ReferenceIterator constructor
* @param loc our genome location
*/
public BoundedReferenceIterator(FastaSequenceFile2 refFile, GenomeLoc loc) {
this.referenceIterator = new ReferenceIterator(refFile);
this.mLoc = loc;
}
/**
* isSubRegion
* <p/>

View File

@ -59,26 +59,6 @@ public class MergingSamRecordIterator2 implements Iterator<SAMRecord> {
}
}
/**
* Constructs a new merging iterator with the same set of readers and sort order as
* provided by the header merger parameter.
*/
public MergingSamRecordIterator2(MergingSamRecordIterator2 iter) {
this.samHeaderMerger = iter.samHeaderMerger;
this.sortOrder = iter.sortOrder;
initializePQ();
final SAMRecordComparator comparator = getComparator();
for (final SAMFileReader reader : samHeaderMerger.getReaders()) {
if (this.sortOrder != SAMFileHeader.SortOrder.unsorted && reader.getFileHeader().getSortOrder() != this.sortOrder) {
throw new PicardException("Files are not compatible with sort order: " + this.sortOrder);
}
final ComparableSamRecordIterator iterator = new ComparableSamRecordIterator(reader, comparator);
addIfNotEmpty(iterator);
}
}
protected void initializePQ() {
this.pq = new PriorityQueue<ComparableSamRecordIterator>(samHeaderMerger.getReaders().size());