From b401929e4145148ed8c291e167b66768ff39141a Mon Sep 17 00:00:00 2001 From: aaron Date: Tue, 15 Sep 2009 04:48:42 +0000 Subject: [PATCH] incremental clean-up and changes for VariantEval, moved DiploidGenotype to a better home, and fixed a spelling error. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1624 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/gatk/refdata/RodGLF.java | 20 ++- .../sting/gatk/refdata/RodGeliText.java | 170 ++++++++++-------- .../gatk/refdata/RodGenotypeChipAsGFF.java | 30 +++- .../sting/gatk/refdata/rodDbSNP.java | 31 +++- .../genotyper/DiploidGenotypePriors.java | 7 +- .../genotyper/GenotypeLikelihoods.java | 1 + .../walkers/genotyper/SSGenotypeCall.java | 2 +- .../gatk/walkers/CoverageEvalWalker.java | 2 +- .../gatk/walkers/HLAcaller/CallHLAWalker.java | 1 + .../varianteval/BasicPoolVariantAnalysis.java | 4 +- .../varianteval/CallableBasesAnalysis.java | 7 +- .../varianteval/GenotypeConcordance.java | 2 +- .../PooledGenotypeConcordance.java | 3 +- .../TransitionTranversionAnalysis.java | 12 +- .../walkers/varianteval/VariantCounter.java | 2 +- .../varianteval/VariantDBCoverage.java | 23 +-- .../varianteval/VariantEvalWalker.java | 19 +- .../walkers/varianteval/VariantMatcher.java | 3 +- .../sting/utils/genotype/BasicGenotype.java | 2 +- .../sting/utils/genotype/BasicVariation.java | 34 +++- .../genotype}/DiploidGenotype.java | 11 +- .../sting/utils/genotype/GenotypesBacked.java | 2 +- .../utils/genotype/LikelihoodObject.java | 14 +- .../genotype/VariantBackedByGenotype.java | 16 +- .../sting/utils/genotype/Variation.java | 12 +- .../utils/genotype/geli/GeliTextWriter.java | 2 +- .../sting/utils/genotype/glf/GLFWriter.java | 3 +- .../sting/gatk/refdata/RodGLFTest.java | 2 +- .../genotyper/GenotypeLikelihoodsTest.java | 6 +- .../utils/genotype/DiploidGenotypeTest.java | 104 +++++++++++ .../utils/genotype/LikelihoodObjectTest.java | 6 +- 31 files changed, 369 insertions(+), 184 deletions(-) rename java/src/org/broadinstitute/sting/{gatk/walkers/genotyper => utils/genotype}/DiploidGenotype.java (71%) create mode 100644 java/test/org/broadinstitute/sting/utils/genotype/DiploidGenotypeTest.java diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/RodGLF.java b/java/src/org/broadinstitute/sting/gatk/refdata/RodGLF.java index c0757c348..b3868242a 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/RodGLF.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/RodGLF.java @@ -119,8 +119,8 @@ public class RodGLF implements ReferenceOrderedDatum, Variation, Iterator 5; } - public boolean isInsertion() { return false; } - public boolean isDeletion() { return false; } - public boolean isIndel() { return false; } - public double getMAF() { return 0; } - public double getHeterozygosity() { return 0; } - public boolean isGenotype() { return true; } - public double getVariationConfidence() { return getLodBtr(); } - public double getConsensusConfidence() { return getLodBtnb(); } - public List getGenotype() throws IllegalStateException { - return Arrays.asList(getBestGenotype()); - } - - public int getPloidy() throws IllegalStateException { return 2; } - public boolean isBiallelic() { return true; } - */ - /** * get the likelihoods * @@ -328,7 +335,24 @@ public class RodGeliText extends BasicReferenceOrderedDatum implements Variation */ @Override public org.broadinstitute.sting.utils.genotype.Genotype getGenotype(DiploidGenotype x) { - if (x.toString().equals(this.getAltBasesFWD())) throw new IllegalStateException("Unable to retrieve genotype"); - return new BasicGenotype(this.getLocation(),this.bestGenotype,this.getRefSnpFWD(),this.getConsensusConfidence()); + // figure out the best -switch to this + /*Integer values[] = Utils.SortPermutation(this.genotypeLikelihoods); + int indexThis = x.ordinal(); + int other = (x.toString().equals(Genotype.values()[values[1]])) ? values[9] : values[8]; + double lod = (genotypeLikelihoods[indexThis] - genotypeLikelihoods[other]);*/ + return new BasicGenotype(getLocation(),x.toString(), refBase, lodBtnb); + } + + /** + * do we have the specified genotype? not all backedByGenotypes + * have all the genotype data. + * + * @param x the genotype + * + * @return true if available, false otherwise + */ + @Override + public boolean hasGenotype(DiploidGenotype x) { + return (x.toString().equals(this.getAltBasesFWD())); } } diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/RodGenotypeChipAsGFF.java b/java/src/org/broadinstitute/sting/gatk/refdata/RodGenotypeChipAsGFF.java index 135c792f3..0f0ad103c 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/RodGenotypeChipAsGFF.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/RodGenotypeChipAsGFF.java @@ -4,7 +4,7 @@ import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.GenomeLocParser; import org.broadinstitute.sting.utils.Utils; import org.broadinstitute.sting.utils.genotype.*; -import org.broadinstitute.sting.gatk.walkers.genotyper.DiploidGenotype; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import org.broadinstitute.sting.utils.genotype.Genotype; import java.util.*; import java.util.regex.MatchResult; @@ -82,8 +82,8 @@ public class RodGenotypeChipAsGFF extends BasicReferenceOrderedDatum implements * @return the reference base or bases, as a string */ @Override - public char getReference() { - return 'N'; + public String getReference() { + throw new IllegalStateException("Chip data is unable to determine the reference"); } /** @@ -223,6 +223,16 @@ public class RodGenotypeChipAsGFF extends BasicReferenceOrderedDatum implements return this.getAltSnpFWD(); } + /** + * gets the reference base is the case of a SNP. Throws an IllegalStateException if we're not a SNP + * + * @return a char, representing the alternate base + */ + @Override + public char getReferenceForSNP() { + return this.getRefSnpFWD(); + } + public double getMAF() { return 0; } public double getHeterozygosity() { return 0; } public boolean isGenotype() { return true; } @@ -247,4 +257,18 @@ public class RodGenotypeChipAsGFF extends BasicReferenceOrderedDatum implements if (!x.toString().equals(this.getAltBasesFWD())) throw new IllegalStateException("Unable to retrieve genotype"); return new BasicGenotype(this.getLocation(),this.feature,this.getRefSnpFWD(),this.getConsensusConfidence()); } + + /** + * do we have the specified genotype? not all backedByGenotypes + * have all the genotype data. + * + * @param x the genotype + * + * @return true if available, false otherwise + */ + @Override + public boolean hasGenotype(DiploidGenotype x) { + if (!x.toString().equals(this.getAltBasesFWD())) return false; + return true; + } } diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/rodDbSNP.java b/java/src/org/broadinstitute/sting/gatk/refdata/rodDbSNP.java index fc5abcc34..16fb7123b 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/rodDbSNP.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/rodDbSNP.java @@ -3,7 +3,7 @@ package org.broadinstitute.sting.gatk.refdata; import net.sf.picard.util.SequenceUtil; import org.broadinstitute.sting.utils.*; import org.broadinstitute.sting.utils.genotype.*; -import org.broadinstitute.sting.gatk.walkers.genotyper.DiploidGenotype; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import java.util.Arrays; import java.util.List; @@ -68,8 +68,8 @@ public class rodDbSNP extends BasicReferenceOrderedDatum implements Variation, V * @return the reference base or bases, as a string */ @Override - public char getReference() { - return getRefSnpFWD(); + public String getReference() { + return getRefBasesFWD(); } /** @@ -183,6 +183,16 @@ public class rodDbSNP extends BasicReferenceOrderedDatum implements Variation, V return getAlternateBases().charAt(0); */ } + /** + * gets the reference base is the case of a SNP. Throws an IllegalStateException if we're not a SNP + * + * @return a char, representing the alternate base + */ + @Override + public char getReferenceForSNP() { + return 0; //To change body of implemented methods use File | Settings | File Templates. + } + public boolean isReference() { return false; } // snp locations are never "reference", there's always a variant public boolean isHapmap() { return validationStatus.contains("by-hapmap"); } @@ -314,7 +324,20 @@ public class rodDbSNP extends BasicReferenceOrderedDatum implements Variation, V */ @Override public org.broadinstitute.sting.utils.genotype.Genotype getGenotype(DiploidGenotype x) { - if (x.toString().equals(this.getAltBasesFWD())) throw new IllegalStateException("Unable to retrieve genotype"); + if (!x.toString().equals(this.getAltBasesFWD())) throw new IllegalStateException("Unable to retrieve genotype"); return new BasicGenotype(this.getLocation(),this.getAltBasesFWD(),this.getRefSnpFWD(),this.getConsensusConfidence()); } + + /** + * do we have the specified genotype? not all backedByGenotypes + * have all the genotype data. + * + * @param x the genotype + * + * @return true if available, false otherwise + */ + @Override + public boolean hasGenotype(DiploidGenotype x) { + return (!x.toString().equals(this.getAltBasesFWD())) ? false : true; + } } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidGenotypePriors.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidGenotypePriors.java index 0fa201970..0973341f4 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidGenotypePriors.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidGenotypePriors.java @@ -2,15 +2,10 @@ package org.broadinstitute.sting.gatk.walkers.genotyper; import org.broadinstitute.sting.utils.Utils; import org.broadinstitute.sting.utils.MathUtils; -import org.broadinstitute.sting.utils.BaseUtils; -import org.broadinstitute.sting.utils.ReadBackedPileup; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; -import static java.lang.Math.log10; -import static java.lang.Math.pow; import java.util.Arrays; -import net.sf.samtools.SAMRecord; - public class DiploidGenotypePriors { // -------------------------------------------------------------------------------------------------------------- // diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoods.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoods.java index 88b155a1d..fdab218c3 100644 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoods.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoods.java @@ -2,6 +2,7 @@ package org.broadinstitute.sting.gatk.walkers.genotyper; import net.sf.samtools.SAMRecord; import org.broadinstitute.sting.utils.*; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import static java.lang.Math.log10; import static java.lang.Math.pow; diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SSGenotypeCall.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SSGenotypeCall.java index 401c5fc3e..be6336c8d 100644 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SSGenotypeCall.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SSGenotypeCall.java @@ -225,7 +225,7 @@ public class SSGenotypeCall implements Genotype, ReadBacked, GenotypesBacked, Li */ public Variation toVariation() { double bestRef = Math.abs(mGenotypeLikelihoods.getPosterior(getBestGenotype()) - mGenotypeLikelihoods.getPosterior(getRefGenotype())); - return new BasicVariation(this.getBases(), this.getReference(), 0, this.mLocation, bestRef); + return new BasicVariation(this.getBases(), String.valueOf(this.getReference()), 0, this.mLocation, bestRef); } /** diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/CoverageEvalWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/CoverageEvalWalker.java index 255bcac00..905ee2a68 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/CoverageEvalWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/CoverageEvalWalker.java @@ -8,7 +8,7 @@ import org.broadinstitute.sting.gatk.refdata.RodGenotypeChipAsGFF; import org.broadinstitute.sting.gatk.walkers.LocusWalker; import org.broadinstitute.sting.gatk.walkers.genotyper.SSGenotypeCall; import org.broadinstitute.sting.gatk.walkers.genotyper.SingleSampleGenotyper; -import org.broadinstitute.sting.gatk.walkers.genotyper.DiploidGenotype; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import org.broadinstitute.sting.utils.BaseUtils; import org.broadinstitute.sting.utils.ListUtils; import org.broadinstitute.sting.utils.Utils; diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/HLAcaller/CallHLAWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/HLAcaller/CallHLAWalker.java index 844fff653..227e9e3a8 100644 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/HLAcaller/CallHLAWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/HLAcaller/CallHLAWalker.java @@ -16,6 +16,7 @@ import org.broadinstitute.sting.utils.BaseUtils; import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.Pair; import org.broadinstitute.sting.utils.ReadBackedPileup; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import org.broadinstitute.sting.utils.cmdLine.Argument; import java.io.BufferedReader; diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/BasicPoolVariantAnalysis.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/BasicPoolVariantAnalysis.java index 1fd77bd3d..ce1d4732b 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/BasicPoolVariantAnalysis.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/BasicPoolVariantAnalysis.java @@ -1,9 +1,9 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval; -import org.broadinstitute.sting.gatk.refdata.AllelicVariant; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; +import org.broadinstitute.sting.utils.genotype.Variation; import java.io.PrintStream; import java.util.List; @@ -53,6 +53,6 @@ public abstract class BasicPoolVariantAnalysis implements VariantAnalysis{ // no need to finalize data in general } - public abstract String update(AllelicVariant variant, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context); + public abstract String update(Variation variant, RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context); } diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/CallableBasesAnalysis.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/CallableBasesAnalysis.java index 5fd2acfba..aa6b7acdc 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/CallableBasesAnalysis.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/CallableBasesAnalysis.java @@ -2,7 +2,7 @@ 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.gatk.walkers.genotyper.DiploidGenotype; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import org.broadinstitute.sting.utils.genotype.VariantBackedByGenotype; import org.broadinstitute.sting.utils.genotype.Variation; import org.broadinstitute.sting.utils.genotype.Genotype; @@ -78,13 +78,8 @@ public class CallableBasesAnalysis extends BasicVariantAnalysis implements Genot discoverable_bases[i]++; if (!eval.isSNP() && genotype.getNegLog10PError() >= threshold) discoverable_bases[i]++; - if (genotype.getNegLog10PError() >= threshold) genotypable_bases[i]++; - - //System.out.printf("Updating %s SNP=%b, REF=%b VarConf=%f ConConf=%f where threshold=%f: discoverable = %d, genotypable = %d%n", - // eval.getLocation(), eval.isSNP(), eval.isReference(), eval.getVariationConfidence(), - // eval.getConsensusConfidence(), threshold, discoverable_bases[i], genotypable_bases[i]); } return null; diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/GenotypeConcordance.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/GenotypeConcordance.java index ed6d1c15a..c1331a6ef 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/GenotypeConcordance.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/GenotypeConcordance.java @@ -2,7 +2,7 @@ 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.gatk.walkers.genotyper.DiploidGenotype; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import org.broadinstitute.sting.utils.StingException; import org.broadinstitute.sting.utils.Utils; import org.broadinstitute.sting.utils.genotype.VariantBackedByGenotype; diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/PooledGenotypeConcordance.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/PooledGenotypeConcordance.java index 18d2bad20..c23d1de68 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/PooledGenotypeConcordance.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/PooledGenotypeConcordance.java @@ -1,13 +1,12 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; -import org.broadinstitute.sting.gatk.refdata.AllelicVariant; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; -import org.broadinstitute.sting.gatk.walkers.genotyper.DiploidGenotype; import org.broadinstitute.sting.utils.StingException; import org.broadinstitute.sting.utils.Utils; import org.broadinstitute.sting.utils.genotype.Variation; import org.broadinstitute.sting.utils.genotype.VariantBackedByGenotype; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import java.io.BufferedReader; import java.io.FileReader; diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/TransitionTranversionAnalysis.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/TransitionTranversionAnalysis.java index 004946854..1e3da6613 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/TransitionTranversionAnalysis.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/TransitionTranversionAnalysis.java @@ -27,21 +27,13 @@ public class TransitionTranversionAnalysis extends BasicVariantAnalysis implemen public String update(Variation eval, RefMetaDataTracker tracker, char ref, AlignmentContext context) { if (eval != null && eval.isSNP()) { - if (eval.getAlternateBases().length() != 2) { - throw new StingException("TransitionTranversionAnalysis works only with biallelic variants"); - } - - - char refBase = eval.getReference(); - char altBase = (eval.getAlternateBases().charAt(0) == refBase) ? eval.getAlternateBases().charAt(1) : eval.getAlternateBases().charAt(0); - - BaseUtils.BaseSubstitutionType subType = BaseUtils.SNPSubstitutionType(refBase, altBase); + char altBase = eval.getAlternativeBaseForSNP(); + BaseUtils.BaseSubstitutionType subType = BaseUtils.SNPSubstitutionType(ref, altBase); if (subType == BaseUtils.BaseSubstitutionType.TRANSITION) nTransitions++; else nTransversions++; } - return null; } 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 232b2521c..ae1fd211c 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,7 +2,7 @@ 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.gatk.walkers.genotyper.DiploidGenotype; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import org.broadinstitute.sting.utils.genotype.VariantBackedByGenotype; import org.broadinstitute.sting.utils.genotype.Variation; diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantDBCoverage.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantDBCoverage.java index ef35537d7..36ce49d51 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantDBCoverage.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantDBCoverage.java @@ -82,27 +82,11 @@ public class VariantDBCoverage extends BasicVariantAnalysis implements GenotypeA public int nSNPsAtIndels() { return nSNPsCalledAtIndels; } - public static int count = 0; public boolean discordantP(Variation dbSNP, Variation eval) { if (eval != null) { - char alt = (eval.isSNP()) ? eval.getAlternativeBaseForSNP() : eval.getReference(); - - if (dbSNP != null && dbSNP.isSNP()) { - - boolean val = !dbSNP.getAlternateBases().contains(String.valueOf(alt)); - - if (val) { - //System.err.print(eval.getLocation()); - //System.err.print(" eval.alt = " + alt); - //System.err.println(" dbsnp.bases = " + dbSNP.getAlternateBases()); - //System.err.println(val); - - //System.err.println(count); - } - //else System.err.println("not count == " + count++); - - return val; - } + char alt = (eval.isSNP()) ? eval.getAlternativeBaseForSNP() : eval.getReference().charAt(0); + if (dbSNP != null && dbSNP.isSNP()) + return !dbSNP.getAlternateBases().contains(String.valueOf(alt)); } return false; } @@ -136,7 +120,6 @@ public class VariantDBCoverage extends BasicVariantAnalysis implements GenotypeA return String.format("SNP-at-indel DBSNP=%s %s", dbsnp.getAlternateBases(), eval); } else { return null; - // return "Novel " + eval; } } else { return null; diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantEvalWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantEvalWalker.java index 20d3654d9..4feebb067 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantEvalWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantEvalWalker.java @@ -2,8 +2,8 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; -import org.broadinstitute.sting.gatk.refdata.*; import org.broadinstitute.sting.gatk.walkers.*; +import org.broadinstitute.sting.gatk.refdata.*; import org.broadinstitute.sting.utils.StingException; import org.broadinstitute.sting.utils.Utils; import org.broadinstitute.sting.utils.cmdLine.Argument; @@ -182,17 +182,8 @@ public class VariantEvalWalker extends RefWalker { // Iterate over each analysis, and update it Variation eval = (Variation)tracker.lookup("eval", null); - //if ( eval!=null ) System.out.printf("Eval: %f %d %b%n", eval.getVariationConfidence(), minDiscoveryQ, eval.getVariationConfidence() < minDiscoveryQ); - if ( eval != null ) { - // comment to disable variant filtering by confidence score - if ( evalContainsGenotypes ) { - // Genotyping - use best vs. next best lod - if ( eval.getNegLog10PError() < minConfidenceScore ) eval = null; - } else { - // Variation discovery - use best vs. reference lod - if ( Math.abs(eval.getNegLog10PError()) < minConfidenceScore ) eval = null; - } - } + if ( eval != null ) + if ( eval.getNegLog10PError() < minConfidenceScore ) eval = null; // update stats about all of the SNPs updateAnalysisSet(ALL_SNPS, eval, tracker, ref.getBase(), context); @@ -204,14 +195,14 @@ public class VariantEvalWalker extends RefWalker { updateAnalysisSet(noveltySet, eval, tracker, ref.getBase(), context); } - if ( eval instanceof SNPCallFromGenotypes ) { + // are we a population backed call? then update + if ( eval instanceof SNPCallFromGenotypes) { SNPCallFromGenotypes call = (SNPCallFromGenotypes)eval; int nVarGenotypes = call.nHetGenotypes() + call.nHomVarGenotypes(); //System.out.printf("%d variant genotypes at %s%n", nVarGenotypes, calls); final String s = nVarGenotypes == 1 ? SINGLETON_SNPS : TWOHIT_SNPS; updateAnalysisSet(s, eval, tracker, ref.getBase(), context); } - return 1; } diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantMatcher.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantMatcher.java index 14ef39fbe..c831bad37 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantMatcher.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/varianteval/VariantMatcher.java @@ -1,7 +1,6 @@ package org.broadinstitute.sting.playground.gatk.walkers.varianteval; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; -import org.broadinstitute.sting.gatk.refdata.AllelicVariant; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.utils.genotype.Variation; @@ -25,7 +24,7 @@ public class VariantMatcher extends BasicVariantAnalysis implements GenotypeAnal public String update(Variation eval, RefMetaDataTracker tracker, char ref, AlignmentContext context) { String r = null; - AllelicVariant db = (AllelicVariant)tracker.lookup(dbName, null); + Variation db = (Variation)tracker.lookup(dbName, null); if ( eval != null || db != null ) { String matchFlag = " "; diff --git a/java/src/org/broadinstitute/sting/utils/genotype/BasicGenotype.java b/java/src/org/broadinstitute/sting/utils/genotype/BasicGenotype.java index ac295533c..7630acd6a 100644 --- a/java/src/org/broadinstitute/sting/utils/genotype/BasicGenotype.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/BasicGenotype.java @@ -138,6 +138,6 @@ public class BasicGenotype implements Genotype { @Override public Variation toVariation() { if (!isVariant(this.mRef)) throw new IllegalStateException("this genotype is not a variant"); - return new BasicVariation(this.getBases(),mRef,this.getBases().length(),mLocation,mNetLog10PError); + return new BasicVariation(this.getBases(),String.valueOf(mRef),this.getBases().length(),mLocation,mNetLog10PError); } } diff --git a/java/src/org/broadinstitute/sting/utils/genotype/BasicVariation.java b/java/src/org/broadinstitute/sting/utils/genotype/BasicVariation.java index d258da444..917788749 100644 --- a/java/src/org/broadinstitute/sting/utils/genotype/BasicVariation.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/BasicVariation.java @@ -1,6 +1,5 @@ package org.broadinstitute.sting.utils.genotype; -import org.broadinstitute.sting.utils.Utils; import org.broadinstitute.sting.utils.GenomeLoc; /** @@ -14,7 +13,7 @@ import org.broadinstitute.sting.utils.GenomeLoc; public class BasicVariation implements Variation { protected final String mBases; - protected final char mRef; + protected final String mRef; protected final int mLength; protected final GenomeLoc mLocation; protected final double mConfidence; @@ -23,11 +22,11 @@ public class BasicVariation implements Variation { * the constructor * * @param bases the bases that this variant represents - * @param reference the reference base + * @param reference the reference bases * @param length are we a single base variant, or a indel/deletion? length is negitive for an indel, * positive for a indel, and 0 for a substitution */ - public BasicVariation(String bases, char reference, int length, GenomeLoc location, double confidence) { + public BasicVariation(String bases, String reference, int length, GenomeLoc location, double confidence) { mBases = bases; mRef = reference; mLength = length; @@ -49,7 +48,7 @@ public class BasicVariation implements Variation { @Override public boolean isSNP() { - if (mLength == 0 && Utils.dupString(mRef, 2).equals(mBases)) return true; + if (mLength == 0) return true; return false; } @@ -74,7 +73,7 @@ public class BasicVariation implements Variation { } @Override - public char getReference() { + public String getReference() { return (mRef); } @@ -85,8 +84,12 @@ public class BasicVariation implements Variation { @Override public boolean isReference() { - if (mLength == 0 && mBases.charAt(0) == mRef && mRef != mBases.charAt(1)) return true; - return false; + if (mLength != 0) return true; + int refIndex = 0; + for (char c : mBases.toCharArray()) { + if (mRef.charAt(refIndex) != c) return false; + } + return true; } /** @@ -108,10 +111,23 @@ public class BasicVariation implements Variation { @Override public char getAlternativeBaseForSNP() { if (!this.isSNP()) throw new IllegalStateException("we're not a SNP"); - if (getAlternateBases().charAt(0) == this.getReference()) + if (getAlternateBases().charAt(0) == this.getReference().charAt(0)) return getAlternateBases().charAt(1); return getAlternateBases().charAt(0); } + /** + * gets the reference base is the case of a SNP. Throws an IllegalStateException if we're not a SNP + * + * @return a char, representing the alternate base + */ + @Override + public char getReferenceForSNP() { + if (!this.isSNP()) throw new IllegalStateException("we're not a SNP"); + if (getAlternateBases().charAt(0) == this.getReference().charAt(0)) + return getAlternateBases().charAt(0); + return getAlternateBases().charAt(1); + } + } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidGenotype.java b/java/src/org/broadinstitute/sting/utils/genotype/DiploidGenotype.java similarity index 71% rename from java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidGenotype.java rename to java/src/org/broadinstitute/sting/utils/genotype/DiploidGenotype.java index 1a6764333..eb5b86ea5 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidGenotype.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/DiploidGenotype.java @@ -1,4 +1,4 @@ -package org.broadinstitute.sting.gatk.walkers.genotyper; +package org.broadinstitute.sting.utils.genotype; import org.broadinstitute.sting.utils.Utils; @@ -52,4 +52,13 @@ public enum DiploidGenotype { default: return true; } } + + /** + * create a diploid genotype, given a character to make into a hom genotype + * @param hom the character to turn into a hom genotype, i.e. if it is A, then returned will be AA + * @return the diploid genotype + */ + public static DiploidGenotype createGenotype(char hom) { + return DiploidGenotype.valueOf((String.valueOf(hom) + String.valueOf(hom)).toUpperCase()); + } } \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/utils/genotype/GenotypesBacked.java b/java/src/org/broadinstitute/sting/utils/genotype/GenotypesBacked.java index b511a781b..26be15549 100644 --- a/java/src/org/broadinstitute/sting/utils/genotype/GenotypesBacked.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/GenotypesBacked.java @@ -1,6 +1,6 @@ package org.broadinstitute.sting.utils.genotype; -import org.broadinstitute.sting.gatk.walkers.genotyper.DiploidGenotype; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; /** * @author aaron diff --git a/java/src/org/broadinstitute/sting/utils/genotype/LikelihoodObject.java b/java/src/org/broadinstitute/sting/utils/genotype/LikelihoodObject.java index 55b1ae52e..d9d7c3b3b 100755 --- a/java/src/org/broadinstitute/sting/utils/genotype/LikelihoodObject.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/LikelihoodObject.java @@ -57,11 +57,11 @@ public class LikelihoodObject { // possible types of likihoods to store public enum LIKELIHOOD_TYPE { - NEGITIVE_LOG, LOG, RAW; + NEGATIVE_LOG, LOG, RAW; } // our liklihood storage type - protected LIKELIHOOD_TYPE mLikelihoodType = LIKELIHOOD_TYPE.NEGITIVE_LOG; + protected LIKELIHOOD_TYPE mLikelihoodType = LIKELIHOOD_TYPE.NEGATIVE_LOG; // default the bestGenotype likelihoods to the allele AA protected GENOTYPE bestGenotype = GENOTYPE.AA; @@ -199,7 +199,7 @@ public class LikelihoodObject { double[] ft = toDoubleArray(); float[] db = new float[ft.length]; int index = 0; - if (this.mLikelihoodType == LIKELIHOOD_TYPE.NEGITIVE_LOG) { + if (this.mLikelihoodType == LIKELIHOOD_TYPE.NEGATIVE_LOG) { for (; index < ft.length; index++) { db[index] = ((float) ft[index] * -1.0f); } @@ -229,9 +229,9 @@ public class LikelihoodObject { public void validateScore(double score) { int x = 0; switch (mLikelihoodType) { - case NEGITIVE_LOG: + case NEGATIVE_LOG: if (score < 0) - throw new StingException("Likelikhood score of " + score + " is invalid, for NEGITIVE_LOG it must be greater than or equal to 0"); + throw new StingException("Likelikhood score of " + score + " is invalid, for NEGATIVE_LOG it must be greater than or equal to 0"); break; case LOG: if (score > 0) @@ -256,7 +256,7 @@ public class LikelihoodObject { return; if (mLikelihoodType == LIKELIHOOD_TYPE.RAW) { double mult = 1.0; - if (likelihood == LIKELIHOOD_TYPE.NEGITIVE_LOG) { + if (likelihood == LIKELIHOOD_TYPE.NEGATIVE_LOG) { mult = -1.0; } // one of us in log, the other negitive log, it doesn't matter which @@ -265,7 +265,7 @@ public class LikelihoodObject { } } else if (likelihood == LIKELIHOOD_TYPE.RAW) { double mult = 1.0; - if (mLikelihoodType == LIKELIHOOD_TYPE.NEGITIVE_LOG) { + if (mLikelihoodType == LIKELIHOOD_TYPE.NEGATIVE_LOG) { mult = -1.0; } // one of us in log, the other negitive log, it doesn't matter which diff --git a/java/src/org/broadinstitute/sting/utils/genotype/VariantBackedByGenotype.java b/java/src/org/broadinstitute/sting/utils/genotype/VariantBackedByGenotype.java index 964dc9521..dc3a41925 100644 --- a/java/src/org/broadinstitute/sting/utils/genotype/VariantBackedByGenotype.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/VariantBackedByGenotype.java @@ -1,6 +1,6 @@ package org.broadinstitute.sting.utils.genotype; -import org.broadinstitute.sting.gatk.walkers.genotyper.DiploidGenotype; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; /** * @author aaron @@ -12,7 +12,21 @@ import org.broadinstitute.sting.gatk.walkers.genotyper.DiploidGenotype; public interface VariantBackedByGenotype { /** * get the likelihoods + * + * @param x the genotype + * * @return an array in lexigraphical order of the likelihoods */ public Genotype getGenotype(DiploidGenotype x); + + + /** + * do we have the specified genotype? not all backedByGenotypes + * have all the genotype data. + * + * @param x the genotype + * + * @return true if available, false otherwise + */ + public boolean hasGenotype(DiploidGenotype x); } diff --git a/java/src/org/broadinstitute/sting/utils/genotype/Variation.java b/java/src/org/broadinstitute/sting/utils/genotype/Variation.java index 5954f661a..fdc8feaec 100644 --- a/java/src/org/broadinstitute/sting/utils/genotype/Variation.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/Variation.java @@ -58,7 +58,7 @@ public interface Variation { * * @return the reference base or bases, as a string */ - public char getReference(); + public String getReference(); /** * get the -1 * (log 10 of the error value) @@ -80,16 +80,22 @@ public interface Variation { public String getAlternateBases(); /** - * are we an insertion or a deletion? yes, then return true. No? Well, false it is. + * are we an insertion or a deletion? yes, then return true. No? Well, false then. * @return true if we're an insertion or deletion */ public boolean isIndel(); /** - * gets the alternate base is the case of a SNP. Throws an IllegalStateException in the case + * gets the alternate base is the case of a SNP. Throws an IllegalStateException if we're not a SNP * of * @return a char, representing the alternate base */ public char getAlternativeBaseForSNP(); + /** + * gets the reference base is the case of a SNP. Throws an IllegalStateException if we're not a SNP + * @return a char, representing the alternate base + */ + public char getReferenceForSNP(); + } diff --git a/java/src/org/broadinstitute/sting/utils/genotype/geli/GeliTextWriter.java b/java/src/org/broadinstitute/sting/utils/genotype/geli/GeliTextWriter.java index 6a516d253..eb562fda0 100644 --- a/java/src/org/broadinstitute/sting/utils/genotype/geli/GeliTextWriter.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/geli/GeliTextWriter.java @@ -1,6 +1,6 @@ package org.broadinstitute.sting.utils.genotype.geli; -import org.broadinstitute.sting.gatk.walkers.genotyper.DiploidGenotype; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import org.broadinstitute.sting.utils.StingException; import org.broadinstitute.sting.utils.Utils; import org.broadinstitute.sting.utils.genotype.*; diff --git a/java/src/org/broadinstitute/sting/utils/genotype/glf/GLFWriter.java b/java/src/org/broadinstitute/sting/utils/genotype/glf/GLFWriter.java index 893b54a27..4deee697b 100755 --- a/java/src/org/broadinstitute/sting/utils/genotype/glf/GLFWriter.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/glf/GLFWriter.java @@ -6,7 +6,6 @@ import net.sf.samtools.util.BinaryCodec; import net.sf.samtools.util.BlockCompressedOutputStream; import org.broadinstitute.sting.utils.MathUtils; import org.broadinstitute.sting.utils.GenomeLocParser; -import org.broadinstitute.sting.utils.ReadBackedPileup; import org.broadinstitute.sting.utils.genotype.*; import java.io.DataOutputStream; @@ -121,7 +120,7 @@ public class GLFWriter implements GenotypeWriter { Arrays.fill(values,-255.0); obj = new LikelihoodObject(values, LikelihoodObject.LIKELIHOOD_TYPE.LOG); } - obj.setLikelihoodType(LikelihoodObject.LIKELIHOOD_TYPE.NEGITIVE_LOG); // transform! ... to negitive log likelihoods + obj.setLikelihoodType(LikelihoodObject.LIKELIHOOD_TYPE.NEGATIVE_LOG); // transform! ... to negitive log likelihoods double rms = -1; // calculate the RMS mapping qualities and the read depth diff --git a/java/test/org/broadinstitute/sting/gatk/refdata/RodGLFTest.java b/java/test/org/broadinstitute/sting/gatk/refdata/RodGLFTest.java index 886ab7747..96beac7b3 100644 --- a/java/test/org/broadinstitute/sting/gatk/refdata/RodGLFTest.java +++ b/java/test/org/broadinstitute/sting/gatk/refdata/RodGLFTest.java @@ -184,7 +184,7 @@ public class RodGLFTest extends BaseTest { for (int x = 0; x < vals.size(); x++) { ret[x] = vals.get(x); } - return new LikelihoodObject(ret, LikelihoodObject.LIKELIHOOD_TYPE.NEGITIVE_LOG); + return new LikelihoodObject(ret, LikelihoodObject.LIKELIHOOD_TYPE.NEGATIVE_LOG); } diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsTest.java index 4131e5831..2f7207c22 100755 --- a/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsTest.java +++ b/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsTest.java @@ -1,15 +1,11 @@ package org.broadinstitute.sting.gatk.walkers.genotyper; -import org.broadinstitute.sting.utils.Utils; -import org.broadinstitute.sting.utils.MathUtils; +import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import org.broadinstitute.sting.BaseTest; -import org.broadinstitute.sting.gatk.walkers.recalibration.RecalData; -import org.junit.Before; import org.junit.Test; import org.junit.Assert; import static java.lang.Math.log10; -import static java.lang.Math.pow; public class GenotypeLikelihoodsTest extends BaseTest { private final static double DELTA = 1e-8; diff --git a/java/test/org/broadinstitute/sting/utils/genotype/DiploidGenotypeTest.java b/java/test/org/broadinstitute/sting/utils/genotype/DiploidGenotypeTest.java new file mode 100644 index 000000000..6297e6d5e --- /dev/null +++ b/java/test/org/broadinstitute/sting/utils/genotype/DiploidGenotypeTest.java @@ -0,0 +1,104 @@ +package org.broadinstitute.sting.utils.genotype; + +import org.broadinstitute.sting.BaseTest; +import org.junit.Assert; +import org.junit.Test; + + +/** + * + * @author aaron + * + * Class DiploidGenotypeTest + * + * Testing the basic functionality of the diploid genotype class + */ +public class DiploidGenotypeTest extends BaseTest { + + @Test + public void testCreateDiploidFromString() { + String genotype = "AA"; + DiploidGenotype g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(genotype.equals(g.toString())); + + genotype = "AC"; + g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(genotype.equals(g.toString())); + + genotype = "AG"; + g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(genotype.equals(g.toString())); + + genotype = "AT"; + g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(genotype.equals(g.toString())); + + genotype = "CC"; + g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(genotype.equals(g.toString())); + + genotype = "CG"; + g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(genotype.equals(g.toString())); + + genotype = "CT"; + g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(genotype.equals(g.toString())); + + genotype = "GG"; + g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(genotype.equals(g.toString())); + + genotype = "GT"; + g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(genotype.equals(g.toString())); + + genotype = "TT"; + g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(genotype.equals(g.toString())); + } + + @Test + public void testIsHet() { + String genotype = "AG"; + DiploidGenotype g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(g.isHet()); + + genotype = "AA"; + g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(!g.isHet()); + } + + @Test + public void testIsHom() { + String genotype = "AA"; + DiploidGenotype g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(g.isHom()); + + genotype = "AG"; + g = DiploidGenotype.valueOf(genotype); + Assert.assertTrue(!g.isHom()); + } + + @Test + public void testCreateGenotype() { + char ref = 'A'; + DiploidGenotype g = DiploidGenotype.createGenotype(ref); + Assert.assertTrue("AA".equals(g.toString())); + + ref = 'a'; + g = DiploidGenotype.createGenotype(ref); + Assert.assertTrue("AA".equals(g.toString())); + + ref = 't'; + g = DiploidGenotype.createGenotype(ref); + Assert.assertTrue("TT".equals(g.toString())); + + ref = 'T'; + g = DiploidGenotype.createGenotype(ref); + Assert.assertTrue("TT".equals(g.toString())); + + } + + +} diff --git a/java/test/org/broadinstitute/sting/utils/genotype/LikelihoodObjectTest.java b/java/test/org/broadinstitute/sting/utils/genotype/LikelihoodObjectTest.java index 97ae2fcff..a05d32bf7 100755 --- a/java/test/org/broadinstitute/sting/utils/genotype/LikelihoodObjectTest.java +++ b/java/test/org/broadinstitute/sting/utils/genotype/LikelihoodObjectTest.java @@ -61,7 +61,7 @@ public class LikelihoodObjectTest extends BaseTest { for (int x = 0; x < 10; x++) { ray[x] = ( x * 25 ); } - mLO = new LikelihoodObject(ray,LikelihoodObject.LIKELIHOOD_TYPE.NEGITIVE_LOG); + mLO = new LikelihoodObject(ray,LikelihoodObject.LIKELIHOOD_TYPE.NEGATIVE_LOG); assertTrue(mLO.likelihoods.size() == LikelihoodObject.GENOTYPE.values().length); int index = 0; @@ -77,7 +77,7 @@ public class LikelihoodObjectTest extends BaseTest { for (int x = 0; x < 10; x++) { ray[x] = ( x * 25.0 ); } - mLO = new LikelihoodObject(ray,LikelihoodObject.LIKELIHOOD_TYPE.NEGITIVE_LOG); + mLO = new LikelihoodObject(ray,LikelihoodObject.LIKELIHOOD_TYPE.NEGATIVE_LOG); assertTrue(mLO.likelihoods.size() == LikelihoodObject.GENOTYPE.values().length); int index = 0; @@ -104,7 +104,7 @@ public class LikelihoodObjectTest extends BaseTest { ray[x] = ( 240.0 ); } ray [5] = 0; - mLO = new LikelihoodObject(ray, LikelihoodObject.LIKELIHOOD_TYPE.NEGITIVE_LOG); + mLO = new LikelihoodObject(ray, LikelihoodObject.LIKELIHOOD_TYPE.NEGATIVE_LOG); assertTrue(mLO.likelihoods.size() == LikelihoodObject.GENOTYPE.values().length); short smallest = (short)mLO.getBestLikelihood(); assertTrue(smallest == 0);