Handling some of the NumberFormatExceptions seen via Tableau that are really user errors.

This commit is contained in:
Eric Banks 2012-04-18 12:57:37 -04:00
parent 70777c7af8
commit 392f1903f7
2 changed files with 8 additions and 1 deletions

View File

@ -73,6 +73,8 @@ public class RefSeqCodec implements ReferenceDependentFeatureCodec<RefSeqFeature
} catch ( UserException.MalformedGenomeLoc e ) {
Utils.warnUser("RefSeq file is potentially incorrect, as some transcripts or exons have a negative length ("+fields[2]+")");
return null;
} catch ( NumberFormatException e ) {
throw new UserException.MalformedFile("Could not parse location from line: " + line);
}
}

View File

@ -473,7 +473,12 @@ public abstract class AbstractVCFCodec implements FeatureCodec, NameAwareCodec {
protected static Allele oneAllele(String index, List<Allele> alleles) {
if ( index.equals(VCFConstants.EMPTY_ALLELE) )
return Allele.NO_CALL;
int i = Integer.valueOf(index);
final int i;
try {
i = Integer.valueOf(index);
} catch ( NumberFormatException e ) {
throw new TribbleException.InternalCodecException("The following invalid GT allele index was encountered in the file: " + index);
}
if ( i >= alleles.size() )
throw new TribbleException.InternalCodecException("The allele with index " + index + " is not defined in the REF/ALT columns in the record");
return alleles.get(i);