Merge pull request #787 from broadinstitute/vrr_wrong_reference_base_bugfix

Fixing CombineGVCFs that writes out the wrong REF allele
This commit is contained in:
rpoplin 2014-12-16 10:35:47 -05:00
commit 3d32babc29
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);
}