Don't allow users to specify keys and IDs that contain angle brackets or equals signs (not allowed in VCF spec).
* As reported here: http://gatkforums.broadinstitute.org/discussion/comment/4270#Comment_4270 * This was a commit into the variant.jar; the changes here are a rev of that jar and handling of errors in VF * Added integration test to confirm failure with User Error * Removed illegal header line in KB test VCF that was causing related tests to fail.
This commit is contained in:
parent
14bbba0980
commit
7897d52f32
|
|
@ -47,6 +47,7 @@
|
|||
package org.broadinstitute.sting.gatk.walkers.filters;
|
||||
|
||||
import org.broadinstitute.sting.WalkerTest;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -106,6 +107,13 @@ public class VariantFiltrationIntegrationTest extends WalkerTest {
|
|||
executeTest("test filter sites not in mask", spec3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIllegalFilterName() {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
baseTestString() + " -filter 'DoC < 20 || FisherStrand > 20.0' -filterName 'foo < foo' --variant " + privateTestDir + "vcfexample2.vcf -L 1:10,020,000-10,021,000", 1,
|
||||
UserException.class);
|
||||
executeTest("test illegal filter name", spec);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFilter1() {
|
||||
|
|
|
|||
|
|
@ -186,18 +186,22 @@ public class VariantFiltration extends RodWalker<Integer, Integer> {
|
|||
if ( clusterWindow > 0 )
|
||||
hInfo.add(new VCFFilterHeaderLine(CLUSTERED_SNP_FILTER_NAME, "SNPs found in clusters"));
|
||||
|
||||
for ( VariantContextUtils.JexlVCMatchExp exp : filterExps )
|
||||
hInfo.add(new VCFFilterHeaderLine(exp.name, exp.exp.toString()));
|
||||
for ( VariantContextUtils.JexlVCMatchExp exp : genotypeFilterExps )
|
||||
hInfo.add(new VCFFilterHeaderLine(exp.name, exp.exp.toString()));
|
||||
|
||||
if ( genotypeFilterExps.size() > 0 )
|
||||
hInfo.add(VCFStandardHeaderLines.getFormatLine(VCFConstants.GENOTYPE_FILTER_KEY));
|
||||
|
||||
if ( mask.isBound() ) {
|
||||
if (filterRecordsNotInMask)
|
||||
hInfo.add(new VCFFilterHeaderLine(MASK_NAME, "Doesn't overlap a user-input mask"));
|
||||
else hInfo.add(new VCFFilterHeaderLine(MASK_NAME, "Overlaps a user-input mask"));
|
||||
try {
|
||||
for ( VariantContextUtils.JexlVCMatchExp exp : filterExps )
|
||||
hInfo.add(new VCFFilterHeaderLine(exp.name, exp.exp.toString()));
|
||||
for ( VariantContextUtils.JexlVCMatchExp exp : genotypeFilterExps )
|
||||
hInfo.add(new VCFFilterHeaderLine(exp.name, exp.exp.toString()));
|
||||
|
||||
if ( mask.isBound() ) {
|
||||
if (filterRecordsNotInMask)
|
||||
hInfo.add(new VCFFilterHeaderLine(MASK_NAME, "Doesn't overlap a user-input mask"));
|
||||
else hInfo.add(new VCFFilterHeaderLine(MASK_NAME, "Overlaps a user-input mask"));
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new UserException.BadInput(e.getMessage());
|
||||
}
|
||||
|
||||
writer.writeHeader(new VCFHeader(hInfo, SampleUtils.getUniqueSamplesFromRods(getToolkit(), inputNames)));
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,3 +1,3 @@
|
|||
<ivy-module version="1.0">
|
||||
<info organisation="org.broadinstitute" module="variant" revision="1.85.1357" status="integration" />
|
||||
<info organisation="org.broadinstitute" module="variant" revision="1.88.1401" status="integration" />
|
||||
</ivy-module>
|
||||
Loading…
Reference in New Issue