From 78a43faebed253439e40708b799968c4dac11e20 Mon Sep 17 00:00:00 2001 From: ebanks Date: Fri, 21 Jan 2011 05:24:28 +0000 Subject: [PATCH] Adding options to warn instead of erroring out (so that you can see all errors in one shot) and to skip filtered records git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5042 348d0f76-0448-11de-a6fe-93d51630548a --- .../variantutils/ValidateVariants.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariants.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariants.java index 64840c597..54a869aaf 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariants.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariants.java @@ -60,6 +60,14 @@ public class ValidateVariants extends RodWalker { @Argument(fullName = "validationType", shortName = "type", doc = "which validation type to run", required = false) protected ValidationType type = ValidationType.ALL; + @Argument(fullName = "doNotValidateFilteredRecords", shortName = "doNotValidateFilteredRecords", doc = "should we skip validation on filtered records?", required = false) + protected Boolean DO_NOT_VALIDATE_FILTERED = false; + + @Argument(fullName = "warnOnErrors", shortName = "warnOnErrors", doc = "should we just emit warnings on errors instead of terminating the run?", required = false) + protected Boolean WARN_ON_ERROR = false; + + private long numErrors = 0; + private File file = null; public void initialize() { @@ -87,10 +95,16 @@ public class ValidateVariants extends RodWalker { public Integer reduce(Integer value, Integer sum) { return sum+value; } public void onTraversalDone(Integer result) { - System.out.println("Successfully validated the input file. Checked " + result + " records with no failures."); + if ( numErrors == 0 ) + System.out.println("Successfully validated the input file. Checked " + result + " records with no failures."); + else + System.out.println("Found " + numErrors + " records with failures."); } private void validate(VariantContext vc, RefMetaDataTracker tracker, ReferenceContext ref) { + if ( DO_NOT_VALIDATE_FILTERED && vc.isFiltered() ) + return; + // get the true reference allele Allele reportedRefAllele = vc.getReference(); Allele observedRefAllele; @@ -149,7 +163,12 @@ public class ValidateVariants extends RodWalker { break; } } catch (TribbleException e) { - throw new UserException.MalformedFile(file, e.getMessage()); + if ( WARN_ON_ERROR ) { + numErrors++; + logger.warn("***** " + e.getMessage() + " *****"); + } else { + throw new UserException.MalformedFile(file, e.getMessage()); + } } } } \ No newline at end of file