diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4Codec.java b/java/src/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4Codec.java index 9dba4601d..1d30b64df 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4Codec.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4Codec.java @@ -387,11 +387,11 @@ public class VCF4Codec implements FeatureCodec, NameAwareCodec { // find out our current location, and clip the alleles down to their minimum length Pair> locAndAlleles; - if (ref.length() > 1) { - attributes.put(ORIGINAL_ALLELE_LIST,alleles); - locAndAlleles = clipAlleles(contig, pos, ref, alleles); + if ( hasIndel(alleles) ) { + attributes.put(ORIGINAL_ALLELE_LIST,alleles); + locAndAlleles = clipAlleles(contig, pos, ref, alleles); } else { - locAndAlleles = new Pair>(GenomeLocParser.createGenomeLoc(contig, pos), alleles); + locAndAlleles = new Pair>(GenomeLocParser.createGenomeLoc(contig, pos), alleles); } // a map to store our genotypes @@ -405,6 +405,15 @@ public class VCF4Codec implements FeatureCodec, NameAwareCodec { return new VariantContext(name, locAndAlleles.first, locAndAlleles.second, genotypes, qual, filters, attributes); } + private boolean hasIndel(List alleles) { + int lengthOfFirstEntry = alleles.get(0).length(); + for ( int i = 1; i < alleles.size(); i++ ) { + if ( alleles.get(i).length() != lengthOfFirstEntry ) + return true; + } + return false; + } + class VCFParserException extends StingException { public VCFParserException(String msg) { super("Line " + lineNo + " generated parser exception " + msg);