Fixing CombineGVCFs that writes out the wrong REF allele

Story:
=====

  - https://www.pivotaltracker.com/story/show/83259038

Changes:
=======

  - Done minimal changes to make the fix after an arduous attempt to understand
    CombineGVCFs code.

Test:
====

  - Added a integration test to explicitly test for the bug.

  - Updated a md5 changes as the bug was actually affecting one of the existing
    integration tests.
This commit is contained in:
Valentin Ruano-Rubio 2014-12-12 00:01:33 -05:00
parent b561febbfd
commit 736a857e82
2 changed files with 14 additions and 7 deletions

View File

@ -256,11 +256,8 @@ public class CombineGVCFs extends RodWalker<CombineGVCFs.PositionalState, Combin
*/
private void endPreviousStates(final OverallState state, final int pos, final PositionalState startingStates, boolean atCurrentPosition) {
final byte refBase;
if (atCurrentPosition)
refBase = startingStates.refBases.length > 1 ? startingStates.refBases[1] : (byte)'N';
else
refBase = startingStates.refBases[0];
final byte refBase = startingStates.refBases[0];
final byte refNextBase = (atCurrentPosition) ? (startingStates.refBases.length > 1 ? startingStates.refBases[1] : (byte)'N' ): refBase;
final List<VariantContext> stoppedVCs = new ArrayList<>(state.VCs.size());
@ -300,7 +297,7 @@ public class CombineGVCFs extends RodWalker<CombineGVCFs.PositionalState, Combin
vcfWriter.add(mergedVC);
state.prevPos = gLoc;
state.refAfterPrevPos = refBase;
state.refAfterPrevPos = refNextBase;
}
}

View File

@ -203,10 +203,20 @@ public class CombineGVCFsIntegrationTest extends WalkerTest {
executeTest("testBasepairResolutionOutput", spec);
}
@Test
public void testWrongReferenceBaseBugFix() throws Exception {
final String cmd = "-T CombineGVCFs -R " + b37KGReference + " -V " + (privateTestDir + "combine-gvcf-wrong-ref-input1.vcf"
+ " -V " + (privateTestDir + "combine-gvcf-wrong-ref-input2.vcf") + " -o %s --no_cmdline_in_header");
final WalkerTestSpec spec = new WalkerTestSpec(cmd, 1, Arrays.asList("04fa9d6084e4b3a7ea2ebe5675561e2f"));
spec.disableShadowBCF();
executeTest("testWrongReferenceBaseBugFix",spec);
}
@Test
public void testBasepairResolutionInput() throws Exception {
final String cmd = "-T CombineGVCFs -R " + b37KGReference + " -o %s --no_cmdline_in_header -V " + privateTestDir + "gvcf.basepairResolution.vcf";
final WalkerTestSpec spec = new WalkerTestSpec(cmd, 1, Arrays.asList("eb56760419b295651b6d54ba3ad18f52"));
final WalkerTestSpec spec = new WalkerTestSpec(cmd, 1, Arrays.asList("d3b3f0c8d8f8ef09475306a7814ddd38"));
spec.disableShadowBCF();
executeTest("testBasepairResolutionInput", spec);
}