diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java index 987579ab8..6a825cba7 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java @@ -59,10 +59,10 @@ public class FisherStrand extends InfoFieldAnnotation implements StandardAnnotat int[][] table; - if (vc.isBiallelic() && vc.isSNP()) - table = getSNPContingencyTable(stratifiedContexts, vc.getReference(), vc.getAlternateAllele(0)); - else if (vc.isIndel() || vc.isMixed()) { - table = getIndelContingencyTable(stratifiedContexts, vc); + if ( vc.isSNP() ) + table = getSNPContingencyTable(stratifiedContexts, vc.getReference(), vc.getAltAlleleWithHighestAlleleCount()); + else if ( vc.isIndel() || vc.isMixed() ) { + table = getIndelContingencyTable(stratifiedContexts); if (table == null) return null; } @@ -234,7 +234,7 @@ public class FisherStrand extends InfoFieldAnnotation implements StandardAnnotat * allele2 # # * @return a 2x2 contingency table */ - private static int[][] getIndelContingencyTable(Map stratifiedContexts, VariantContext vc) { + private static int[][] getIndelContingencyTable(Map stratifiedContexts) { final double INDEL_LIKELIHOOD_THRESH = 0.3; final HashMap> indelLikelihoodMap = IndelGenotypeLikelihoodsCalculationModel.getIndelLikelihoodMap(); diff --git a/public/java/src/org/broadinstitute/sting/utils/variantcontext/VariantContext.java b/public/java/src/org/broadinstitute/sting/utils/variantcontext/VariantContext.java index 27721be95..f5c57ca44 100755 --- a/public/java/src/org/broadinstitute/sting/utils/variantcontext/VariantContext.java +++ b/public/java/src/org/broadinstitute/sting/utils/variantcontext/VariantContext.java @@ -1229,12 +1229,15 @@ public class VariantContext implements Feature { // to enable tribble intergrati } public Allele getAltAlleleWithHighestAlleleCount() { - // first idea: get two alleles with highest AC + // optimization: for bi-allelic sites, just return the 1only alt allele + if ( isBiallelic() ) + return getAlternateAllele(0); + Allele best = null; int maxAC1 = 0; - for (Allele a:this.getAlternateAlleles()) { - int ac = this.getCalledChrCount(a); - if (ac >=maxAC1) { + for ( Allele a : getAlternateAlleles() ) { + final int ac = getCalledChrCount(a); + if ( ac >= maxAC1 ) { maxAC1 = ac; best = a; } @@ -1244,6 +1247,9 @@ public class VariantContext implements Feature { // to enable tribble intergrati } public int[] getGLIndecesOfAllele(Allele inputAllele) { + + // TODO -- this information is cached statically by the UnifiedGenotyperEngine; pull it out into a common utils class for all to use + int[] idxVector = new int[3]; int numAlleles = this.getAlleles().size();