From ba1a33029391817d6cc07ce44e973844f4e92a14 Mon Sep 17 00:00:00 2001 From: delangel Date: Thu, 29 Jul 2010 20:02:47 +0000 Subject: [PATCH] Corrected location and made more explicit the error message thrown if someone tries to read a VCF 3.3 file with indels, which is not supported. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3901 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/refdata/features/vcf4/VCF4Codec.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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 d2ebfc42a..abb6ca1ac 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 @@ -306,8 +306,16 @@ public class VCF4Codec implements FeatureCodec, NameAwareCodec { Utils.warnUser("We are currently unable to parse out CNV encodings in VCF, we saw the following allele = " + allele); return false; } - else if ( ! Allele.acceptableAlleleBases(allele,isRef) ) { - throw new VCFParserException("Unparsable vcf record with allele " + allele); + else { + // check for VCF3.3 insertions or deletions + if (this.version != VCFHeaderVersion.VCF4_0) { + if ((allele.toUpperCase().charAt(0) == 'D') || (allele.toUpperCase().charAt(0) == 'D')) + throw new VCFParserException("Insertions/Deletions are not supported when reading 3.x VCF's. Please" + + " convert your file to VCF 4.0 using VCFTools, available at http://vcftools.sourceforge.net/index.html"); + } + + if ( ! Allele.acceptableAlleleBases(allele,isRef) ) + throw new VCFParserException("Unparsable vcf record with allele " + allele); } return true; } @@ -396,9 +404,7 @@ public class VCF4Codec implements FeatureCodec, NameAwareCodec { // find out our current location, and clip the alleles down to their minimum length Pair> locAndAlleles; if ( !isSingleNucleotideEvent(alleles) ) { - if (this.version != VCFHeaderVersion.VCF4_0) - throw new VCFParserException("Saw Indel/non SNP event on a VCF 3.3 or earlier file. Please convert file to VCF4.0 with VCFTools before using the GATK on it"); - locAndAlleles = clipAlleles(contig, pos, ref, alleles); + locAndAlleles = clipAlleles(contig, pos, ref, alleles); } else { locAndAlleles = new Pair>(GenomeLocParser.createGenomeLoc(contig, pos), alleles); }