diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/RodGeliText.java b/java/src/org/broadinstitute/sting/gatk/refdata/RodGeliText.java index cff4d03d0..c426c8720 100755 --- a/java/src/org/broadinstitute/sting/gatk/refdata/RodGeliText.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/RodGeliText.java @@ -176,7 +176,7 @@ public class RodGeliText extends BasicReferenceOrderedDatum implements Variation public boolean isSNP() { if (this.getReference().length() == 1) - return (!bestGenotype.equals(this.getReference() + this.getReference())); + return (this.refBase != this.bestGenotype.charAt(0) || this.refBase != this.bestGenotype.charAt(1)); return false; } @@ -223,7 +223,7 @@ public class RodGeliText extends BasicReferenceOrderedDatum implements Variation @Override public char getAlternativeBaseForSNP() { if (!this.isSNP()) throw new IllegalStateException("we're not a SNP"); - // we know that if we're a SNP, the reference is a single base + // we know that if we're a SNP, the alt is a single base if (this.bestGenotype.toString().charAt(0) == getReference().charAt(0)) return this.bestGenotype.toString().charAt(1); return this.bestGenotype.toString().charAt(0); @@ -354,7 +354,7 @@ public class RodGeliText extends BasicReferenceOrderedDatum implements Variation */ @Override public Genotype getCalledGenotype() { - return new BasicGenotype(getLocation(), this.getAltBasesFWD(), refBase, lodBtnb); + return new BasicGenotype(getLocation(), bestGenotype, refBase, lodBtnb); } /** @@ -365,7 +365,7 @@ public class RodGeliText extends BasicReferenceOrderedDatum implements Variation @Override public List getGenotypes() { List ret = new ArrayList(); - ret.add(new BasicGenotype(getLocation(), this.getAltBasesFWD(), refBase, lodBtnb)); + ret.add(new BasicGenotype(getLocation(), bestGenotype, refBase, lodBtnb)); return ret; } diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantCounter.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantCounter.java index d4b50f884..220ad94cb 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantCounter.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantCounter.java @@ -2,10 +2,9 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; -import org.broadinstitute.sting.utils.genotype.DiploidGenotype; +import org.broadinstitute.sting.utils.genotype.Genotype; import org.broadinstitute.sting.utils.genotype.VariantBackedByGenotype; import org.broadinstitute.sting.utils.genotype.Variation; -import org.broadinstitute.sting.utils.genotype.Genotype; import java.util.ArrayList; import java.util.List; @@ -33,8 +32,8 @@ public class VariantCounter extends BasicVariantAnalysis implements GenotypeAnal nSNPs += eval == null ? 0 : 1; if ( this.getMaster().evalContainsGenotypes && eval != null ) { - List genotypes = ((VariantBackedByGenotype)eval).getGenotypes(); - if ( eval.isSNP() && eval.isBiallelic() && genotypes.get(0).isHet() ) { + Genotype genotype = ((VariantBackedByGenotype)eval).getCalledGenotype(); + if ( eval.isSNP() && eval.isBiallelic() && genotype.isHet() ) { nHets++; } } diff --git a/java/src/org/broadinstitute/sting/utils/genotype/BasicGenotype.java b/java/src/org/broadinstitute/sting/utils/genotype/BasicGenotype.java index 4e034626b..e4863cf6a 100644 --- a/java/src/org/broadinstitute/sting/utils/genotype/BasicGenotype.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/BasicGenotype.java @@ -80,7 +80,6 @@ public class BasicGenotype implements Genotype { public boolean isHom() { if (mGenotype.length() < 1) return false; - char base = mGenotype.charAt(0); for (char cur : mGenotype.toCharArray()) { if (base != cur) { @@ -97,6 +96,8 @@ public class BasicGenotype implements Genotype { */ @Override public boolean isHet() { + if (mGenotype.length() < 1) + return false; return !isHom(); } diff --git a/java/test/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantEvalWalkerIntegrationTest.java b/java/test/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantEvalWalkerIntegrationTest.java index 1542a91fe..f4dbaabad 100644 --- a/java/test/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantEvalWalkerIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantEvalWalkerIntegrationTest.java @@ -19,7 +19,7 @@ public class VariantEvalWalkerIntegrationTest extends WalkerTest { @Test public void testEvalVariantROD() { List md5 = new ArrayList(); - md5.add("013d13d405f33b0fe4038f5aea087e7f"); + md5.add("7d1f8ddbf2d2f721a0c6dc39c97b584c"); /** * the above MD5 was calculated from running the following command: @@ -50,7 +50,7 @@ public class VariantEvalWalkerIntegrationTest extends WalkerTest { @Test public void testEvalVariantRODConfSix() { List md5 = new ArrayList(); - md5.add("422d94ab60a3db42b0a5dc9c254b78f4"); + md5.add("27969a841874fc00d007b01ee008eb58"); /** * the above MD5 was calculated from running the following command: @@ -82,7 +82,7 @@ public class VariantEvalWalkerIntegrationTest extends WalkerTest { @Test public void testEvalVariantRODOutputViolations() { List md5 = new ArrayList(); - md5.add("8e613d57fd770ff04eb6531f583f4448"); + md5.add("63940f8d977b15bb1bcc9223ebeacf43"); /** * the above MD5 was calculated from running the following command: @@ -114,7 +114,7 @@ public class VariantEvalWalkerIntegrationTest extends WalkerTest { @Test public void testEvalGenotypeROD() { List md5 = new ArrayList(); - md5.add("d337f22057d2e9cfda03af3be70ce35a"); + md5.add("c616348c1041157acd2715285c5b38b8"); /** * the above MD5 was calculated after running the following command: * @@ -148,7 +148,7 @@ public class VariantEvalWalkerIntegrationTest extends WalkerTest { @Test public void testEvalMarksGenotypingExample() { List md5 = new ArrayList(); - md5.add("39ea64299cad44f816f033db54c8e622"); + md5.add("004cdf0c3ca46744daf42645785acc28"); /** * Run with the following commands: *