fixing VariantEvalWalkerIntegrationTest md5 sums, a couple comment changes, and a little bit of cleanup

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1690 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2009-09-22 20:54:47 +00:00
parent b0fa19a0b2
commit 11c32b588f
4 changed files with 14 additions and 14 deletions

View File

@ -176,7 +176,7 @@ public class RodGeliText extends BasicReferenceOrderedDatum implements Variation
public boolean isSNP() { public boolean isSNP() {
if (this.getReference().length() == 1) 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; return false;
} }
@ -223,7 +223,7 @@ public class RodGeliText extends BasicReferenceOrderedDatum implements Variation
@Override @Override
public char getAlternativeBaseForSNP() { public char getAlternativeBaseForSNP() {
if (!this.isSNP()) throw new IllegalStateException("we're not a SNP"); 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)) if (this.bestGenotype.toString().charAt(0) == getReference().charAt(0))
return this.bestGenotype.toString().charAt(1); return this.bestGenotype.toString().charAt(1);
return this.bestGenotype.toString().charAt(0); return this.bestGenotype.toString().charAt(0);
@ -354,7 +354,7 @@ public class RodGeliText extends BasicReferenceOrderedDatum implements Variation
*/ */
@Override @Override
public Genotype getCalledGenotype() { 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 @Override
public List<Genotype> getGenotypes() { public List<Genotype> getGenotypes() {
List<Genotype> ret = new ArrayList<Genotype>(); List<Genotype> ret = new ArrayList<Genotype>();
ret.add(new BasicGenotype(getLocation(), this.getAltBasesFWD(), refBase, lodBtnb)); ret.add(new BasicGenotype(getLocation(), bestGenotype, refBase, lodBtnb));
return ret; return ret;
} }

View File

@ -2,10 +2,9 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; 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.VariantBackedByGenotype;
import org.broadinstitute.sting.utils.genotype.Variation; import org.broadinstitute.sting.utils.genotype.Variation;
import org.broadinstitute.sting.utils.genotype.Genotype;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -33,8 +32,8 @@ public class VariantCounter extends BasicVariantAnalysis implements GenotypeAnal
nSNPs += eval == null ? 0 : 1; nSNPs += eval == null ? 0 : 1;
if ( this.getMaster().evalContainsGenotypes && eval != null ) { if ( this.getMaster().evalContainsGenotypes && eval != null ) {
List<Genotype> genotypes = ((VariantBackedByGenotype)eval).getGenotypes(); Genotype genotype = ((VariantBackedByGenotype)eval).getCalledGenotype();
if ( eval.isSNP() && eval.isBiallelic() && genotypes.get(0).isHet() ) { if ( eval.isSNP() && eval.isBiallelic() && genotype.isHet() ) {
nHets++; nHets++;
} }
} }

View File

@ -80,7 +80,6 @@ public class BasicGenotype implements Genotype {
public boolean isHom() { public boolean isHom() {
if (mGenotype.length() < 1) if (mGenotype.length() < 1)
return false; return false;
char base = mGenotype.charAt(0); char base = mGenotype.charAt(0);
for (char cur : mGenotype.toCharArray()) { for (char cur : mGenotype.toCharArray()) {
if (base != cur) { if (base != cur) {
@ -97,6 +96,8 @@ public class BasicGenotype implements Genotype {
*/ */
@Override @Override
public boolean isHet() { public boolean isHet() {
if (mGenotype.length() < 1)
return false;
return !isHom(); return !isHom();
} }

View File

@ -19,7 +19,7 @@ public class VariantEvalWalkerIntegrationTest extends WalkerTest {
@Test @Test
public void testEvalVariantROD() { public void testEvalVariantROD() {
List<String> md5 = new ArrayList<String>(); List<String> md5 = new ArrayList<String>();
md5.add("013d13d405f33b0fe4038f5aea087e7f"); md5.add("7d1f8ddbf2d2f721a0c6dc39c97b584c");
/** /**
* the above MD5 was calculated from running the following command: * the above MD5 was calculated from running the following command:
@ -50,7 +50,7 @@ public class VariantEvalWalkerIntegrationTest extends WalkerTest {
@Test @Test
public void testEvalVariantRODConfSix() { public void testEvalVariantRODConfSix() {
List<String> md5 = new ArrayList<String>(); List<String> md5 = new ArrayList<String>();
md5.add("422d94ab60a3db42b0a5dc9c254b78f4"); md5.add("27969a841874fc00d007b01ee008eb58");
/** /**
* the above MD5 was calculated from running the following command: * the above MD5 was calculated from running the following command:
@ -82,7 +82,7 @@ public class VariantEvalWalkerIntegrationTest extends WalkerTest {
@Test @Test
public void testEvalVariantRODOutputViolations() { public void testEvalVariantRODOutputViolations() {
List<String> md5 = new ArrayList<String>(); List<String> md5 = new ArrayList<String>();
md5.add("8e613d57fd770ff04eb6531f583f4448"); md5.add("63940f8d977b15bb1bcc9223ebeacf43");
/** /**
* the above MD5 was calculated from running the following command: * the above MD5 was calculated from running the following command:
@ -114,7 +114,7 @@ public class VariantEvalWalkerIntegrationTest extends WalkerTest {
@Test @Test
public void testEvalGenotypeROD() { public void testEvalGenotypeROD() {
List<String> md5 = new ArrayList<String>(); List<String> md5 = new ArrayList<String>();
md5.add("d337f22057d2e9cfda03af3be70ce35a"); md5.add("c616348c1041157acd2715285c5b38b8");
/** /**
* the above MD5 was calculated after running the following command: * the above MD5 was calculated after running the following command:
* *
@ -148,7 +148,7 @@ public class VariantEvalWalkerIntegrationTest extends WalkerTest {
@Test @Test
public void testEvalMarksGenotypingExample() { public void testEvalMarksGenotypingExample() {
List<String> md5 = new ArrayList<String>(); List<String> md5 = new ArrayList<String>();
md5.add("39ea64299cad44f816f033db54c8e622"); md5.add("004cdf0c3ca46744daf42645785acc28");
/** /**
* Run with the following commands: * Run with the following commands:
* *