diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java index ff56bd9a8..15278bef8 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java @@ -11,31 +11,32 @@ import java.util.ArrayList; public class AlleleBalance implements VariantAnnotation { public Pair annotate(ReferenceContext ref, ReadBackedPileup pileup, List genotypes) { - double ratio = -1; - if ( genotypes.size() > 0 ) { - Genotype g = genotypes.get(0); - if ( g instanceof ReadBacked && g instanceof PosteriorsBacked ) { - Pair weightedBalance = computeWeightedBalance(ref.getBase(), genotypes, pileup); - if ( weightedBalance.second == 0 ) - return null; - ratio = weightedBalance.first; - } else { - // this test doesn't make sense for homs - Genotype genotype = VariantAnnotator.getFirstHetVariant(genotypes); - if ( genotype == null ) - return null; + if ( genotypes.size() == 0 ) + return null; - final String genotypeStr = genotype.getBases().toUpperCase(); - if ( genotypeStr.length() != 2 ) - return null; + double ratio; + Genotype g = genotypes.get(0); + if ( g instanceof ReadBacked && g instanceof PosteriorsBacked ) { + Pair weightedBalance = computeWeightedBalance(ref.getBase(), genotypes, pileup); + if ( weightedBalance.second == 0 ) + return null; + ratio = weightedBalance.first; + } else { + // this test doesn't make sense for homs + Genotype genotype = VariantAnnotator.getFirstHetVariant(genotypes); + if ( genotype == null ) + return null; - final String bases = pileup.getBasesAsString().toUpperCase(); - if ( bases.length() == 0 ) - return null; + final String genotypeStr = genotype.getBases().toUpperCase(); + if ( genotypeStr.length() != 2 ) + return null; - ratio = computeSingleBalance(ref.getBase(), genotypeStr, bases); - } + final String bases = pileup.getBasesAsString().toUpperCase(); + if ( bases.length() == 0 ) + return null; + + ratio = computeSingleBalance(ref.getBase(), genotypeStr, bases); } return new Pair("AlleleBalance", String.format("%.2f", ratio)); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/OnOffGenotype.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/OnOffGenotype.java index 6e97470fa..17b945dba 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/OnOffGenotype.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/OnOffGenotype.java @@ -14,30 +14,30 @@ public class OnOffGenotype implements VariantAnnotation { public Pair annotate(ReferenceContext ref, ReadBackedPileup pileup, List genotypes) { - double ratio = -1; + if ( genotypes.size() == 0 ) + return null; - if ( genotypes.size() > 0 ) { - Genotype g = genotypes.get(0); - if ( g instanceof ReadBacked && g instanceof PosteriorsBacked) { - Pair weightedBalance = computeWeightedBalance(ref.getBase(), genotypes, pileup); - if ( weightedBalance.second == 0 ) - return null; - ratio = weightedBalance.first; - } else { - Genotype genotype = VariantAnnotator.getFirstVariant(ref.getBase(), genotypes); - if ( genotype == null ) - return null; + double ratio; + Genotype g = genotypes.get(0); + if ( g instanceof ReadBacked && g instanceof PosteriorsBacked) { + Pair weightedBalance = computeWeightedBalance(ref.getBase(), genotypes, pileup); + if ( weightedBalance.second == 0 ) + return null; + ratio = weightedBalance.first; + } else { + Genotype genotype = VariantAnnotator.getFirstVariant(ref.getBase(), genotypes); + if ( genotype == null ) + return null; - final String genotypeStr = genotype.getBases().toUpperCase(); - if ( genotypeStr.length() != 2 ) - return null; + final String genotypeStr = genotype.getBases().toUpperCase(); + if ( genotypeStr.length() != 2 ) + return null; - final String bases = pileup.getBasesAsString().toUpperCase(); - if ( bases.length() == 0 ) - return null; + final String bases = pileup.getBasesAsString().toUpperCase(); + if ( bases.length() == 0 ) + return null; - ratio = computeSingleBalance(genotypeStr, bases); - } + ratio = computeSingleBalance(genotypeStr, bases); } return new Pair("OnOffGenotype", String.format("%.2f", ratio)); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/JointEstimateGenotypeCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/JointEstimateGenotypeCalculationModel.java index 5dce2fea7..c578eb0ec 100644 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/JointEstimateGenotypeCalculationModel.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/JointEstimateGenotypeCalculationModel.java @@ -238,6 +238,8 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc } double phredScaledConfidence = -10.0 * Math.log10(alleleFrequencyPosteriors[indexOfMax][0]); + if ( Double.isInfinite(phredScaledConfidence) ) + phredScaledConfidence = -10.0 * log10PofDgivenAFi[indexOfMax][0]; int bestAFguess = Utils.findIndexOfMaxEntry(alleleFrequencyPosteriors[indexOfMax]); // return a null call if we don't pass the confidence cutoff or the most likely allele frequency is zero