diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCallVariants.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCallVariants.java index d91f8d2e4..500b11360 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCallVariants.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCallVariants.java @@ -25,7 +25,9 @@ package org.broadinstitute.sting.gatk.walkers.genotyper; import org.broadinstitute.sting.commandline.ArgumentCollection; +import org.broadinstitute.sting.commandline.Input; import org.broadinstitute.sting.commandline.Output; +import org.broadinstitute.sting.commandline.RodBinding; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource; @@ -51,6 +53,9 @@ public class UGCallVariants extends RodWalker { @ArgumentCollection private UnifiedArgumentCollection UAC = new UnifiedArgumentCollection(); + @Input(fullName="variant", shortName = "V", doc="Input VCF file", required=true) + public List> variants; + // control the output @Output(doc="File to which variants should be written",required=true) protected VCFWriter writer = null; @@ -63,13 +68,8 @@ public class UGCallVariants extends RodWalker { public void initialize() { - for ( ReferenceOrderedDataSource d : getToolkit().getRodDataSources() ) { - if ( d.getName().startsWith("variant") ) - trackNames.add(d.getName()); - } - if ( trackNames.size() == 0 ) - throw new UserException("At least one track bound to a name beginning with 'variant' must be provided."); - + for ( RodBinding rb : variants ) + trackNames.add(rb.getName()); Set samples = SampleUtils.getSampleListWithVCFHeader(getToolkit(), trackNames); UG_engine = new UnifiedGenotyperEngine(getToolkit(), UAC, logger, null, null, samples); @@ -93,11 +93,7 @@ public class UGCallVariants extends RodWalker { if ( tracker == null ) return null; - List VCs = new ArrayList(); - for ( String name : trackNames ) { - VariantContext vc = tracker.getFirstValue(VariantContext.class, name, context.getLocation()); - VCs.add(vc); - } + List VCs = tracker.getValues(variants, context.getLocation()); VariantContext mergedVC = mergeVCsWithGLs(VCs); if ( mergedVC == null ) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/qc/RodSystemValidationWalker.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/qc/RodSystemValidationWalker.java index edfaea768..1c24f3879 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/qc/RodSystemValidationWalker.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/qc/RodSystemValidationWalker.java @@ -25,7 +25,9 @@ package org.broadinstitute.sting.gatk.walkers.qc; import org.broadinstitute.sting.commandline.Argument; +import org.broadinstitute.sting.commandline.Input; import org.broadinstitute.sting.commandline.Output; +import org.broadinstitute.sting.commandline.RodBinding; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource; @@ -54,6 +56,9 @@ public class RodSystemValidationWalker extends RodWalker { // the divider to use in some of the text output private static final String DIVIDER = ","; + @Input(fullName="eval", shortName = "eval", doc="Input VCF eval file", required=true) + public List> eval; + @Output public PrintStream out; @@ -108,7 +113,7 @@ public class RodSystemValidationWalker extends RodWalker { // if the argument was set, check for equivalence if (allRecordsVariantContextEquivalent && tracker != null) { - Collection col = tracker.getValues(VariantContext.class); + Collection col = tracker.getValues(eval); VariantContext con = null; for (VariantContext contextInList : col) if (con == null) con = contextInList; diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariants.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariants.java index c3e7dbe0c..5c7fb268c 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariants.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariants.java @@ -29,6 +29,7 @@ import org.broad.tribble.Feature; import org.broad.tribble.TribbleException; import org.broad.tribble.dbsnp.DbSNPFeature; import org.broadinstitute.sting.commandline.*; +import org.broadinstitute.sting.gatk.arguments.DbsnpArgumentCollection; import org.broadinstitute.sting.gatk.arguments.StandardVariantContextInputArgumentCollection; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; @@ -55,6 +56,9 @@ public class ValidateVariants extends RodWalker { @ArgumentCollection protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection(); + @ArgumentCollection + protected DbsnpArgumentCollection dbsnp = new DbsnpArgumentCollection(); + public enum ValidationType { ALL, REF, IDS, ALLELES, CHR_COUNTS } @@ -137,8 +141,8 @@ public class ValidateVariants extends RodWalker { // get the RS IDs Set rsIDs = null; - if ( tracker.hasValues(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME) ) { - List dbsnpList = tracker.getValues(Feature.class, DbSNPHelper.STANDARD_DBSNP_TRACK_NAME); + if ( tracker.hasValues(dbsnp.dbsnp) ) { + List dbsnpList = tracker.getValues(dbsnp.dbsnp, ref.getLocus()); rsIDs = new HashSet(); for ( Object d : dbsnpList ) { if (d instanceof DbSNPFeature ) diff --git a/public/java/test/org/broadinstitute/sting/gatk/walkers/variantutils/SelectVariantsIntegrationTest.java b/public/java/test/org/broadinstitute/sting/gatk/walkers/variantutils/SelectVariantsIntegrationTest.java index b2ac3f4a6..bec0d5dd4 100755 --- a/public/java/test/org/broadinstitute/sting/gatk/walkers/variantutils/SelectVariantsIntegrationTest.java +++ b/public/java/test/org/broadinstitute/sting/gatk/walkers/variantutils/SelectVariantsIntegrationTest.java @@ -55,7 +55,7 @@ public class SelectVariantsIntegrationTest extends WalkerTest { String testFile = validationDataLocation + "NA12878.hg19.example1.vcf"; WalkerTestSpec spec = new WalkerTestSpec( - "-T SelectVariants -R " + hg19Reference + " -sn NA12878 -L 20:1012700-1020000 -conc:VCF " + b37hapmapGenotypes + " --variant:VCF " + testFile + " -o %s -NO_HEADER", + "-T SelectVariants -R " + hg19Reference + " -sn NA12878 -L 20:1012700-1020000 -conc:VCF " + b37hapmapGenotypes + " --variant " + testFile + " -o %s -NO_HEADER", 1, Arrays.asList("d2ba3ea30a810f6f0fbfb1b643292b6a") ); @@ -68,7 +68,7 @@ public class SelectVariantsIntegrationTest extends WalkerTest { String testFile = validationDataLocation + "combine.3.vcf"; WalkerTestSpec spec = new WalkerTestSpec( - "-T SelectVariants -R " + b36KGReference + " -sn NA12892 -B:variant,VCF " + testFile + " -o %s -NO_HEADER", + "-T SelectVariants -R " + b36KGReference + " -sn NA12892 --variant " + testFile + " -o %s -NO_HEADER", 1, Arrays.asList("") ); diff --git a/public/java/test/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariantsIntegrationTest.java b/public/java/test/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariantsIntegrationTest.java index 4d5f0359d..adf3b21a8 100755 --- a/public/java/test/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariantsIntegrationTest.java +++ b/public/java/test/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariantsIntegrationTest.java @@ -95,7 +95,7 @@ public class ValidateVariantsIntegrationTest extends WalkerTest { @Test public void testBadID() { WalkerTestSpec spec = new WalkerTestSpec( - baseTestString("validationExampleBad.vcf", "IDS") + " -B:dbsnp,vcf " + b36dbSNP129, + baseTestString("validationExampleBad.vcf", "IDS") + " --dbsnp " + b36dbSNP129, 0, UserException.MalformedFile.class ); diff --git a/public/java/test/org/broadinstitute/sting/utils/variantcontext/VariantContextIntegrationTest.java b/public/java/test/org/broadinstitute/sting/utils/variantcontext/VariantContextIntegrationTest.java index 7cdb6af95..67fe7d012 100755 --- a/public/java/test/org/broadinstitute/sting/utils/variantcontext/VariantContextIntegrationTest.java +++ b/public/java/test/org/broadinstitute/sting/utils/variantcontext/VariantContextIntegrationTest.java @@ -15,8 +15,7 @@ public class VariantContextIntegrationTest extends WalkerTest { " -R " + b36KGReference; private static String root = cmdRoot + - " -L 1:1-1,000,000 -B:dbsnp,vcf " + b36dbSNP129 + - " -B:vcf,VCF3 " + validationDataLocation + "yri.trio.gatk_glftrio.intersection.annotated.filtered.chr1.vcf"; + " -L 1:1-1,000,000 -V " + b36dbSNP129; private static final class VCITTest extends TestDataProvider { String args, md5; @@ -30,15 +29,15 @@ public class VariantContextIntegrationTest extends WalkerTest { @DataProvider(name = "VCITTestData") public Object[][] createVCITTestData() { - new VCITTest("--printPerLocus", ""); - new VCITTest("--printPerLocus --onlyContextsOfType SNP", ""); - new VCITTest("--printPerLocus --onlyContextsOfType INDEL", ""); - new VCITTest("--printPerLocus --onlyContextsOfType MIXED", ""); - new VCITTest("--printPerLocus --onlyContextsOfType NO_VARIATION", ""); - new VCITTest("--printPerLocus --takeFirstOnly", ""); - new VCITTest("--printPerLocus --onlyContextsOfType INDEL --onlyContextsStartinAtCurrentPosition", ""); - new VCITTest("--printPerLocus --onlyContextsStartinAtCurrentPosition", ""); - new VCITTest("--printPerLocus --takeFirstOnly --onlyContextsStartinAtCurrentPosition", ""); + new VCITTest("--printPerLocus", "e9d0f1fe80659bb55b40aa6c3a2e921e"); + new VCITTest("--printPerLocus --onlyContextsOfType SNP", "0e620db3e45771df42c54a9c0ae4a29f"); + new VCITTest("--printPerLocus --onlyContextsOfType INDEL", "b725c204fefe3814644d50e7c20f9dfe"); + new VCITTest("--printPerLocus --onlyContextsOfType MIXED", "3ccc33f496a1718df55722d11cc14334"); + new VCITTest("--printPerLocus --onlyContextsOfType NO_VARIATION", "39335acdb34c8a2af433dc50d619bcbc"); + new VCITTest("--printPerLocus --takeFirstOnly", "3a45561da042b2b44b6a679744f16103"); + new VCITTest("--printPerLocus --onlyContextsOfType INDEL --onlyContextsStartinAtCurrentPosition", "4746f269ecc377103f83eb61cc162c39"); + new VCITTest("--printPerLocus --onlyContextsStartinAtCurrentPosition", "2749e3fae458650a85a2317e346dc44c"); + new VCITTest("--printPerLocus --takeFirstOnly --onlyContextsStartinAtCurrentPosition", "9bd48c2a40813023e29ffaa23d59d382"); return VCITTest.getTests(VCITTest.class); } @@ -58,7 +57,7 @@ public class VariantContextIntegrationTest extends WalkerTest { public void testToVCF() { // this really just tests that we are seeing the same number of objects over all of chr1 - WalkerTestSpec spec = new WalkerTestSpec( cmdRoot + " -NO_HEADER -B:vcf,VCF3 " + validationDataLocation + "yri.trio.gatk_glftrio.intersection.annotated.filtered.chr1.500.vcf -L 1:1-1000000 -o %s --outputVCF %s", + WalkerTestSpec spec = new WalkerTestSpec( cmdRoot + " -NO_HEADER -V:VCF3 " + validationDataLocation + "yri.trio.gatk_glftrio.intersection.annotated.filtered.chr1.500.vcf -L 1:1-1000000 -o %s --outputVCF %s", 2, // just one output file Arrays.asList("e3c35d0c4b5d4935c84a270f9df0951f", "ff91731213fd0bbdc200ab6fd1c93e63")); executeTest("testToVCF", spec);