Fix for out of date VCF version output

This commit is contained in:
meganshand 2015-11-03 17:35:47 -05:00
parent 3d1dc303b3
commit b5165b8d30
2 changed files with 6 additions and 3 deletions

View File

@ -619,9 +619,9 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
String idFile = privateTestDir + "complexExample1.vcf.id";
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(" -xlIDs " + idFile + " --variant " + testFile),
baseTestString(" -xlIDs " + idFile + " --variant " + testFile + " --forceValidOutput"),
1,
Arrays.asList("6c1e8591c134519bfc202b4ec7ef1f71")
Arrays.asList("45ad235b42bac75aa269e12bcd88a411")
);
spec.disableShadowBCF();
executeTest("testExcludeSelectionID--" + testFile, spec);

View File

@ -574,6 +574,9 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
@Argument(fullName="ALLOW_NONOVERLAPPING_COMMAND_LINE_SAMPLES", required=false, doc="Allow samples other than those in the VCF to be specified on the command line. These samples will be ignored.")
private boolean allowNonOverlappingCommandLineSamples = false;
@Argument(fullName="forceValidOutput", required=false, doc="Forces output VCF to be compliant to up to date version")
private boolean forceValidOutput = false;
public enum NumberAlleleRestriction {
ALL,
BIALLELIC,
@ -1008,7 +1011,7 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
*/
private VariantContext subsetRecord(final VariantContext vc, final boolean preserveAlleles, final boolean removeUnusedAlternates) {
//subContextFromSamples() always decodes the vc, which is a fairly expensive operation. Avoid if possible
if ( noSamplesSpecified && !removeUnusedAlternates )
if ( noSamplesSpecified && !removeUnusedAlternates && !forceValidOutput )
return vc;
// strip out the alternate alleles that aren't being used