Contracts for HasGenomeLocation. BAQ iterator variables are all final. Contracts added
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5844 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
43057bd15c
commit
b814f4bbd6
|
|
@ -1,8 +1,11 @@
|
||||||
package org.broadinstitute.sting.utils;
|
package org.broadinstitute.sting.utils;
|
||||||
|
|
||||||
|
import com.google.java.contract.Ensures;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates that this object has a genomic location and provides a systematic interface to get it.
|
* Indicates that this object has a genomic location and provides a systematic interface to get it.
|
||||||
*/
|
*/
|
||||||
public interface HasGenomeLocation {
|
public interface HasGenomeLocation {
|
||||||
|
@Ensures("result != null")
|
||||||
public GenomeLoc getLocation();
|
public GenomeLoc getLocation();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package org.broadinstitute.sting.utils.baq;
|
package org.broadinstitute.sting.utils.baq;
|
||||||
|
|
||||||
|
import com.google.java.contract.Ensures;
|
||||||
|
import com.google.java.contract.Requires;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
import net.sf.picard.reference.IndexedFastaSequenceFile;
|
||||||
import org.broadinstitute.sting.utils.baq.BAQ;
|
import org.broadinstitute.sting.utils.baq.BAQ;
|
||||||
|
|
@ -12,11 +14,11 @@ import java.util.Iterator;
|
||||||
* Simple iterator that applies Heng's BAQ calculation to a stream of incoming reads
|
* Simple iterator that applies Heng's BAQ calculation to a stream of incoming reads
|
||||||
*/
|
*/
|
||||||
public class BAQSamIterator implements StingSAMIterator {
|
public class BAQSamIterator implements StingSAMIterator {
|
||||||
StingSAMIterator it;
|
private final StingSAMIterator it;
|
||||||
BAQ baqHMM = new BAQ(); // creates a BAQ creator with default parameters
|
private final BAQ baqHMM = new BAQ(); // creates a BAQ creator with default parameters
|
||||||
IndexedFastaSequenceFile refReader = null;
|
private final IndexedFastaSequenceFile refReader;
|
||||||
BAQ.CalculationMode cmode;
|
private final BAQ.CalculationMode cmode;
|
||||||
BAQ.QualityMode qmode;
|
private final BAQ.QualityMode qmode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new BAMSamIterator using the reference getter refReader and applies the BAM to the reads coming
|
* Creates a new BAMSamIterator using the reference getter refReader and applies the BAM to the reads coming
|
||||||
|
|
@ -27,6 +29,11 @@ public class BAQSamIterator implements StingSAMIterator {
|
||||||
* @param cmode
|
* @param cmode
|
||||||
* @param qmode
|
* @param qmode
|
||||||
*/
|
*/
|
||||||
|
@Requires({
|
||||||
|
"refReader != null",
|
||||||
|
"it != null",
|
||||||
|
"cmode != null" ,
|
||||||
|
"qmode != null"})
|
||||||
public BAQSamIterator(IndexedFastaSequenceFile refReader, StingSAMIterator it, BAQ.CalculationMode cmode, BAQ.QualityMode qmode) {
|
public BAQSamIterator(IndexedFastaSequenceFile refReader, StingSAMIterator it, BAQ.CalculationMode cmode, BAQ.QualityMode qmode) {
|
||||||
if ( cmode == BAQ.CalculationMode.OFF) throw new ReviewedStingException("BUG: shouldn't create BAQSamIterator with calculation mode OFF");
|
if ( cmode == BAQ.CalculationMode.OFF) throw new ReviewedStingException("BUG: shouldn't create BAQSamIterator with calculation mode OFF");
|
||||||
if ( qmode == BAQ.QualityMode.DONT_MODIFY ) throw new ReviewedStingException("BUG: shouldn't create BAQSamIterator with quailty mode DONT_MODIFY");
|
if ( qmode == BAQ.QualityMode.DONT_MODIFY ) throw new ReviewedStingException("BUG: shouldn't create BAQSamIterator with quailty mode DONT_MODIFY");
|
||||||
|
|
@ -37,6 +44,8 @@ public class BAQSamIterator implements StingSAMIterator {
|
||||||
this.qmode = qmode;
|
this.qmode = qmode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Requires("hasNext()")
|
||||||
|
@Ensures("result != null")
|
||||||
public SAMRecord next() {
|
public SAMRecord next() {
|
||||||
//System.out.printf("BAQing during input%n");
|
//System.out.printf("BAQing during input%n");
|
||||||
SAMRecord read = it.next();
|
SAMRecord read = it.next();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue