diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java index bf0ee18b0..3204fe53d 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java @@ -155,7 +155,10 @@ public class VariantAnnotator extends RodWalker { VariationRod variant = (VariationRod)rods.getRecords().get(0); // if the reference base is not ambiguous, the variant is a SNP, and it's the appropriate type, we can annotate - if ( BaseUtils.simpleBaseToBaseIndex(ref.getBase()) != -1 && variant.isSNP() && variant instanceof VariantBackedByGenotype ) { + if ( BaseUtils.simpleBaseToBaseIndex(ref.getBase()) != -1 && + variant.isBiallelic() && + variant.isSNP() && + variant instanceof VariantBackedByGenotype ) { final List genotypes = ((VariantBackedByGenotype)variant).getGenotypes(); if ( genotypes != null ) annotations = getAnnotations(ref, context, genotypes, requestedAnnotations); diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorIntegrationTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorIntegrationTest.java index 86a4e9ebe..559004525 100755 --- a/java/test/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorIntegrationTest.java @@ -7,38 +7,70 @@ import java.util.Arrays; public class VariantAnnotatorIntegrationTest extends WalkerTest { public static String baseTestString() { - return "-T VariantAnnotator -R /broad/1KG/reference/human_b36_both.fasta -I /humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,000,000-10,010,000 -vcf %s"; + return "-T VariantAnnotator -R /broad/1KG/reference/human_b36_both.fasta -vcf %s"; } @Test - public void testNoAnnots1() { + public void testHasAnnotsNotAsking1() { WalkerTestSpec spec = new WalkerTestSpec( - baseTestString() + " -B variant,VCF,/humgen/gsa-scr1/GATK_Data/Validation_Data/vcfexample2.vcf ", 1, - Arrays.asList("4e231f16c202d88ca3adb17168af0e0f")); - //executeTest("testNoAnnots1", spec); + baseTestString() + " -B variant,VCF,/humgen/gsa-scr1/GATK_Data/Validation_Data/vcfexample2.vcf -I /humgen/gsa-scr1/GATK_Data/Validation_Data/low_coverage_CEU.chr1.10k-11k.bam -L 1:10,020,000-10,021,000", 1, + Arrays.asList("4d7e6670ec71e3b7065ca7e25855189d")); + executeTest("test file has annotations, not asking for annotations, #1", spec); } @Test - public void testNoAnnots2() { + public void testHasAnnotsNotAsking2() { WalkerTestSpec spec = new WalkerTestSpec( - baseTestString() + " -B variant,VCF,/humgen/gsa-scr1/GATK_Data/Validation_Data/vcfexample3.vcf ", 1, - Arrays.asList("ef0c59e47a2afcbecf2bcef6aa01e7e7")); - //executeTest("testNoAnnots2", spec); + baseTestString() + " -B variant,VCF,/humgen/gsa-scr1/GATK_Data/Validation_Data/vcfexample3.vcf -I /humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,000,000-10,050,000", 1, + Arrays.asList("227f38b2f322780187eacd0c98ace3e6")); + executeTest("test file has annotations, not asking for annotations, #2", spec); } @Test - public void testAllAnnots1() { + public void testHasAnnotsAsking1() { WalkerTestSpec spec = new WalkerTestSpec( - baseTestString() + " -all -B variant,VCF,/humgen/gsa-scr1/GATK_Data/Validation_Data/vcfexample2.vcf ", 1, - Arrays.asList("ced92b5ac9e2692c4d8acce1235317b6")); - //executeTest("testAllAnnots1", spec); + baseTestString() + " -all -B variant,VCF,/humgen/gsa-scr1/GATK_Data/Validation_Data/vcfexample2.vcf -I /humgen/gsa-scr1/GATK_Data/Validation_Data/low_coverage_CEU.chr1.10k-11k.bam -L 1:10,020,000-10,021,000", 1, + Arrays.asList("94103b529e013748696be3e5dd0d90ee")); + executeTest("test file has annotations, asking for annotations, #1", spec); } @Test - public void testAllAnnots2() { + public void testHasAnnotsAsking2() { WalkerTestSpec spec = new WalkerTestSpec( - baseTestString() + " -all -B variant,VCF,/humgen/gsa-scr1/GATK_Data/Validation_Data/vcfexample3.vcf ", 1, - Arrays.asList("573a6c02f659b2c4cf014f84bd0b9c8a")); - //executeTest("testAllAnnots2", spec); + baseTestString() + " -all -B variant,VCF,/humgen/gsa-scr1/GATK_Data/Validation_Data/vcfexample3.vcf -I /humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,000,000-10,050,000", 1, + Arrays.asList("227f38b2f322780187eacd0c98ace3e6")); + executeTest("test file has annotations, asking for annotations, #2", spec); + } + + @Test + public void testNoAnnotsNotAsking1() { + WalkerTestSpec spec = new WalkerTestSpec( + baseTestString() + " -B variant,VCF,/humgen/gsa-scr1/GATK_Data/Validation_Data/vcfexample2empty.vcf -I /humgen/gsa-scr1/GATK_Data/Validation_Data/low_coverage_CEU.chr1.10k-11k.bam -L 1:10,020,000-10,021,000", 1, + Arrays.asList("386ab9b98b708a840a1ae915624777d5")); + executeTest("test file doesn't have annotations, not asking for annotations, #1", spec); + } + + @Test + public void testNoAnnotsNotAsking2() { + WalkerTestSpec spec = new WalkerTestSpec( + baseTestString() + " -B variant,VCF,/humgen/gsa-scr1/GATK_Data/Validation_Data/vcfexample3empty.vcf -I /humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,000,000-10,050,000", 1, + Arrays.asList("da51f18d189fb0fd804822c81b786e0f")); + executeTest("test file doesn't have annotations, not asking for annotations, #2", spec); + } + + @Test + public void testNoAnnotsAsking1() { + WalkerTestSpec spec = new WalkerTestSpec( + baseTestString() + " -all -B variant,VCF,/humgen/gsa-scr1/GATK_Data/Validation_Data/vcfexample2empty.vcf -I /humgen/gsa-scr1/GATK_Data/Validation_Data/low_coverage_CEU.chr1.10k-11k.bam -L 1:10,020,000-10,021,000", 1, + Arrays.asList("cf2f60758269759f7be79ad18b12771b")); + executeTest("test file doesn't have annotations, asking for annotations, #1", spec); + } + + @Test + public void testNoAnnotsAsking2() { + WalkerTestSpec spec = new WalkerTestSpec( + baseTestString() + " -all -B variant,VCF,/humgen/gsa-scr1/GATK_Data/Validation_Data/vcfexample3empty.vcf -I /humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -L 1:10,000,000-10,050,000", 1, + Arrays.asList("1ed34e09afbc25e034597a97c7861077")); + executeTest("test file doesn't have annotations, asking for annotations, #2", spec); } } \ No newline at end of file