Added a -summary jexl argument to VariantEval similar to -validate.

Updated the package of ValidationGenotyper to match the file location.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4710 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
kshakir 2010-11-19 04:42:46 +00:00
parent 8dca5bd861
commit c723db1f4b
2 changed files with 15 additions and 6 deletions

View File

@ -126,6 +126,10 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
@Argument(shortName="selectName", doc="Names to use for the list of stratifications (must be a 1-to-1 mapping)", required=false)
protected ArrayList<String> SELECT_NAMES = new ArrayList<String>();
@Hidden
@Argument(shortName="summary", doc="One or more JEXL staments to log after evaluating the data", required=false)
protected ArrayList<String> SUMMARY_EXPS = new ArrayList<String>();
@Hidden
@Argument(shortName="validate", doc="One or more JEXL validations to use after evaluating the data", required=false)
protected ArrayList<String> VALIDATE_EXPS = new ArrayList<String>();
@ -483,12 +487,12 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
private Set<VariantEvaluator> instantiateEvalationsSet() {
Set<VariantEvaluator> evals = new HashSet<VariantEvaluator>();
Object[] args = new Object[]{this};
Class[] argTypes = new Class[]{this.getClass()};
Class<?>[] argTypes = new Class<?>[]{VariantEvalWalker.class};
for ( Class c : evaluationClasses ) {
for ( Class<? extends VariantEvaluator> c : evaluationClasses ) {
try {
Constructor constructor = c.getConstructor(argTypes);
VariantEvaluator eval = (VariantEvaluator)constructor.newInstance(args);
Constructor<? extends VariantEvaluator> constructor = c.getConstructor(argTypes);
VariantEvaluator eval = constructor.newInstance(args);
evals.add(eval);
} catch (Exception e) {
throw new DynamicClassResolutionException(c, e);
@ -804,7 +808,7 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
* Validates the JEXL expressions and throws an exception if they do not all return true.
*/
private void validateContext() {
if (VALIDATE_EXPS.size() == 0)
if (SUMMARY_EXPS.size() + VALIDATE_EXPS.size() == 0)
return;
JexlContext jc = new MapContext();
@ -833,6 +837,11 @@ public class VariantEvalWalker extends RodWalker<Integer, Integer> implements Tr
JexlEngine jexl = new JexlEngine(uberspect, null, null, null);
for (String expression: SUMMARY_EXPS) {
Object jexlResult = jexl.createExpression(expression).evaluate(jc);
logger.info("Summary: " + expression + " = " + jexlResult);
}
List<String> failedExpressions = new ArrayList<String>();
for (String expression: VALIDATE_EXPS) {
// ex: evalYRI.compYRI.all.called.novel.titv.tiTvRatio > 1.0

View File

@ -23,7 +23,7 @@
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package org.broadinstitute.sting.playground.gatk.walkers.validationgenotyper;
package org.broadinstitute.sting.playground.gatk.walkers;
import org.broad.tribble.util.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Output;