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:
parent
03fe166994
commit
3c40db260d
|
|
@ -3,6 +3,7 @@ package org.broadinstitute.sting.gatk.traversals;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.broadinstitute.sting.gatk.LocusContext;
|
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.ShardDataProvider;
|
||||||
import org.broadinstitute.sting.gatk.datasources.providers.ReadView;
|
import org.broadinstitute.sting.gatk.datasources.providers.ReadView;
|
||||||
import org.broadinstitute.sting.gatk.datasources.providers.ReadReferenceView;
|
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.refdata.ReferenceOrderedDatum;
|
||||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||||
import org.broadinstitute.sting.gatk.walkers.Walker;
|
import org.broadinstitute.sting.gatk.walkers.Walker;
|
||||||
|
import org.broadinstitute.sting.gatk.walkers.DataSource;
|
||||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||||
|
|
||||||
import java.io.File;
|
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.");
|
throw new IllegalArgumentException("Unable to traverse reads; no read data is available.");
|
||||||
|
|
||||||
ReadWalker<M, T> readWalker = (ReadWalker<M, T>) walker;
|
ReadWalker<M, T> readWalker = (ReadWalker<M, T>) walker;
|
||||||
|
boolean needsReferenceBasesP = WalkerManager.isRequired(walker, DataSource.REFERENCE_BASES);
|
||||||
|
|
||||||
ReadView reads = new ReadView(dataProvider);
|
ReadView reads = new ReadView(dataProvider);
|
||||||
ReadReferenceView reference = new ReadReferenceView(dataProvider);
|
ReadReferenceView reference = new ReadReferenceView(dataProvider);
|
||||||
|
|
||||||
|
|
@ -116,7 +119,7 @@ public class TraverseReads extends TraversalEngine {
|
||||||
// an array of characters that represent the reference
|
// an array of characters that represent the reference
|
||||||
char[] refSeq = null;
|
char[] refSeq = null;
|
||||||
|
|
||||||
if (read.getReferenceIndex() >= 0) {
|
if (needsReferenceBasesP && read.getReferenceIndex() >= 0) {
|
||||||
// get the genome loc from the read
|
// get the genome loc from the read
|
||||||
GenomeLoc site = new GenomeLoc(read);
|
GenomeLoc site = new GenomeLoc(read);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package org.broadinstitute.sting.gatk.walkers;
|
||||||
import net.sf.samtools.SAMRecord;
|
import net.sf.samtools.SAMRecord;
|
||||||
import org.broadinstitute.sting.gatk.LocusContext;
|
import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
|
|
||||||
|
@Requires({DataSource.READS, DataSource.REFERENCE})
|
||||||
public class CountReadsWalker extends ReadWalker<Integer, Integer> {
|
public class CountReadsWalker extends ReadWalker<Integer, Integer> {
|
||||||
public Integer map(char[] ref, SAMRecord read) {
|
public Integer map(char[] ref, SAMRecord read) {
|
||||||
//System.out.println(read.format());
|
//System.out.println(read.format());
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,6 @@ package org.broadinstitute.sting.gatk.walkers;
|
||||||
*/
|
*/
|
||||||
public enum DataSource {
|
public enum DataSource {
|
||||||
READS,
|
READS,
|
||||||
REFERENCE
|
REFERENCE,
|
||||||
|
REFERENCE_BASES // Do I actually need the reference bases passed to the walker?
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import org.broadinstitute.sting.gatk.LocusContext;
|
||||||
* To change this template use File | Settings | File Templates.
|
* To change this template use File | Settings | File Templates.
|
||||||
*/
|
*/
|
||||||
@By(DataSource.READS)
|
@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> {
|
public abstract class LocusWalker<MapType, ReduceType> extends Walker<MapType, ReduceType> {
|
||||||
// Do we actually want to operate on the context?
|
// Do we actually want to operate on the context?
|
||||||
public boolean filter(RefMetaDataTracker tracker, char ref, LocusContext context) {
|
public boolean filter(RefMetaDataTracker tracker, char ref, LocusContext context) {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import net.sf.samtools.SAMRecord;
|
||||||
* Time: 2:52:28 PM
|
* Time: 2:52:28 PM
|
||||||
* To change this template use File | Settings | File Templates.
|
* 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> {
|
public abstract class LocusWindowWalker<MapType, ReduceType> extends Walker<MapType, ReduceType> {
|
||||||
// Do we actually want to operate on the context?
|
// Do we actually want to operate on the context?
|
||||||
public boolean filter(RefMetaDataTracker tracker, String ref, LocusContext context) {
|
public boolean filter(RefMetaDataTracker tracker, String ref, LocusContext context) {
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ import java.util.Random;
|
||||||
* reads to a specified BAM file
|
* reads to a specified BAM file
|
||||||
* The walker now also optionally filters reads based on command line options.
|
* The walker now also optionally filters reads based on command line options.
|
||||||
*/
|
*/
|
||||||
|
@Requires({DataSource.READS, DataSource.REFERENCE})
|
||||||
public class PrintReadsWalker extends ReadWalker<SAMRecord, SAMFileWriter> {
|
public class PrintReadsWalker extends ReadWalker<SAMRecord, SAMFileWriter> {
|
||||||
|
|
||||||
/** an optional argument to dump the reads out to a BAM file */
|
/** an optional argument to dump the reads out to a BAM file */
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import net.sf.samtools.SAMRecord;
|
||||||
* Time: 2:52:28 PM
|
* Time: 2:52:28 PM
|
||||||
* To change this template use File | Settings | File Templates.
|
* 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 abstract class ReadWalker<MapType, ReduceType> extends Walker<MapType, ReduceType> {
|
||||||
public boolean requiresOrderedReads() { return false; }
|
public boolean requiresOrderedReads() { return false; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ package org.broadinstitute.sting.gatk.walkers;
|
||||||
* To change this template use File | Settings | File Templates.
|
* To change this template use File | Settings | File Templates.
|
||||||
*/
|
*/
|
||||||
@By(DataSource.REFERENCE)
|
@By(DataSource.REFERENCE)
|
||||||
@Requires(DataSource.REFERENCE)
|
@Requires({DataSource.REFERENCE, DataSource.REFERENCE_BASES})
|
||||||
@Allows(DataSource.REFERENCE)
|
@Allows(DataSource.REFERENCE)
|
||||||
public abstract class RefWalker<MapType, ReduceType> extends LocusWalker<MapType, ReduceType> {
|
public abstract class RefWalker<MapType, ReduceType> extends LocusWalker<MapType, ReduceType> {
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue