diff --git a/java/src/org/broadinstitute/sting/gatk/contexts/variantcontext/VariantJEXLContext.java b/java/src/org/broadinstitute/sting/gatk/contexts/variantcontext/VariantJEXLContext.java index a0a90aef6..5d953c06e 100644 --- a/java/src/org/broadinstitute/sting/gatk/contexts/variantcontext/VariantJEXLContext.java +++ b/java/src/org/broadinstitute/sting/gatk/contexts/variantcontext/VariantJEXLContext.java @@ -197,9 +197,11 @@ class JEXLMap implements Map { infoMap.put("isHomRef", g.isHomRef() ? "1" : "0"); infoMap.put("isHet", g.isHet() ? "1" : "0"); infoMap.put("isHomVar", g.isHomVar() ? "1" : "0"); - infoMap.put(VCFConstants.GENOTYPE_QUALITY_KEY, String.valueOf(g.getPhredScaledQual())); - for ( Map.Entry e : g.getAttributes().entrySet() ) - infoMap.put(e.getKey(), String.valueOf(e.getValue())); + infoMap.put(VCFConstants.GENOTYPE_QUALITY_KEY, new Double(g.getPhredScaledQual())); + for ( Map.Entry e : g.getAttributes().entrySet() ) { + if ( e.getValue() != null && !e.getValue().equals(VCFConstants.MISSING_VALUE_v4) ) + infoMap.put(e.getKey(), e.getValue()); + } } // create the internal context that we can evaluate expressions against diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/filters/VariantFiltrationIntegrationTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/filters/VariantFiltrationIntegrationTest.java index ac1643ced..c9ce395cc 100755 --- a/java/test/org/broadinstitute/sting/gatk/walkers/filters/VariantFiltrationIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/gatk/walkers/filters/VariantFiltrationIntegrationTest.java @@ -59,4 +59,20 @@ public class VariantFiltrationIntegrationTest extends WalkerTest { Arrays.asList("edbd505d8d55b4ba71f99d7006871db0")); executeTest("test filter with separate names #2", spec); } + + @Test + public void testGenotypeFilter1() { + WalkerTestSpec spec = new WalkerTestSpec( + baseTestString() + " -G_filter 'GQ == 0.60' -G_filterName foo -B variant,VCF," + validationDataLocation + "vcfexample2.vcf -L 1:10,020,000-10,021,000", 1, + Arrays.asList("391cd1c96546d1760265f7924428af8f")); + executeTest("test genotype filter #1", spec); + } + + @Test + public void testGenotypeFilter2() { + WalkerTestSpec spec = new WalkerTestSpec( + baseTestString() + " -G_filter 'AF == 0.04 && isHomVar == 1' -G_filterName foo -B variant,VCF," + validationDataLocation + "vcfexample2.vcf -L 1:10,020,000-10,021,000", 1, + Arrays.asList("0eb48f8cb2ad6a0e46c88a5116be2b04")); + executeTest("test genotype filter #2", spec); + } } \ No newline at end of file