Added code to extend Matt's getReferenceBases out to the read walkers, so they can see the corresponding reference for each read.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@652 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
4ce3feba4d
commit
e8b8ab5985
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue