Catch malformed base qualities and throw as a User Error

This commit is contained in:
Eric Banks 2012-05-08 09:34:57 -04:00
parent c40cda7e3c
commit 5cf4fd63c2
1 changed files with 5 additions and 1 deletions

View File

@ -425,7 +425,11 @@ public class TableRecalibrationWalker extends ReadWalker<SAMRecord, SAMFileWrite
read.setBaseQualities(recalQuals); // Overwrite old qualities with new recalibrated qualities
if (!DO_NOT_WRITE_OQ && read.getAttribute(RecalDataManager.ORIGINAL_QUAL_ATTRIBUTE_TAG) == null) { // Save the old qualities if the tag isn't already taken in the read
read.setAttribute(RecalDataManager.ORIGINAL_QUAL_ATTRIBUTE_TAG, SAMUtils.phredToFastq(originalQuals));
try {
read.setAttribute(RecalDataManager.ORIGINAL_QUAL_ATTRIBUTE_TAG, SAMUtils.phredToFastq(originalQuals));
} catch (IllegalArgumentException e) {
throw new UserException.MalformedBAM(read, "illegal base quality encountered; " + e.getMessage());
}
}
if (!skipUQUpdate && refBases != null && read.getAttribute(SAMTag.UQ.name()) != null) {