Bugfix for hom ref records that aren't GVCF blocks.
This commit is contained in:
parent
f3a67edc24
commit
ef1d58b7ff
|
|
@ -374,7 +374,7 @@ public class UnifiedGenotyperEngine {
|
|||
final VariantContext vc,
|
||||
final GenotypeLikelihoodsCalculationModel.Model model,
|
||||
final Map<String, org.broadinstitute.sting.utils.genotyper.PerReadAlleleLikelihoodMap> perReadAlleleLikelihoodMap) {
|
||||
return calculateGenotypes(tracker, refContext, rawContext, stratifiedContexts, vc, model, false,perReadAlleleLikelihoodMap);
|
||||
return calculateGenotypes(tracker, refContext, rawContext, stratifiedContexts, vc, model, false, perReadAlleleLikelihoodMap);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@
|
|||
|
||||
package org.broadinstitute.sting.utils.gvcf;
|
||||
|
||||
import org.broadinstitute.sting.gatk.walkers.haplotypecaller.ReferenceConfidenceModel;
|
||||
import org.broadinstitute.sting.utils.variant.GATKVCFUtils;
|
||||
import org.broadinstitute.sting.utils.variant.GATKVariantContextUtils;
|
||||
import org.broadinstitute.variant.variantcontext.Genotype;
|
||||
import org.broadinstitute.variant.variantcontext.GenotypeBuilder;
|
||||
import org.broadinstitute.variant.variantcontext.VariantContext;
|
||||
|
|
@ -284,7 +287,7 @@ public class GVCFWriter implements VariantContextWriter {
|
|||
}
|
||||
|
||||
final Genotype g = vc.getGenotype(0);
|
||||
if ( g.isHomRef() ) {
|
||||
if ( g.isHomRef() && vc.hasAlternateAllele(GATKVariantContextUtils.NON_REF_SYMBOLIC_ALLELE) ) {
|
||||
// create bands
|
||||
final VariantContext maybeCompletedBand = addHomRefSite(vc, g);
|
||||
if ( maybeCompletedBand != null ) underlyingWriter.add(maybeCompletedBand);
|
||||
|
|
|
|||
|
|
@ -129,6 +129,16 @@ public class GVCFWriterUnitTest extends BaseTest {
|
|||
return vcb.genotypes(gb.make()).make();
|
||||
}
|
||||
|
||||
private VariantContext makeHomRefAlt(final String contig, final int start, final int GQ) {
|
||||
final VariantContextBuilder vcb = new VariantContextBuilder("test", contig, start, start, Arrays.asList(REF, ALT));
|
||||
final GenotypeBuilder gb = new GenotypeBuilder(SAMPLE_NAME, Arrays.asList(REF, REF));
|
||||
gb.GQ(GQ);
|
||||
gb.DP(10);
|
||||
gb.AD(new int[]{1, 2});
|
||||
gb.PL(new int[]{0, 10, 100});
|
||||
return vcb.genotypes(gb.make()).make();
|
||||
}
|
||||
|
||||
private VariantContext makeNonRef(final String contig, final int start, final int GQ) {
|
||||
final VariantContextBuilder vcb = new VariantContextBuilder("test", contig, start, start, Arrays.asList(REF, ALT));
|
||||
final GenotypeBuilder gb = new GenotypeBuilder(SAMPLE_NAME, Arrays.asList(REF, ALT));
|
||||
|
|
@ -305,6 +315,25 @@ public class GVCFWriterUnitTest extends BaseTest {
|
|||
assertGoodVC(mockWriter.emitted.get(2), "20", 6, 7, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHomRefAlt() {
|
||||
final GVCFWriter writer = new GVCFWriter(mockWriter, standardPartition);
|
||||
|
||||
writer.add(makeHomRef("20", 1, 0));
|
||||
writer.add(makeHomRef("20", 2, 0));
|
||||
writer.add(makeHomRefAlt("20", 3, 0));
|
||||
writer.add(makeHomRef("20", 4, 0));
|
||||
writer.add(makeHomRef("20", 5, 0));
|
||||
writer.add(makeHomRef("20", 6, 0));
|
||||
writer.add(makeHomRef("20", 7, 0));
|
||||
writer.close();
|
||||
Assert.assertEquals(mockWriter.emitted.size(), 3);
|
||||
assertGoodVC(mockWriter.emitted.get(0), "20", 1, 2, false);
|
||||
Assert.assertFalse(mockWriter.emitted.get(1).hasAttribute("END"));
|
||||
Assert.assertFalse(mockWriter.emitted.get(1).hasAttribute("BLOCK_SIZE"));
|
||||
assertGoodVC(mockWriter.emitted.get(2), "20", 4, 7, false);
|
||||
}
|
||||
|
||||
@DataProvider(name = "BandPartitionData")
|
||||
public Object[][] makeBandPartitionData() {
|
||||
List<Object[]> tests = new ArrayList<>();
|
||||
|
|
|
|||
Loading…
Reference in New Issue