Added REFERENCE_BASES required annotation for performance

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1047 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2009-06-18 21:03:57 +00:00
parent 03fe166994
commit 3c40db260d
8 changed files with 13 additions and 7 deletions

View File

@ -3,6 +3,7 @@ package org.broadinstitute.sting.gatk.traversals;
import net.sf.samtools.SAMRecord;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.gatk.LocusContext;
import org.broadinstitute.sting.gatk.WalkerManager;
import org.broadinstitute.sting.gatk.datasources.providers.ShardDataProvider;
import org.broadinstitute.sting.gatk.datasources.providers.ReadView;
import org.broadinstitute.sting.gatk.datasources.providers.ReadReferenceView;
@ -13,6 +14,7 @@ import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedData;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
import org.broadinstitute.sting.gatk.walkers.Walker;
import org.broadinstitute.sting.gatk.walkers.DataSource;
import org.broadinstitute.sting.utils.GenomeLoc;
import java.io.File;
@ -103,7 +105,8 @@ public class TraverseReads extends TraversalEngine {
throw new IllegalArgumentException("Unable to traverse reads; no read data is available.");
ReadWalker<M, T> readWalker = (ReadWalker<M, T>) walker;
boolean needsReferenceBasesP = WalkerManager.isRequired(walker, DataSource.REFERENCE_BASES);
ReadView reads = new ReadView(dataProvider);
ReadReferenceView reference = new ReadReferenceView(dataProvider);
@ -116,7 +119,7 @@ public class TraverseReads extends TraversalEngine {
// an array of characters that represent the reference
char[] refSeq = null;
if (read.getReferenceIndex() >= 0) {
if (needsReferenceBasesP && read.getReferenceIndex() >= 0) {
// get the genome loc from the read
GenomeLoc site = new GenomeLoc(read);

View File

@ -3,6 +3,7 @@ package org.broadinstitute.sting.gatk.walkers;
import net.sf.samtools.SAMRecord;
import org.broadinstitute.sting.gatk.LocusContext;
@Requires({DataSource.READS, DataSource.REFERENCE})
public class CountReadsWalker extends ReadWalker<Integer, Integer> {
public Integer map(char[] ref, SAMRecord read) {
//System.out.println(read.format());

View File

@ -17,5 +17,6 @@ package org.broadinstitute.sting.gatk.walkers;
*/
public enum DataSource {
READS,
REFERENCE
REFERENCE,
REFERENCE_BASES // Do I actually need the reference bases passed to the walker?
}

View File

@ -11,7 +11,7 @@ import org.broadinstitute.sting.gatk.LocusContext;
* To change this template use File | Settings | File Templates.
*/
@By(DataSource.READS)
@Requires({DataSource.READS,DataSource.REFERENCE})
@Requires({DataSource.READS,DataSource.REFERENCE, DataSource.REFERENCE_BASES})
public abstract class LocusWalker<MapType, ReduceType> extends Walker<MapType, ReduceType> {
// Do we actually want to operate on the context?
public boolean filter(RefMetaDataTracker tracker, char ref, LocusContext context) {

View File

@ -12,7 +12,7 @@ import net.sf.samtools.SAMRecord;
* Time: 2:52:28 PM
* To change this template use File | Settings | File Templates.
*/
@Requires({DataSource.READS,DataSource.REFERENCE})
@Requires({DataSource.READS,DataSource.REFERENCE, DataSource.REFERENCE_BASES})
public abstract class LocusWindowWalker<MapType, ReduceType> extends Walker<MapType, ReduceType> {
// Do we actually want to operate on the context?
public boolean filter(RefMetaDataTracker tracker, String ref, LocusContext context) {

View File

@ -43,6 +43,7 @@ import java.util.Random;
* reads to a specified BAM file
* The walker now also optionally filters reads based on command line options.
*/
@Requires({DataSource.READS, DataSource.REFERENCE})
public class PrintReadsWalker extends ReadWalker<SAMRecord, SAMFileWriter> {
/** an optional argument to dump the reads out to a BAM file */

View File

@ -9,7 +9,7 @@ import net.sf.samtools.SAMRecord;
* Time: 2:52:28 PM
* To change this template use File | Settings | File Templates.
*/
@Requires(DataSource.READS)
@Requires({DataSource.READS, DataSource.REFERENCE_BASES})
public abstract class ReadWalker<MapType, ReduceType> extends Walker<MapType, ReduceType> {
public boolean requiresOrderedReads() { return false; }

View File

@ -8,7 +8,7 @@ package org.broadinstitute.sting.gatk.walkers;
* To change this template use File | Settings | File Templates.
*/
@By(DataSource.REFERENCE)
@Requires(DataSource.REFERENCE)
@Requires({DataSource.REFERENCE, DataSource.REFERENCE_BASES})
@Allows(DataSource.REFERENCE)
public abstract class RefWalker<MapType, ReduceType> extends LocusWalker<MapType, ReduceType> {
}