/** * Matches each JexlVCMatchExp exp against the data contained in vc, and returns a map from these * expressions to true (if they matched) or false (if they didn't). This the best way to apply JEXL * expressions to VariantContext records. Use initializeMatchExps() to create the list of JexlVCMatchExp * expressions. * * @param vc variant context * @param exps expressions * @return true if there is a match */ public static Map<JexlVCMatchExp, Boolean> match(VariantContext vc, Collection<JexlVCMatchExp> exps) { return new JEXLMap(exps,vc); }
/** * Matches each JexlVCMatchExp exp against the data contained in vc/g, and returns a map from these * expressions to true (if they matched) or false (if they didn't). This the best way to apply JEXL * expressions to VariantContext records/genotypes. Use initializeMatchExps() to create the list of JexlVCMatchExp * expressions. * * @param vc variant context * @param g genotype * @param exps expressions * @return true if there is a match */ public static Map<JexlVCMatchExp, Boolean> match(VariantContext vc, Genotype g, Collection<JexlVCMatchExp> exps) { return new JEXLMap(exps,vc,g); }
/** * Matches each {@link JexlVCMatchExp} exp against the data contained in {@code vc}, * and returns a map from these expressions to {@code true} (if they matched) or {@code false} (if they didn't). * This the best way to apply JEXL expressions to {@link VariantContext} records. * Use the various {@code initializeMatchExps()}'s to create the list of {@link JexlVCMatchExp} expressions. * * Expressions that contain literals not available in the VariantContext or Genotype will be treated as not matching * @param vc variant context * @param exps expressions * @return true if there is a match */ public static Map<JexlVCMatchExp, Boolean> match(VariantContext vc, Collection<JexlVCMatchExp> exps) { return new JEXLMap(exps,vc); }
/** * Matches each {@link JexlVCMatchExp} exp against the data contained in {@code vc}, * and returns a map from these expressions to {@code true} (if they matched) or {@code false} (if they didn't). * This the best way to apply JEXL expressions to {@link VariantContext} records. * Use the various {@code initializeMatchExps()}'s to create the list of {@link JexlVCMatchExp} expressions. * * Expressions that contain literals not available in the VariantContext or Genotype will be treated as not matching * @param vc variant context * @param exps expressions * @return true if there is a match */ public static Map<JexlVCMatchExp, Boolean> match(VariantContext vc, Collection<JexlVCMatchExp> exps) { return new JEXLMap(exps,vc); }
/** * Matches each {@link JexlVCMatchExp} exp against the data contained in {@code vc}, {@code g}, * and returns a map from these expressions to {@code true} (if they matched) or {@code false} (if they didn't). * This the best way to apply JEXL expressions to {@link VariantContext} records. * Use the various {@code initializeMatchExps()}'s to create the list of {@link JexlVCMatchExp} expressions. * * @param vc variant context * @param g genotype * @param exps expressions * @param howToTreatMissingValues what to do if the jexl expression contains literals that aren't in the context * @return true if there is a match */ public static Map<JexlVCMatchExp, Boolean> match(VariantContext vc, Genotype g, Collection<JexlVCMatchExp> exps, JexlMissingValueTreatment howToTreatMissingValues) { return new JEXLMap(exps, vc, g, howToTreatMissingValues); }
/** * Matches each {@link JexlVCMatchExp} exp against the data contained in {@code vc}, {@code g}, * and returns a map from these expressions to {@code true} (if they matched) or {@code false} (if they didn't). * This the best way to apply JEXL expressions to {@link VariantContext} records. * Use the various {@code initializeMatchExps()}'s to create the list of {@link JexlVCMatchExp} expressions. * * @param vc variant context * @param g genotype * @param exps expressions * @param howToTreatMissingValues what to do if the jexl expression contains literals that aren't in the context * @return true if there is a match */ public static Map<JexlVCMatchExp, Boolean> match(VariantContext vc, Genotype g, Collection<JexlVCMatchExp> exps, JexlMissingValueTreatment howToTreatMissingValues) { return new JEXLMap(exps, vc, g, howToTreatMissingValues); }
/** * @return a JEXLMap for use by actual tests */ private JEXLMap getJEXLMap() { return new JEXLMap(Collections.singletonList(exp), vc); }
@Test(dataProvider = "getMissingValueTestData") public void testMissingBehavior(VariantContext vc, JexlMissingValueTreatment missingValueTreatment, boolean expected, Class<? extends Exception> expectedException){ final JEXLMap jexlMap = new JEXLMap(Collections.singletonList(missingValueExpression), vc, null, missingValueTreatment); if(expectedException == null) { Assert.assertEquals((boolean) jexlMap.get(missingValueExpression), expected); } else { Assert.assertThrows(expectedException, () -> jexlMap.get(missingValueExpression)); } }
jexlMap = new JEXLMap(jexlTests, vcPass, genoPass); Assert.assertTrue(jexlMap.get(AD2)); jexlMap = new JEXLMap(jexlTests, vcPass, genoFail); jexlMap = new JEXLMap(jexlTests, vcPass, genoNull); jexlMap = new JEXLMap(jexlTests, vcFail, genoPass); Assert.assertFalse(jexlMap.get(failFT)); jexlMap = new JEXLMap(jexlTests, vcFail, genoFail); Assert.assertTrue(jexlMap.get(failFT)); jexlMap = new JEXLMap(jexlTests, vcFail, genoNull);