Merge pull request #753 from broadinstitute/ldg_HCzeroDepth

Fix GenotypeGVCF bugs in -allSites mode
This commit is contained in:
rpoplin 2014-10-21 12:00:04 -04:00
commit bcf6be0b08
2 changed files with 15 additions and 10 deletions

View File

@ -219,11 +219,14 @@ public class GenotypeGVCFs extends RodWalker<VariantContext, VariantContextWrite
// only re-genotype polymorphic sites
if ( result.isVariant() ) {
VariantContext regenotypedVC = genotypingEngine.calculateGenotypes(result);
if ( regenotypedVC == null )
return null;
regenotypedVC = GATKVariantContextUtils.reverseTrimAlleles(regenotypedVC);
result = addGenotypingAnnotations(originalVC.getAttributes(), regenotypedVC);
if ( regenotypedVC == null) {
if (!INCLUDE_NON_VARIANTS)
return null;
}
else {
regenotypedVC = GATKVariantContextUtils.reverseTrimAlleles(regenotypedVC);
result = addGenotypingAnnotations(originalVC.getAttributes(), regenotypedVC);
}
}
// if it turned monomorphic then we either need to ignore or fix such sites
@ -313,10 +316,12 @@ public class GenotypeGVCFs extends RodWalker<VariantContext, VariantContextWrite
if ( createRefGTs ) {
final int ploidy = oldGT.getPloidy();
final List<Allele> refAlleles = new ArrayList<>(ploidy);
for ( int i = 0; i < ploidy; i++ )
refAlleles.add(VC.getReference());
builder.alleles(refAlleles);
final List<Allele> refAlleles = Collections.nCopies(ploidy,VC.getReference());
//keep 0 depth samples as no-call
if (depth > 0) {
builder.alleles(refAlleles);
}
// also, the PLs are technically no longer usable
builder.noPL();

View File

@ -119,7 +119,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest {
" -V:sample3 " + privateTestDir + "combine.single.sample.pipeline.3.vcf" +
" --includeNonVariantSites -L 20:10,030,000-10,033,000 -L 20:10,386,000-10,386,500", b37KGReference),
1,
Arrays.asList("4193e7c4e6fc889b4aa5a326899b1a4e"));
Arrays.asList("fdd06679c8a14ef2010d075cbae76519"));
executeTest("combineSingleSamplePipelineGVCF_includeNonVariants", spec);
}