Merge pull request #579 from broadinstitute/rp_fix_DP_annotation

Fix for dropping of reference sample depth in the DP annotation.
This commit is contained in:
MauricioCarneiro 2014-03-24 15:49:20 -04:00
commit 5abb7ea2db
3 changed files with 20 additions and 4 deletions

View File

@ -251,7 +251,7 @@ public class GenotypeGVCFs extends RodWalker<VariantContext, VariantContextWrite
// move the MIN_DP to DP
if ( oldGT.hasExtendedAttribute("MIN_DP") ) {
depth = oldGT.getAttributeAsInt("MIN_DP", 0);
depth = Integer.parseInt((String)oldGT.getAnyAttribute("MIN_DP"));
builder.DP(depth);
attrs.remove("MIN_DP");
}

View File

@ -81,6 +81,19 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest {
executeTest("combineSingleSamplePipelineGVCF_includeNonVariants", spec);
}
@Test(enabled = true)
public void combineSingleSamplePipelineGVCFHierarchical() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(" -V " + privateTestDir + "combine.single.sample.pipeline.combined.vcf" +
" -V:sample1 " + privateTestDir + "combine.single.sample.pipeline.1.vcf" +
" -V:sample2 " + privateTestDir + "combine.single.sample.pipeline.2.vcf" +
" -V:sample3 " + privateTestDir + "combine.single.sample.pipeline.3.vcf" +
" -L 20:10,000,000-20,000,000", b37KGReference),
1,
Arrays.asList("ba07b64d677b0c8306e71695867fd946"));
executeTest("combineSingleSamplePipelineGVCFHierarchical", spec);
}
@Test(enabled = true)
public void combineSingleSamplePipelineGVCF_addDbsnp() {
WalkerTestSpec spec = new WalkerTestSpec(

View File

@ -1095,10 +1095,13 @@ public class GATKVariantContextUtils {
mergeRefConfidenceGenotypes(genotypes, vc, remappedAlleles, allelesList);
// special case DP (add it up) for all events
if ( vc.hasAttribute(VCFConstants.DEPTH_KEY) )
if ( vc.hasAttribute(VCFConstants.DEPTH_KEY) ) {
depth += vc.getAttributeAsInt(VCFConstants.DEPTH_KEY, 0);
else if ( vc.getNSamples() == 1 && vc.getGenotype(0).hasExtendedAttribute("MIN_DP") ) // handle the gVCF case from the HaplotypeCaller
depth += vc.getGenotype(0).getAttributeAsInt("MIN_DP", 0);
} else { // handle the gVCF case from the HaplotypeCaller
for( final Genotype gt : vc.getGenotypes() ) {
depth += (gt.hasExtendedAttribute("MIN_DP") ? Integer.parseInt((String)gt.getAnyAttribute("MIN_DP")) : (gt.hasDP() ? gt.getDP() : 0));
}
}
if ( loc.getStart() != vc.getStart() )
continue;