diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/rodDbSNP.java b/java/src/org/broadinstitute/sting/gatk/refdata/rodDbSNP.java index 5d2250b93..c74ff0335 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/rodDbSNP.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/rodDbSNP.java @@ -386,4 +386,19 @@ public class rodDbSNP extends BasicReferenceOrderedDatum implements Variation, V public boolean hasGenotype(DiploidGenotype x) { return (!x.toString().equals(this.getAltBasesFWD())) ? false : true; } + + public static rodDbSNP getFirstRealSNP(RODRecordList dbsnpList) { + if ( dbsnpList == null ) + return null; + + rodDbSNP dbsnp = null; + for ( ReferenceOrderedDatum d : dbsnpList ) { + if ( ((rodDbSNP)d).isSNP() ) { + dbsnp = (rodDbSNP)d; + break; + } + } + + return dbsnp; + } } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/CovariateCounterWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/CovariateCounterWalker.java index c488a5220..25bb01748 100644 --- a/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/CovariateCounterWalker.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/CovariateCounterWalker.java @@ -77,11 +77,6 @@ public class CovariateCounterWalker extends LocusWalker { } covariateCounter = new CovariateCounter(readGroups, collapsePos, collapseDinuc, assumeFaultyHeader); - // THIS IS A HACK required in order to reproduce the behavior of old (and imperfect) RODIterator and - // hence to pass the integration test. The new iterator this code is now using does see ALL the SNPs, - // whether masked by overlapping indels/other events or not. - //TODO process correctly all the returned dbSNP rods at each location - BrokenRODSimulator.attach("dbSNP"); logger.info(String.format("Created recalibration data collectors for %d read group(s)", covariateCounter.getNReadGroups())); } @@ -102,7 +97,8 @@ public class CovariateCounterWalker extends LocusWalker { */ public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context) { - rodDbSNP dbsnp = (rodDbSNP)BrokenRODSimulator.simulate_lookup("dbSNP",ref.getLocus(),tracker); + rodDbSNP dbsnp = rodDbSNP.getFirstRealSNP(tracker.getTrackData("dbsnp", null)); + // long testpos = 10410913 ; // if ( ref.getLocus().getStart() == testpos ) { // System.out.println(rods.size()+" rods:"); @@ -110,9 +106,7 @@ public class CovariateCounterWalker extends LocusWalker { // System.exit(1); // } - - - if ( dbsnp == null || !dbsnp.isSNP() ) { + if ( dbsnp == null ) { // We aren't at a dbSNP position that's a SNP, so update the read // if ( ref.getLocus().getStart() == testpos) System.out.println("NOT A SNP INDEED");