From fa9c21c020c960627738aba67347e16ef09072d5 Mon Sep 17 00:00:00 2001 From: delangel Date: Fri, 1 Oct 2010 02:32:50 +0000 Subject: [PATCH] More fixes for exact AF calculation model in new unified genotyper: a) Fixed bugs in new dynamic programming-based genotyper b) Fixed up temp hack that handles extended pileups for now. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4398 348d0f76-0448-11de-a6fe-93d51630548a --- .../genotyper/ExactAFCalculationModel.java | 15 +++++++++------ .../walkers/genotyper/UnifiedGenotyperEngine.java | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/genotyper/ExactAFCalculationModel.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/genotyper/ExactAFCalculationModel.java index 3be8fc29e..43d74a055 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/genotyper/ExactAFCalculationModel.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/genotyper/ExactAFCalculationModel.java @@ -134,8 +134,7 @@ public class ExactAFCalculationModel extends AlleleFrequencyCalculationModel { protected Map generateCalls(Map contexts, Map GLs, int bestAFguess) { - // first experiment: refine do genotype assignment by Hardy Weinberg equilibrium assumption. - HashMap calls = new HashMap(); + HashMap calls = new HashMap(); double[][] pathMetricArray = new double[GLs.size()+1][bestAFguess+1]; @@ -144,6 +143,13 @@ public class ExactAFCalculationModel extends AlleleFrequencyCalculationModel { ArrayList sampleIndices = new ArrayList(); int sampleIdx = 0; + // todo - optimize initialization + for (int k=0; k <= bestAFguess; k++) + for (int j=0; j <= GLs.size(); j++) + pathMetricArray[j][k] = -1e30; + + pathMetricArray[0][0] = 0.0; + if (SIMPLE_GREEDY_GENOTYPER) { sampleIndices.addAll(GLs.keySet()); sampleIdx = GLs.size(); @@ -222,10 +228,7 @@ public class ExactAFCalculationModel extends AlleleFrequencyCalculationModel { if (qual <= 0.0) { qual = 0.0; - myAlleles.clear(); - myAlleles.add(Allele.NO_CALL); - myAlleles.add(Allele.NO_CALL); - } + } attributes.put(VCFConstants.GENOTYPE_QUALITY_KEY,String.format("%4.2f", 10*qual)); diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/genotyper/UnifiedGenotyperEngine.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/genotyper/UnifiedGenotyperEngine.java index c32fcd371..6214d0901 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/genotyper/UnifiedGenotyperEngine.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/genotyper/UnifiedGenotyperEngine.java @@ -230,7 +230,8 @@ public class UnifiedGenotyperEngine { // todo - temp fix until we can deal with extended events properly //VariantContext vc = new VariantContext("UG_call", loc.getContig(), loc.getStart(), loc.getStop(), alleles, genotypes, phredScaledConfidence/10.0, passesCallThreshold(phredScaledConfidence, atTriggerTrack) ? null : filter, attributes); VariantContext vc = new VariantContext("UG_call", loc.getContig(), loc.getStart(), - loc.getStart()+refAllele.length(), alleles, genotypes, phredScaledConfidence/10.0, passesCallThreshold(phredScaledConfidence, atTriggerTrack) ? null : filter, attributes); + Math.max(loc.getStart()+refAllele.length()-1,loc.getStart()), + alleles, genotypes, phredScaledConfidence/10.0, passesCallThreshold(phredScaledConfidence, atTriggerTrack) ? null : filter, attributes); if ( annotationEngine != null ) {