Merge pull request #229 from broadinstitute/eb_liftover_variants_output_required

@Output needs to be required for LiftoverVariants to prevent a NPE and d...
This commit is contained in:
Eric Banks 2013-05-17 07:49:55 -07:00
commit 665e45f0fc
2 changed files with 16 additions and 2 deletions

View File

@ -47,6 +47,7 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
import org.broadinstitute.sting.WalkerTest;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.testng.annotations.Test;
import java.util.Arrays;
@ -91,4 +92,13 @@ public class LiftoverVariantsIntegrationTest extends WalkerTest {
Arrays.asList("0909a953291a5e701194668c9b8833ab"));
executeTest("test liftover filtering of indels", spec);
}
@Test
public void testLiftoverFailsWithNoOutput() {
WalkerTestSpec spec = new WalkerTestSpec(
"-T LiftoverVariants -R " + hg18Reference + " --variant:vcf " + privateTestDir + "liftover_test.vcf -chain " + validationDataLocation + "hg18ToHg19.broad.over.chain -dict /seq/references/Homo_sapiens_assembly19/v0/Homo_sapiens_assembly19.dict",
0,
UserException.class);
executeTest("test liftover fails with no output", spec);
}
}

View File

@ -54,7 +54,11 @@ import java.io.File;
import java.util.*;
/**
* Lifts a VCF file over from one build to another. Note that the resulting VCF could be mis-sorted.
* Lifts a VCF file over from one build to another.
*
* Important note: the resulting VCF is not guaranteed to be valid according to the official specification. The file could
* possibly be mis-sorted and the header may not be complete. LiftoverVariants is intended to be the first of two processing steps
* for the liftover; the second step, FilterLiftedVariants, will produce a valid well-behaved VCF file.
*/
@DocumentedGATKFeature( groupName = HelpConstants.DOCS_CAT_VARMANIP, extraDocs = {CommandLineGATK.class} )
public class LiftoverVariants extends RodWalker<Integer, Integer> {
@ -62,7 +66,7 @@ public class LiftoverVariants extends RodWalker<Integer, Integer> {
@ArgumentCollection
protected StandardVariantContextInputArgumentCollection variantCollection = new StandardVariantContextInputArgumentCollection();
@Output(doc="File to which variants should be written")
@Output(doc="File to which variants should be written", required=true, defaultToStdout=false)
protected File file = null;
protected VariantContextWriter writer = null;