Fixing genotype filtering for VF and adding integration tests

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3839 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2010-07-20 07:30:21 +00:00
parent 2a6c2d3098
commit 0db7fab1a9
2 changed files with 21 additions and 3 deletions

View File

@ -197,9 +197,11 @@ class JEXLMap implements Map<VariantContextUtils.JexlVCMatchExp, Boolean> {
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<String, Object> 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<String, Object> 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

View File

@ -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);
}
}