Quick fix: base qual array in the GATKSAMRecord stores the actual phred values (-33) and not the original bytes (duh).

This commit is contained in:
Eric Banks 2012-12-03 12:18:20 -05:00
parent b6839b3049
commit 5fed9df295
3 changed files with 6 additions and 7 deletions

View File

@ -414,7 +414,7 @@ public class BAQ {
throw new ReviewedStingException("BAQ tag calculation error. BAQ value above base quality at " + read);
// the original quality is too high, almost certainly due to using the wrong encoding in the BAM file
if ( tag > Byte.MAX_VALUE )
throw new UserException.MisencodedBAM(read, "we encountered an extremely high quality score (" + ((int)read.getBaseQualities()[i] - 33) + ") with BAQ correction factor of " + baq_i);
throw new UserException.MisencodedBAM(read, "we encountered an extremely high quality score (" + (int)read.getBaseQualities()[i] + ") with BAQ correction factor of " + baq_i);
bqTag[i] = (byte)tag;
}
return new String(bqTag);

View File

@ -16,7 +16,6 @@ public class MisencodedBaseQualityReadTransformer extends ReadTransformer {
private static final int samplingFrequency = 1000; // sample 1 read for every 1000 encountered
private static final int encodingFixValue = 31; // Illumina_64 - PHRED_33
private static final byte maxAllowedQualByte = QualityUtils.MAX_REASONABLE_Q_SCORE + 33;
private boolean disabled;
private boolean fixQuals;
@ -60,8 +59,8 @@ public class MisencodedBaseQualityReadTransformer extends ReadTransformer {
final byte[] quals = read.getBaseQualities();
for ( final byte qual : quals ) {
if ( qual > maxAllowedQualByte )
throw new UserException.MisencodedBAM(read, "we encountered an extremely high quality score of " + ((int)qual - 33));
if ( qual > QualityUtils.MAX_REASONABLE_Q_SCORE )
throw new UserException.MisencodedBAM(read, "we encountered an extremely high quality score of " + (int)qual);
}
}
}

View File

@ -17,9 +17,9 @@ import java.util.List;
public class MisencodedBaseQualityUnitTest extends BaseTest {
private static final String readBases = "AAAAAAAAAA";
private static final byte[] badQuals = { 'Z', '[', 'c', 'd', 'e', 'a', 'b', 'Z', 'Y', 'X' };
private static final byte[] goodQuals = { '[', '[', '[', '[', '[', '[', '[', '[', '[', '[' };
private static final byte[] fixedQuals = { ';', '<', 'D', 'E', 'F', 'B', 'C', ';', ':', '9' };
private static final byte[] badQuals = { 59, 60, 62, 63, 64, 61, 62, 58, 57, 56 };
private static final byte[] goodQuals = { 60, 60, 60, 60, 60, 60, 60, 60, 60, 60 };
private static final byte[] fixedQuals = { 28, 29, 31, 32, 33, 30, 31, 27, 26, 25 };
private SAMFileHeader header;
@BeforeMethod