From c871a0f221118857c0599c9ccff04d93a9c7c7a4 Mon Sep 17 00:00:00 2001 From: depristo Date: Fri, 22 Jan 2010 23:06:43 +0000 Subject: [PATCH] UG map() now returns a VariantCallContext object. Also has a field for confidentlyCalledBases. UG reduce() emits statistics on the confident called % of bases git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2664 348d0f76-0448-11de-a6fe-93d51630548a --- .../genotyper/EMGenotypeCalculationModel.java | 6 +- .../genotyper/GenotypeCalculationModel.java | 21 ++--- ...JointEstimateGenotypeCalculationModel.java | 16 ++-- ...PointEstimateGenotypeCalculationModel.java | 8 +- .../walkers/genotyper/UnifiedGenotyper.java | 81 ++++++++++++++----- .../walkers/genotyper/VariantCallContext.java | 32 ++++++++ ...seTransitionTableCalculatorJavaWalker.java | 6 +- .../gatk/walkers/DeNovoSNPWalker.java | 11 +-- .../gatk/walkers/LocusMismatchWalker.java | 6 +- .../walkers/SnpCallRateByCoverageWalker.java | 7 +- .../FindContaminatingReadGroupsWalker.java | 7 +- .../SecondaryBaseTransitionTableWalker.java | 7 +- 12 files changed, 137 insertions(+), 71 deletions(-) create mode 100755 java/src/org/broadinstitute/sting/gatk/walkers/genotyper/VariantCallContext.java diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/EMGenotypeCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/EMGenotypeCalculationModel.java index d2ad127b2..a374a7d45 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/EMGenotypeCalculationModel.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/EMGenotypeCalculationModel.java @@ -19,7 +19,7 @@ public abstract class EMGenotypeCalculationModel extends GenotypeCalculationMode protected EMGenotypeCalculationModel() {} - public Pair> calculateGenotype(RefMetaDataTracker tracker, char ref, GenomeLoc loc, Map contexts, DiploidGenotypePriors priors) { + public VariantCallContext callLocus(RefMetaDataTracker tracker, char ref, GenomeLoc loc, Map contexts, DiploidGenotypePriors priors) { // run the EM calculation EMOutput overall = runEM(ref, contexts, priors, StratifiedAlignmentContext.StratifiedContextType.COMPLETE); @@ -40,7 +40,7 @@ public abstract class EMGenotypeCalculationModel extends GenotypeCalculationMode // are we above the lod threshold for emitting calls (and not in all-bases mode)? if ( !ALL_BASE_MODE && ((!GENOTYPE_MODE && bestIsRef) || phredScaledConfidence < CONFIDENCE_THRESHOLD) ) - return new Pair>(null, null); + return new VariantCallContext(phredScaledConfidence >= CONFIDENCE_THRESHOLD); // generate the calls List calls = genotypeCallsFromGenotypeLikelihoods(overall, ref, contexts); @@ -81,7 +81,7 @@ public abstract class EMGenotypeCalculationModel extends GenotypeCalculationMode for ( Genotype call : calls ) ((GenotypeCall)call).setVariation(locusdata); } - return new Pair>(locusdata, calls); + return new VariantCallContext(locusdata, calls, phredScaledConfidence >= CONFIDENCE_THRESHOLD); } protected List genotypeCallsFromGenotypeLikelihoods(EMOutput results, char ref, Map contexts) { diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeCalculationModel.java index 13c10bc73..2e352c79f 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeCalculationModel.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeCalculationModel.java @@ -85,11 +85,11 @@ public abstract class GenotypeCalculationModel implements Cloneable { * * @return calls */ - public abstract Pair> calculateGenotype(RefMetaDataTracker tracker, - char ref, - GenomeLoc loc, - Map stratifiedContexts, - DiploidGenotypePriors priors); + public abstract VariantCallContext callLocus(RefMetaDataTracker tracker, + char ref, + GenomeLoc loc, + Map stratifiedContexts, + DiploidGenotypePriors priors); /** * @param tracker rod data @@ -99,15 +99,4 @@ public abstract class GenotypeCalculationModel implements Cloneable { public static rodDbSNP getDbSNP(RefMetaDataTracker tracker) { return rodDbSNP.getFirstRealSNP(tracker.getTrackData("dbsnp", null)); } - - /** - * Determine whether we're at a Hapmap site - * - * @param tracker the meta data tracker - * - * @return true if we're at a Hapmap site, false if otherwise - */ - private static boolean isHapmapSite(RefMetaDataTracker tracker) { - return tracker.getTrackData("hapmap", null) != null; - } } \ No newline at end of file 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 80d8fd159..5a7793e95 100644 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/JointEstimateGenotypeCalculationModel.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/JointEstimateGenotypeCalculationModel.java @@ -39,8 +39,7 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc protected JointEstimateGenotypeCalculationModel() {} - public Pair> calculateGenotype(RefMetaDataTracker tracker, char ref, GenomeLoc loc, Map contexts, DiploidGenotypePriors priors) { - + public VariantCallContext callLocus(RefMetaDataTracker tracker, char ref, GenomeLoc loc, Map contexts, DiploidGenotypePriors priors) { int numSamples = getNSamples(contexts); int frequencyEstimationPoints = (2 * numSamples) + 1; // (add 1 for allele frequency of zero) @@ -50,8 +49,11 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc // if there are no non-ref bases... if ( bestAlternateAllele == null ) { // if we don't want all bases, then we can just return - if ( !ALL_BASE_MODE && !GENOTYPE_MODE ) - return new Pair>(null, null); + + // todo -- we still need to calculate the confidence in the reference base. + // todo -- we can still include this optimization, but we should calculate a confidence score +// if ( !ALL_BASE_MODE && !GENOTYPE_MODE ) +// return new VariantCallContext(false); // otherwise, choose any alternate allele (it doesn't really matter) bestAlternateAllele = (ref != 'A' ? 'A' : 'C'); @@ -282,7 +284,7 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc return new ArrayList(); } - protected Pair> createCalls(RefMetaDataTracker tracker, char ref, Map contexts, GenomeLoc loc, int frequencyEstimationPoints) { + protected VariantCallContext createCalls(RefMetaDataTracker tracker, char ref, Map contexts, GenomeLoc loc, int frequencyEstimationPoints) { // only need to look at the most likely alternate allele int indexOfMax = BaseUtils.simpleBaseToBaseIndex(bestAlternateAllele); @@ -304,7 +306,7 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc // return a null call if we don't pass the confidence cutoff or the most likely allele frequency is zero if ( !ALL_BASE_MODE && ((!GENOTYPE_MODE && bestAFguess == 0) || phredScaledConfidence < CONFIDENCE_THRESHOLD) ) - return new Pair>(null, null); + return new VariantCallContext(phredScaledConfidence >= CONFIDENCE_THRESHOLD); // output to beagle file if requested if ( beagleWriter != null ) { @@ -380,6 +382,6 @@ public abstract class JointEstimateGenotypeCalculationModel extends GenotypeCalc ((GenotypeCall)call).setVariation(locusdata); } - return new Pair>(locusdata, calls); + return new VariantCallContext(locusdata, calls, phredScaledConfidence >= CONFIDENCE_THRESHOLD); } } \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PointEstimateGenotypeCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PointEstimateGenotypeCalculationModel.java index b403ce733..ad9fcb917 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PointEstimateGenotypeCalculationModel.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/PointEstimateGenotypeCalculationModel.java @@ -26,7 +26,7 @@ public class PointEstimateGenotypeCalculationModel extends EMGenotypeCalculation // overload this method so we can special-case the single sample - public Pair> calculateGenotype(RefMetaDataTracker tracker, char ref, GenomeLoc loc, Map contexts, DiploidGenotypePriors priors) { + public VariantCallContext callLocus(RefMetaDataTracker tracker, char ref, GenomeLoc loc, Map contexts, DiploidGenotypePriors priors) { // we don't actually want to run EM for single samples if ( samples.size() == 1 ) { @@ -63,7 +63,7 @@ public class PointEstimateGenotypeCalculationModel extends EMGenotypeCalculation // are we above the lod threshold for emitting calls (and not in all-bases mode)? if ( !ALL_BASE_MODE && ((!GENOTYPE_MODE && bestIsRef) || phredScaledConfidence < CONFIDENCE_THRESHOLD) ) - return new Pair>(null, null); + return new VariantCallContext(phredScaledConfidence >= CONFIDENCE_THRESHOLD); // we can now create the genotype call object GenotypeCall call = GenotypeWriterFactory.createSupportedGenotypeCall(OUTPUT_FORMAT, ref, loc); @@ -104,10 +104,10 @@ public class PointEstimateGenotypeCalculationModel extends EMGenotypeCalculation call.setVariation(locusdata); - return new Pair>(locusdata, Arrays.asList((Genotype)call)); + return new VariantCallContext(locusdata, Arrays.asList((Genotype)call), phredScaledConfidence >= CONFIDENCE_THRESHOLD); } - return super.calculateGenotype(tracker, ref, loc, contexts, priors); + return super.callLocus(tracker, ref, loc, contexts, priors); } private Pair getSingleSampleLikelihoods(StratifiedAlignmentContext sampleContext, DiploidGenotypePriors priors, StratifiedAlignmentContext.StratifiedContextType contextType) { diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java index 7fe501b68..0ec370edc 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java @@ -47,8 +47,7 @@ import java.io.PrintStream; * multi-sample, and pooled data. The user can choose from several different incorporated calculation models. */ @Reference(window=@Window(start=-20,stop=20)) -public class UnifiedGenotyper extends LocusWalker>, Integer> implements TreeReducible { - +public class UnifiedGenotyper extends LocusWalker implements TreeReducible { @ArgumentCollection private UnifiedArgumentCollection UAC = new UnifiedArgumentCollection(); // control the output @@ -67,10 +66,27 @@ public class UnifiedGenotyper extends LocusWalker samples = new HashSet(); - /** Enable deletions in the pileup **/ public boolean includeReadsWithDeletionAtLoci() { return true; } + /** + * Inner class for collecting output statistics from the UG + */ + public class UGStatistics { + /** The total number of passes examined -- i.e., the number of map calls */ + long nBasesVisited = 0; + + /** The number of bases that were potentially callable -- i.e., those not at excessive coverage or masked with N */ + long nBasesCallable = 0; + + /** The number of bases called confidently (according to user threshold), either ref or other */ + long nBasesCalledConfidently = 0; + + double percentCallableOfAll() { return (100.0 * nBasesCallable) / nBasesVisited; } + double percentCalledOfAll() { return (100.0 * nBasesCalledConfidently) / nBasesVisited; } + double percentCalledOfCallable() { return (100.0 * nBasesCalledConfidently) / nBasesCallable; } + } + /** * Sets the argument collection for the UnifiedGenotyper. * To be used with walkers that call the UnifiedGenotyper's map function @@ -204,7 +220,7 @@ public class UnifiedGenotyper extends LocusWalker> map(RefMetaDataTracker tracker, ReferenceContext refContext, AlignmentContext rawContext) { + public VariantCallContext map(RefMetaDataTracker tracker, ReferenceContext refContext, AlignmentContext rawContext) { // initialize the GenotypeCalculationModel for this thread if that hasn't been done yet if ( gcm.get() == null ) { @@ -249,19 +265,19 @@ public class UnifiedGenotyper extends LocusWalker> call = gcm.get().calculateGenotype(tracker, ref, rawContext.getLocation(), stratifiedContexts, priors); + VariantCallContext call = gcm.get().callLocus(tracker, ref, rawContext.getLocation(), stratifiedContexts, priors); // annotate the call, if possible - if ( call != null && call.first != null && call.first instanceof ArbitraryFieldsBacked ) { + if ( call != null && call.variation != null && call.variation instanceof ArbitraryFieldsBacked ) { // first off, we want to use the *unfiltered* context for the annotations stratifiedContexts = StratifiedAlignmentContext.splitContextBySample(rawContext.getBasePileup()); Map annotations; if ( UAC.ALL_ANNOTATIONS ) - annotations = VariantAnnotator.getAllAnnotations(tracker, refContext, stratifiedContexts, call.first); + annotations = VariantAnnotator.getAllAnnotations(tracker, refContext, stratifiedContexts, call.variation); else - annotations = VariantAnnotator.getAnnotations(tracker, refContext, stratifiedContexts, call.first); - ((ArbitraryFieldsBacked)call.first).setFields(annotations); + annotations = VariantAnnotator.getAnnotations(tracker, refContext, stratifiedContexts, call.variation); + ((ArbitraryFieldsBacked)call.variation).setFields(annotations); } return call; @@ -284,38 +300,61 @@ public class UnifiedGenotyper extends LocusWalker= 0.0 && d <= 1.0 ); } - public Integer reduceInit() { return 0; } + // ------------------------------------------------------------------------------------------------ + // + // Reduce + // + // ------------------------------------------------------------------------------------------------ + public UGStatistics reduceInit() { return new UGStatistics(); } - public Integer treeReduce(Integer lhs, Integer rhs) { - return lhs + rhs; + public UGStatistics treeReduce(UGStatistics lhs, UGStatistics rhs) { + lhs.nBasesCallable += rhs.nBasesCallable; + lhs.nBasesCalledConfidently += rhs.nBasesCalledConfidently; + lhs.nBasesVisited += rhs.nBasesVisited; + return lhs; } - public Integer reduce(Pair> value, Integer sum) { + public UGStatistics reduce(VariantCallContext value, UGStatistics sum) { + // We get a point for reaching reduce :-) + sum.nBasesVisited++; + // can't call the locus because of no coverage if ( value == null ) return sum; + // A call was attempted -- the base was potentially callable + sum.nBasesCallable++; + + // if the base was confidently called something, print it out + sum.nBasesCalledConfidently += value.confidentlyCalled ? 1 : 0; + // can't make a confident variant call here - if ( value.second == null || - (UAC.genotypeModel != GenotypeCalculationModel.Model.POOLED && value.second.size() == 0) ) { + if ( value.genotypes == null || + (UAC.genotypeModel != GenotypeCalculationModel.Model.POOLED && value.genotypes.size() == 0) ) { return sum; } // if we have a single-sample call (single sample from PointEstimate model returns no VariationCall data) - if ( value.first == null || (!writer.supportsMultiSample() && samples.size() <= 1) ) { - writer.addGenotypeCall(value.second.get(0)); + if ( value.variation == null || (!writer.supportsMultiSample() && samples.size() <= 1) ) { + writer.addGenotypeCall(value.genotypes.get(0)); } // use multi-sample mode if we have multiple samples or the output type allows it else { - writer.addMultiSampleCall(value.second, value.first); + writer.addMultiSampleCall(value.genotypes, value.variation); } - return sum + 1; + return sum; } // Close any file writers - public void onTraversalDone(Integer sum) { - logger.info("Processed " + sum + " loci that are callable for SNPs"); + public void onTraversalDone(UGStatistics sum) { + logger.info(String.format("Visited bases %d", sum.nBasesVisited)); + logger.info(String.format("Callable bases %d", sum.nBasesCallable)); + logger.info(String.format("Confidently called bases %d", sum.nBasesCalledConfidently)); + logger.info(String.format("%% callable bases of all loci %3.3f", sum.percentCallableOfAll())); + logger.info(String.format("%% confidently called bases of all loci %3.3f", sum.percentCalledOfAll())); + logger.info(String.format("%% confidently called bases of callable loci %3.3f", sum.percentCalledOfCallable())); +// logger.info("Processed " + sum.nBasesCallable + " loci that are callable for SNPs"); } } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/VariantCallContext.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/VariantCallContext.java new file mode 100755 index 000000000..04a97e135 --- /dev/null +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/VariantCallContext.java @@ -0,0 +1,32 @@ +package org.broadinstitute.sting.gatk.walkers.genotyper; +import org.broadinstitute.sting.utils.genotype.VariationCall; +import org.broadinstitute.sting.utils.genotype.Genotype; + +import java.util.List; + +/** + * Created by IntelliJ IDEA. + * User: depristo + * Date: Jan 22, 2010 + * Time: 2:25:19 PM + * + * Useful helper class to communicate the results of calculateGenotype to framework + */ +public class VariantCallContext { + public VariationCall variation = null; + public List genotypes = null; + + /** Was the site called confidently, either reference or variant? */ + public boolean confidentlyCalled = false; + + VariantCallContext(VariationCall variation, List genotypes, boolean confidentlyCalledP) { + this.variation = variation; + this.genotypes = genotypes; + this.confidentlyCalled = confidentlyCalledP; + } + + /** blank variation and genotypes => we're a ref site */ + VariantCallContext(boolean confidentlyCalledP) { + this.confidentlyCalled = confidentlyCalledP; + } +} \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/BaseTransitionTableCalculatorJavaWalker.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/BaseTransitionTableCalculatorJavaWalker.java index 73fef1581..5838009f5 100644 --- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/BaseTransitionTableCalculatorJavaWalker.java +++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/BaseTransitionTableCalculatorJavaWalker.java @@ -361,10 +361,10 @@ public class BaseTransitionTableCalculatorJavaWalker extends LocusWalker> calls = ug.map(tracker,ref,context); - if ( calls == null || calls.second == null) + VariantCallContext calls = ug.map(tracker,ref,context); + if ( calls == null || calls.genotypes == null) return false; - return ( calls.second.size() > 0 && !calls.second.get(0).isVariant(ref.getBase()) && calls.second.get(0).getNegLog10PError() > confidentRefThreshold ); + return ( calls.genotypes.size() > 0 && !calls.genotypes.get(0).isVariant(ref.getBase()) && calls.genotypes.get(0).getNegLog10PError() > confidentRefThreshold ); } diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/DeNovoSNPWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/DeNovoSNPWalker.java index 49f0c3a53..7b27e6a2a 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/DeNovoSNPWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/DeNovoSNPWalker.java @@ -8,6 +8,7 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.VariationRod; import org.broadinstitute.sting.gatk.walkers.*; import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedGenotyper; +import org.broadinstitute.sting.gatk.walkers.genotyper.VariantCallContext; import org.broadinstitute.sting.utils.genotype.*; import org.broadinstitute.sting.utils.Pair; @@ -73,14 +74,14 @@ public class DeNovoSNPWalker extends RefWalker{ } AlignmentContext parent1_subContext = new AlignmentContext(context.getLocation(), parent1_reads, parent1_offsets); - Pair> parent1 = UG.map(tracker, ref, parent1_subContext); + VariantCallContext parent1 = UG.map(tracker, ref, parent1_subContext); AlignmentContext parent2_subContext = new AlignmentContext(context.getLocation(), parent2_reads, parent2_offsets); - Pair> parent2 = UG.map(tracker, ref, parent2_subContext); + VariantCallContext parent2 = UG.map(tracker, ref, parent2_subContext); - if ( parent1 != null && parent1.second != null && parent2 != null && parent2.second != null ) { - Genotype parent1call = parent1.second.get(0); - Genotype parent2call = parent2.second.get(0); + if ( parent1 != null && parent1.genotypes != null && parent2 != null && parent2.genotypes != null ) { + Genotype parent1call = parent1.genotypes.get(0); + Genotype parent2call = parent2.genotypes.get(0); if (!parent1call.isVariant(parent1call.getReference()) && parent1call.getNegLog10PError() > 5 && diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/LocusMismatchWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/LocusMismatchWalker.java index 8837bace0..082261db7 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/LocusMismatchWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/LocusMismatchWalker.java @@ -165,11 +165,11 @@ public class LocusMismatchWalker extends LocusWalker implements } private Genotype getGenotype( RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context ) { - Pair> calls = ug.map(tracker,ref,context); - if ( calls == null || calls.first == null || calls.second == null ) + VariantCallContext calls = ug.map(tracker,ref,context); + if ( calls == null || calls.variation == null || calls.genotypes == null ) return null; else { - return calls.second.get(0); + return calls.genotypes.get(0); } } diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/SnpCallRateByCoverageWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/SnpCallRateByCoverageWalker.java index fdda3df4a..2afe1907a 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/SnpCallRateByCoverageWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/SnpCallRateByCoverageWalker.java @@ -7,6 +7,7 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.refdata.RodGenotypeChipAsGFF; import org.broadinstitute.sting.gatk.walkers.LocusWalker; import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedGenotyper; +import org.broadinstitute.sting.gatk.walkers.genotyper.VariantCallContext; import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import org.broadinstitute.sting.utils.BaseUtils; import org.broadinstitute.sting.utils.ListUtils; @@ -77,9 +78,9 @@ public class SnpCallRateByCoverageWalker extends LocusWalker, Strin List sub_offsets = ListUtils.sliceListByIndices(subset_indices, offsets); AlignmentContext subContext = new AlignmentContext(context.getLocation(), sub_reads, sub_offsets); - Pair> calls = UG.map(tracker, ref, subContext); - if (calls != null && calls.second != null && calls.second.size() > 0) { - Genotype call = calls.second.get(0); + VariantCallContext calls = UG.map(tracker, ref, subContext); + if (calls != null && calls.genotypes != null && calls.genotypes.size() > 0) { + Genotype call = calls.genotypes.get(0); String callType = (call.isVariant(call.getReference())) ? ((call.isHom()) ? "HomozygousSNP" : "HeterozygousSNP") : "HomozygousReference"; GenotypeCalls.add(coverage+"\t"+coverage_available+"\t"+hc_genotype+"\t"+callType+"\t"+toGeliString(call)); } diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/contamination/FindContaminatingReadGroupsWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/contamination/FindContaminatingReadGroupsWalker.java index 532ff7abd..ac5632f59 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/contamination/FindContaminatingReadGroupsWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/contamination/FindContaminatingReadGroupsWalker.java @@ -4,6 +4,7 @@ import org.broadinstitute.sting.gatk.walkers.LocusWalker; import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedGenotyper; import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedArgumentCollection; import org.broadinstitute.sting.gatk.walkers.genotyper.GenotypeCalculationModel; +import org.broadinstitute.sting.gatk.walkers.genotyper.VariantCallContext; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; @@ -80,10 +81,10 @@ public class FindContaminatingReadGroupsWalker extends LocusWalker 0.70) { - Pair> ugResult = ug.map(tracker, ref, context); + VariantCallContext ugResult = ug.map(tracker, ref, context); - if (ugResult != null && ugResult.second != null && ugResult.second.size() > 0) { - return ugResult.second.get(0).isHet(); + if (ugResult != null && ugResult.genotypes != null && ugResult.genotypes.size() > 0) { + return ugResult.genotypes.get(0).isHet(); } } diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/secondaryBases/SecondaryBaseTransitionTableWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/secondaryBases/SecondaryBaseTransitionTableWalker.java index 884484a3f..c33421c87 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/secondaryBases/SecondaryBaseTransitionTableWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/secondaryBases/SecondaryBaseTransitionTableWalker.java @@ -7,6 +7,7 @@ import org.broadinstitute.sting.gatk.walkers.*; import org.broadinstitute.sting.gatk.walkers.genotyper.GenotypeCalculationModel; import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedArgumentCollection; import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedGenotyper; +import org.broadinstitute.sting.gatk.walkers.genotyper.VariantCallContext; import org.broadinstitute.sting.playground.utils.NamedTable; import org.broadinstitute.sting.utils.BaseUtils; import org.broadinstitute.sting.utils.Pair; @@ -57,9 +58,9 @@ public class SecondaryBaseTransitionTableWalker extends LocusWalker> ugResult = ug.map(tracker,ref,context); - if (ugResult != null && ugResult.first != null) { - Genotype res = ugResult.second.get(0); + VariantCallContext ugResult = ug.map(tracker,ref,context); + if (ugResult != null && ugResult.variation != null) { + Genotype res = ugResult.genotypes.get(0); String call = res.getBases(); String type; if (!res.isVariant(refBase)) {type = "homref";}