Fail gracefully when encountering malformed VCFs without enough data columns

This commit is contained in:
Eric Banks 2011-12-14 10:37:38 -05:00
parent 079932ba2a
commit d3f4a5a901
2 changed files with 4 additions and 0 deletions

View File

@ -120,6 +120,8 @@ public class VCF3Codec extends AbstractVCFCodec {
genotypeParts = new String[header.getColumnCount() - NUM_STANDARD_FIELDS];
int nParts = ParsingUtils.split(str, genotypeParts, VCFConstants.FIELD_SEPARATOR_CHAR);
if ( nParts != genotypeParts.length )
generateException("there are " + (nParts-1) + " genotypes while the header requires that " + (genotypeParts.length-1) + " genotypes be present for all records", lineNo);
ArrayList<Genotype> genotypes = new ArrayList<Genotype>(nParts);

View File

@ -147,6 +147,8 @@ public class VCFCodec extends AbstractVCFCodec {
genotypeParts = new String[header.getColumnCount() - NUM_STANDARD_FIELDS];
int nParts = ParsingUtils.split(str, genotypeParts, VCFConstants.FIELD_SEPARATOR_CHAR);
if ( nParts != genotypeParts.length )
generateException("there are " + (nParts-1) + " genotypes while the header requires that " + (genotypeParts.length-1) + " genotypes be present for all records", lineNo);
ArrayList<Genotype> genotypes = new ArrayList<Genotype>(nParts);