diff --git a/java/src/org/broadinstitute/sting/gatk/dataSources/providers/ShardDataProvider.java b/java/src/org/broadinstitute/sting/gatk/dataSources/providers/ShardDataProvider.java index 2c1b4d755..d913c04c3 100755 --- a/java/src/org/broadinstitute/sting/gatk/dataSources/providers/ShardDataProvider.java +++ b/java/src/org/broadinstitute/sting/gatk/dataSources/providers/ShardDataProvider.java @@ -7,6 +7,7 @@ import org.broadinstitute.sting.gatk.dataSources.simpleDataSources.SAMDataSource import org.broadinstitute.sting.gatk.LocusContext; import org.broadinstitute.sting.utils.fasta.IndexedFastaSequenceFile; import org.broadinstitute.sting.utils.GenomeLoc; +import net.sf.samtools.SAMRecord; /** * User: hanna * Date: May 8, 2009 @@ -107,6 +108,15 @@ public class ShardDataProvider { return referenceProvider.getReferenceBase(genomeLoc); } + /** + * Gets the reference base associated with this particular point on the genome. + * @param read the read to fetch the reference sequence for + * @return a char string of bases representing the reference sequence corresponding to passed in read + */ + public char[] getReferenceForRead( SAMRecord read ) { + return referenceProvider.getReferenceBases(read); + } + /** * Create a data provider for the shard given the reads and reference. * @param shard The chunk of data over which traversals happen. diff --git a/java/src/org/broadinstitute/sting/gatk/traversals/TraverseReads.java b/java/src/org/broadinstitute/sting/gatk/traversals/TraverseReads.java index 83d1b95a4..13cabb476 100755 --- a/java/src/org/broadinstitute/sting/gatk/traversals/TraverseReads.java +++ b/java/src/org/broadinstitute/sting/gatk/traversals/TraverseReads.java @@ -95,21 +95,23 @@ public class TraverseReads extends TraversalEngine { // our locus context LocusContext locus = null; + // an array of characters that represent the reference + char[] refSeq = null; + if (read.getReferenceIndex() >= 0) { // get the genome loc from the read GenomeLoc site = new GenomeLoc(read); // Jump forward in the reference to this locus location locus = new LocusContext(site, Arrays.asList(read), Arrays.asList(0)); + + // get the array of characters for the reference sequence, since we're a mapped read + refSeq = dataProvider.getReferenceForRead( read ); } // update the number of reads we've seen TraversalStatistics.nRecords++; - - // we still have to fix the locus context provider to take care of this problem with > 1 length contexts - // LocusContext locus = locusProvider.getLocusContext(site); - final boolean keepMeP = readWalker.filter(locus, read); if (keepMeP) { M x = readWalker.map(locus, read); @@ -118,7 +120,6 @@ public class TraverseReads extends TraversalEngine { if (locus != null) { printProgress("loci", locus.getLocation()); } } - //System.err.println(TraversalStatistics.nRecords); return sum; }