Merge branch 'master' of ssh://gsa2.broadinstitute.org/humgen/gsa-scr1/gsa-engineering/git/unstable

This commit is contained in:
Eric Banks 2012-07-14 23:49:59 -04:00
commit 2a830939df
5 changed files with 41 additions and 7 deletions

View File

@ -172,7 +172,7 @@ public class ApplyRecalibration extends RodWalker<Integer, Integer> implements T
vcfWriter.writeHeader(vcfHeader);
}
public static final void addVQSRStandardHeaderLines(final Set<VCFHeaderLine> hInfo) {
public static void addVQSRStandardHeaderLines(final Set<VCFHeaderLine> hInfo) {
hInfo.add(VCFStandardHeaderLines.getInfoLine(VCFConstants.END_KEY));
hInfo.add(new VCFInfoHeaderLine(VariantRecalibrator.VQS_LOD_KEY, 1, VCFHeaderLineType.Float, "Log odds ratio of being a true variant versus being false under the trained gaussian mixture model"));
hInfo.add(new VCFInfoHeaderLine(VariantRecalibrator.CULPRIT_KEY, 1, VCFHeaderLineType.String, "The annotation which was the worst performing in the Gaussian mixture model, likely the reason why the variant was filtered out"));
@ -236,7 +236,9 @@ public class ApplyRecalibration extends RodWalker<Integer, Integer> implements T
filterString = tranches.get(0).name+"+";
}
if( !filterString.equals(VCFConstants.PASSES_FILTERS_v4) ) {
if( filterString.equals(VCFConstants.PASSES_FILTERS_v4) ) {
builder.passFilters();
} else {
builder.filters(filterString);
}

View File

@ -44,6 +44,8 @@ public class Haplotype {
private boolean isRef = false;
private Cigar cigar;
private int alignmentStartHapwrtRef;
public int leftBreakPoint = 0;
public int rightBreakPoint = 0;
/**
* Create a simple consensus sequence with provided bases and a uniform quality over all bases of qual

View File

@ -268,7 +268,12 @@ class JEXLMap implements Map<VariantContextUtils.JexlVCMatchExp, Boolean> {
// treat errors as no match
jexl.put(exp, value == null ? false : value);
} catch (Exception e) {
throw new UserException.CommandLineException(String.format("Invalid JEXL expression detected for %s with message %s", exp.name, e.getMessage()));
// if exception happens because variable is undefined (i.e. field in expression is not present), evaluate to FALSE
// todo - might be safer if we explicitly checked for an exception type, but Apache's API doesn't seem to have that ability
if (e.getMessage().contains("undefined variable"))
jexl.put(exp,false);
else
throw new UserException.CommandLineException(String.format("Invalid JEXL expression detected for %s with message %s", exp.name, e.getMessage()));
}
}

View File

@ -18,6 +18,11 @@ public class VariantRecalibrationWalkersIntegrationTest extends WalkerTest {
this.recalMD5 = recalMD5;
this.cutVCFMD5 = cutVCFMD5;
}
@Override
public String toString() {
return "VRTest{inVCF='" + inVCF +"'}";
}
}
VRTest lowPass = new VRTest("phase1.projectConsensus.chr20.raw.snps.vcf",
@ -69,14 +74,21 @@ public class VariantRecalibrationWalkersIntegrationTest extends WalkerTest {
executeTest("testApplyRecalibration-"+params.inVCF, spec);
}
VRTest indel = new VRTest("combined.phase1.chr20.raw.indels.sites.vcf",
VRTest indelUnfiltered = new VRTest(
"combined.phase1.chr20.raw.indels.unfiltered.sites.vcf", // all FILTERs as .
"b7589cd098dc153ec64c02dcff2838e4", // tranches
"a04a9001f62eff43d363f4d63769f3ee", // recal file
"888eb042dd33b807bcbb8630896fda94"); // cut VCF
"64f576881e21323dd4078262604717a2"); // cut VCF
VRTest indelFiltered = new VRTest(
"combined.phase1.chr20.raw.indels.filtered.sites.vcf", // all FILTERs as PASS
"b7589cd098dc153ec64c02dcff2838e4", // tranches
"a04a9001f62eff43d363f4d63769f3ee", // recal file
"af22c55d91394c56a222fd40d6d54781"); // cut VCF
@DataProvider(name = "VRIndelTest")
public Object[][] createData2() {
return new Object[][]{ {indel} };
public Object[][] createTestVariantRecalibratorIndel() {
return new Object[][]{ {indelUnfiltered}, {indelFiltered} };
}
@Test(dataProvider = "VRIndelTest")

View File

@ -70,6 +70,19 @@ public class SelectVariantsIntegrationTest extends WalkerTest {
executeTest("testComplexSelection--" + testfile, spec);
}
@Test
public void testNonExistingFieldSelection() {
String testfile = validationDataLocation + "test.filtered.maf_annotated.vcf";
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(" -env -ef -select 'foo!=0||DP>0' --variant " + testfile),
1,
Arrays.asList("44e77cea624cfff2b8acc3a4b30485cb") // should yield empty vcf because the foo!=0 will yield complete expression false
);
spec.disableShadowBCF();
executeTest("testNonExistingSelection--" + testfile, spec);
}
@Test
public void testSampleExclusion() {
String testfile = validationDataLocation + "test.filtered.maf_annotated.vcf";