From 7e9051ea25d4081070359d9e984ae98b261fecab Mon Sep 17 00:00:00 2001 From: ebanks Date: Fri, 15 Apr 2011 18:05:10 +0000 Subject: [PATCH] The solution to James's bug was just to clean up the code and simplify it. What happened was that functionality that got put into UGCalcLikelihoods was then generalized into the UG engine but then never removed from UGCalcLikelihoods. This knowingly breaks the batch merger, but Chris said he'll take care of it. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5647 348d0f76-0448-11de-a6fe-93d51630548a --- .../SNPGenotypeLikelihoodsCalculationModel.java | 2 +- .../walkers/genotyper/UGCalcLikelihoods.java | 17 ++--------------- .../genotyper/UnifiedGenotyperEngine.java | 12 ++---------- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java index 4bea86161..f57c8873e 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java @@ -74,7 +74,7 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC bestAlternateAllele = alternateAlleleToUse.getBases()[0]; } else if ( useAlleleFromVCF ) { final VariantContext vcInput = tracker.getVariantContext(ref, "alleles", null, ref.getLocus(), true); - if ( vcInput == null || vcInput.isFiltered() ) + if ( vcInput == null || vcInput.isFiltered() || !vcInput.isSNP() ) return null; if ( !vcInput.isSNP() ) { logger.info("Record at position " + ref.getLocus() + " is not a SNP; skipping..."); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCalcLikelihoods.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCalcLikelihoods.java index f3f48f501..4bfb93e80 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCalcLikelihoods.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCalcLikelihoods.java @@ -47,7 +47,7 @@ import java.util.*; * the name 'allele' so we know which alternate allele to use at each site. */ @BAQMode(QualityMode = BAQ.QualityMode.ADD_TAG, ApplicationTime = BAQ.ApplicationTime.ON_INPUT) -@Requires(value={},referenceMetaData=@RMD(name="allele", type= VariantContext.class)) +@Requires(value={},referenceMetaData=@RMD(name="alleles", type= VariantContext.class)) @Reference(window=@Window(start=-200,stop=200)) @By(DataSource.READS) @Downsample(by=DownsampleType.BY_SAMPLE, toCoverage=250) @@ -90,20 +90,7 @@ public class UGCalcLikelihoods extends LocusWalker } public VariantCallContext map(RefMetaDataTracker tracker, ReferenceContext refContext, AlignmentContext rawContext) { - Collection VCs = tracker.getVariantContexts(refContext, "allele", null, rawContext.getLocation(), true, false); - if ( VCs.size() == 0 ) - return null; - if ( VCs.size() > 1 ) { - logger.warn("Multiple records seen in the 'allele' ROD at position " + rawContext.getLocation() + "; skipping..."); - return null; - } - VariantContext vc = VCs.iterator().next(); - if ( !vc.isBiallelic() ) { - logger.warn("The record in the 'allele' ROD at position " + rawContext.getLocation() + " is not biallelic; skipping..."); - return null; - } - - VariantContext call = UG_engine.calculateLikelihoods(tracker, refContext, rawContext, vc.getAlternateAllele(0), true); + VariantContext call = UG_engine.calculateLikelihoods(tracker, refContext, rawContext); return call == null ? null : new VariantCallContext(call, refContext.getBase(), true); } 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 b3ff6af80..0cb942ab3 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java @@ -139,12 +139,6 @@ public class UnifiedGenotyperEngine { if ( UAC.COVERAGE_AT_WHICH_TO_ABORT > 0 && rawContext.size() > UAC.COVERAGE_AT_WHICH_TO_ABORT ) return null; - // special case handling - avoid extended event pileups when calling indels if we're genotyping given alleles - // TODO - is this the right solution? otherwise we trigger twice and we get duplicate entries - /* if ( UAC.GLmodel == GenotypeLikelihoodsCalculationModel.Model.DINDEL && rawContext.hasExtendedEventPileup() - && UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES) - return null; - */ final GenotypeLikelihoodsCalculationModel.Model model = getCurrentGLModel( rawContext ); if( model == null ) { return null; @@ -169,11 +163,9 @@ public class UnifiedGenotyperEngine { * @param tracker the meta data tracker * @param refContext the reference base * @param rawContext contextual information around the locus - * @param alternateAlleleToUse the alternate allele to use, null if not set - * @param useBAQedPileup should we use the BAQed pileup? * @return the VariantContext object */ - public VariantContext calculateLikelihoods(RefMetaDataTracker tracker, ReferenceContext refContext, AlignmentContext rawContext, Allele alternateAlleleToUse, boolean useBAQedPileup) { + public VariantContext calculateLikelihoods(RefMetaDataTracker tracker, ReferenceContext refContext, AlignmentContext rawContext) { final GenotypeLikelihoodsCalculationModel.Model model = getCurrentGLModel( rawContext ); if( model == null ) return null; @@ -182,7 +174,7 @@ public class UnifiedGenotyperEngine { if ( stratifiedContexts == null ) return null; - return calculateLikelihoods(tracker, refContext, stratifiedContexts, AlignmentContextUtils.ReadOrientation.COMPLETE, alternateAlleleToUse, useBAQedPileup, model); + return calculateLikelihoods(tracker, refContext, stratifiedContexts, AlignmentContextUtils.ReadOrientation.COMPLETE, null, true, model); } // private method called by both UnifiedGenotyper and UGCalcLikelihoods entry points into the engine