Catch malformed BAM files at the source since this is the largest class of errors in Tableau.

This commit is contained in:
Eric Banks 2012-10-12 09:07:57 -04:00
parent 593c8065d9
commit ad60300bee
1 changed files with 6 additions and 0 deletions

View File

@ -1008,6 +1008,12 @@ public class SAMDataSource {
} catch ( SAMFormatException e ) {
throw new UserException.MalformedBAM(readerID.samFile, e.getMessage());
}
// Picard is throwing a RuntimeException here when BAMs are malformed with bad headers (and so look like SAM files).
// Let's keep this separate from the SAMFormatException (which ultimately derives from RuntimeException) case,
// just in case we want to change this behavior later.
catch ( RuntimeException e ) {
throw new UserException.MalformedBAM(readerID.samFile, e.getMessage());
}
reader.setSAMRecordFactory(factory);
reader.enableFileSource(true);
reader.setValidationStringency(validationStringency);