From 30a19a00fed99e8f6d69dc3a3bf6bf0d22d3e3fe Mon Sep 17 00:00:00 2001 From: rpoplin Date: Tue, 12 Apr 2011 20:07:06 +0000 Subject: [PATCH] Fix for when running with EMIT_ALL_SITES but not GENOTYPE_GIVEN_ALLELES. Still want to emit a site even when over the deletion fraction for example. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5617 348d0f76-0448-11de-a6fe-93d51630548a --- .../genotyper/UnifiedGenotyperEngine.java | 23 +++++++++++-------- .../UnifiedGenotyperIntegrationTest.java | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java index db860029b..a89ce0ba0 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java @@ -151,9 +151,10 @@ public class UnifiedGenotyperEngine { } Map stratifiedContexts = getFilteredAndStratifiedContexts(UAC, refContext, rawContext, model); - if ( stratifiedContexts == null ) - return (UAC.OutputMode != OUTPUT_MODE.EMIT_ALL_SITES ? null : generateEmptyContext(tracker, refContext, stratifiedContexts, rawContext)); - + if ( stratifiedContexts == null ) { + return (UAC.OutputMode == OUTPUT_MODE.EMIT_ALL_SITES && UAC.GenotypingMode != GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ? generateEmptyContext(tracker, refContext, stratifiedContexts, rawContext) : null); + } + VariantContext vc = calculateLikelihoods(tracker, refContext, stratifiedContexts, AlignmentContextUtils.ReadOrientation.COMPLETE, null, true, model); if ( vc == null ) @@ -459,7 +460,7 @@ public class UnifiedGenotyperEngine { ReadBackedExtendedEventPileup pileup = rawPileup.getMappingFilteredPileup(UAC.MIN_MAPPING_QUALTY_SCORE); // don't call when there is no coverage - if ( pileup.size() == 0 && UAC.OutputMode != OUTPUT_MODE.EMIT_ALL_SITES ) + if ( pileup.size() == 0 && !(UAC.OutputMode == OUTPUT_MODE.EMIT_ALL_SITES && UAC.GenotypingMode != GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES) ) return null; // stratify the AlignmentContext and cut by sample @@ -473,12 +474,14 @@ public class UnifiedGenotyperEngine { // stratify the AlignmentContext and cut by sample stratifiedContexts = AlignmentContextUtils.splitContextBySampleName(rawContext.getBasePileup(), UAC.ASSUME_SINGLE_SAMPLE); - int numDeletions = 0; - for( final PileupElement p : rawContext.getBasePileup() ) { - if( p.isDeletion() ) { numDeletions++; } - } - if( ((double) numDeletions) / ((double) rawContext.getBasePileup().size()) > UAC.MAX_DELETION_FRACTION ) { - return null; + if( !(UAC.OutputMode == OUTPUT_MODE.EMIT_ALL_SITES && UAC.GenotypingMode != GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES) ) { + int numDeletions = 0; + for( final PileupElement p : rawContext.getBasePileup() ) { + if( p.isDeletion() ) { numDeletions++; } + } + if( ((double) numDeletions) / ((double) rawContext.getBasePileup().size()) > UAC.MAX_DELETION_FRACTION ) { + return null; + } } } diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java index ad49221c5..9ce58665b 100755 --- a/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java @@ -153,7 +153,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest { HashMap e = new HashMap(); e.put( "-sites_only", "63b76c4d26edf8cbb5bd91dafc81fee1" ); e.put( "--output_mode EMIT_ALL_CONFIDENT_SITES", "5bf0268945d953377ea3a811b20ff1bc" ); - e.put( "--output_mode EMIT_ALL_SITES", "a1730ea5ae5e1aa57d85d9d2372facc8" ); + e.put( "--output_mode EMIT_ALL_SITES", "78eeff5b2277877954e4985934077d3f" ); for ( Map.Entry entry : e.entrySet() ) { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(