Merge branch 'master' of github.com:broadinstitute/gsa-unstable
This commit is contained in:
commit
496727ac5e
|
|
@ -673,7 +673,9 @@ public class BAQ {
|
||||||
} else if ( excludeReadFromBAQ(read) ) {
|
} else if ( excludeReadFromBAQ(read) ) {
|
||||||
; // just fall through
|
; // just fall through
|
||||||
} else {
|
} else {
|
||||||
if ( calculationType == CalculationMode.RECALCULATE || ! hasBAQTag(read) ) {
|
final boolean readHasBAQTag = hasBAQTag(read);
|
||||||
|
|
||||||
|
if ( calculationType == CalculationMode.RECALCULATE || ! readHasBAQTag ) {
|
||||||
if ( DEBUG ) System.out.printf(" Calculating BAQ on the fly%n");
|
if ( DEBUG ) System.out.printf(" Calculating BAQ on the fly%n");
|
||||||
BAQCalculationResult hmmResult = calcBAQFromHMM(read, refReader);
|
BAQCalculationResult hmmResult = calcBAQFromHMM(read, refReader);
|
||||||
if ( hmmResult != null ) {
|
if ( hmmResult != null ) {
|
||||||
|
|
@ -683,6 +685,9 @@ public class BAQ {
|
||||||
case DONT_MODIFY: BAQQuals = hmmResult.bq; break;
|
case DONT_MODIFY: BAQQuals = hmmResult.bq; break;
|
||||||
default: throw new ReviewedStingException("BUG: unexpected qmode " + qmode);
|
default: throw new ReviewedStingException("BUG: unexpected qmode " + qmode);
|
||||||
}
|
}
|
||||||
|
} else if ( readHasBAQTag ) {
|
||||||
|
// remove the BAQ tag if it's there because we cannot trust it
|
||||||
|
read.setAttribute(BAQ_TAG, null);
|
||||||
}
|
}
|
||||||
} else if ( qmode == QualityMode.OVERWRITE_QUALS ) { // only makes sense if we are overwriting quals
|
} else if ( qmode == QualityMode.OVERWRITE_QUALS ) { // only makes sense if we are overwriting quals
|
||||||
if ( DEBUG ) System.out.printf(" Taking BAQ from tag%n");
|
if ( DEBUG ) System.out.printf(" Taking BAQ from tag%n");
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,23 @@ public class BAQUnitTest extends BaseTest {
|
||||||
Assert.assertTrue(baq.calcEpsilon( ref, alt, (byte)i) >= 0.0, "Failed to get baq epsilon range");
|
Assert.assertTrue(baq.calcEpsilon( ref, alt, (byte)i) >= 0.0, "Failed to get baq epsilon range");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(enabled = true)
|
||||||
|
public void testBAQOverwritesExistingTagWithNull() {
|
||||||
|
|
||||||
|
// create a read with a single base off the end of the contig, which cannot be BAQed
|
||||||
|
final SAMRecord read = ArtificialSAMUtils.createArtificialRead(header, "foo", 0, fasta.getSequenceDictionary().getSequence("chr1").getSequenceLength() + 1, 1);
|
||||||
|
read.setReadBases(new byte[] {(byte) 'A'});
|
||||||
|
read.setBaseQualities(new byte[] {(byte) 20});
|
||||||
|
read.setCigarString("1M");
|
||||||
|
read.setAttribute("BQ", "A");
|
||||||
|
|
||||||
|
// try to BAQ and tell it to RECALCULATE AND ADD_TAG
|
||||||
|
BAQ baq = new BAQ(1e-3, 0.1, 7, (byte)4, false);
|
||||||
|
baq.baqRead(read, fasta, BAQ.CalculationMode.RECALCULATE, BAQ.QualityMode.ADD_TAG);
|
||||||
|
|
||||||
|
// did we remove the existing tag?
|
||||||
|
Assert.assertTrue(read.getAttribute("BQ") == null);
|
||||||
|
}
|
||||||
|
|
||||||
public void testBAQ(BAQTest test, boolean lookupWithFasta) {
|
public void testBAQ(BAQTest test, boolean lookupWithFasta) {
|
||||||
BAQ baqHMM = new BAQ(1e-3, 0.1, 7, (byte)4, false); // matches current samtools parameters
|
BAQ baqHMM = new BAQ(1e-3, 0.1, 7, (byte)4, false); // matches current samtools parameters
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue