Protect against bad bases users have screwy data (or try to use zipped references)

This commit is contained in:
Eric Banks 2012-10-12 15:05:03 -04:00
parent da1cffbfca
commit a8efa5451a
1 changed files with 4 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package org.broadinstitute.sting.utils;
import net.sf.samtools.util.StringUtil;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.exceptions.UserException;
import java.util.Arrays;
@ -198,7 +199,9 @@ public class BaseUtils {
* @param base [AaCcGgTt]
* @return 0, 1, 2, 3, or -1 if the base can't be understood
*/
static public int simpleBaseToBaseIndex(byte base) {
static public int simpleBaseToBaseIndex(final byte base) {
if ( base < 0 || base >= 256 )
throw new UserException.BadInput("Non-standard bases were encountered in either the input reference or BAM file(s)");
return baseIndexMap[base];
}