Final tweaks. Added an integration test to cover the case of SNPs and indels that start at the same position.

This commit is contained in:
Eric Banks 2012-04-17 23:54:10 -04:00
parent c1f52b773a
commit 4448a3ea76
2 changed files with 25 additions and 3 deletions

View File

@ -195,16 +195,22 @@ public class ApplyRecalibration extends RodWalker<Integer, Integer> {
throw new UserException("Encountered input variant which isn't found in the input recal file. Please make sure VariantRecalibrator and ApplyRecalibration were run on the same set of input variants. First seen at: " + vc );
}
final double lod = recalDatum.getAttributeAsDouble(VariantRecalibrator.VQS_LOD_KEY, Double.NEGATIVE_INFINITY);
if( lod == Double.NEGATIVE_INFINITY ) {
final String lodString = recalDatum.getAttributeAsString(VariantRecalibrator.VQS_LOD_KEY, null);
if( lodString == null ) {
throw new UserException("Encountered a malformed record in the input recal file. There is no lod for the record at: " + vc );
}
final double lod;
try {
lod = Double.valueOf(lodString);
} catch (NumberFormatException e) {
throw new UserException("Encountered a malformed record in the input recal file. The lod is unreadable for the record at: " + vc );
}
VariantContextBuilder builder = new VariantContextBuilder(vc);
String filterString = null;
// Annotate the new record with its VQSLOD and the worst performing annotation
builder.attribute(VariantRecalibrator.VQS_LOD_KEY, lod);
builder.attribute(VariantRecalibrator.VQS_LOD_KEY, lodString); // use the String representation so that we don't lose precision on output
builder.attribute(VariantRecalibrator.CULPRIT_KEY, recalDatum.getAttribute(VariantRecalibrator.CULPRIT_KEY));
for( int i = tranches.size() - 1; i >= 0; i-- ) {

View File

@ -118,5 +118,21 @@ public class VariantRecalibrationWalkersIntegrationTest extends WalkerTest {
Arrays.asList(params.cutVCFMD5));
executeTest("testApplyRecalibrationIndel-"+params.inVCF, spec);
}
@Test
public void testApplyRecalibrationSnpAndIndelTogether() {
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
"-R " + b37KGReference +
" -T ApplyRecalibration" +
" -L 20:1000100-1000500" +
" -mode BOTH" +
" -NO_HEADER" +
" -input " + validationDataLocation + "VQSR.mixedTest.input" +
" -o %s" +
" -tranchesFile " + validationDataLocation + "VQSR.mixedTest.tranches" +
" -recalFile " + validationDataLocation + "VQSR.mixedTest.recal",
Arrays.asList("08060b7f5c9cf3bb1692b50c58fd5a4b"));
executeTest("testApplyRecalibrationSnpAndIndelTogether", spec);
}
}