Temporary command-line support to enable rod walkers, if you know what you are doing this is safe.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2505 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2010-01-06 12:15:36 +00:00
parent d8351cb9fc
commit 8d13597a27
5 changed files with 22 additions and 10 deletions

View File

@ -141,6 +141,11 @@ public class GATKArgumentCollection {
@Argument(fullName = "interval_merging", shortName = "im", doc = "What interval merging rule should we use {ALL [DEFAULT],OVERLAPPING_ONLY,NONE}.", required = false)
public INTERVAL_MERGING_RULE intervalMerging = INTERVAL_MERGING_RULE.ALL;
/** Should we enable rodWalkers? This is currently unsafe */
@Element(required = false)
@Argument(fullName = "enableRodWalkers", shortName = "erw", doc = "Enable experimental rodWalker support. TEMPORARY HACK TO ALLOW EXPERIMENTATION WITH ROD WALKERS. [default is false]}.", required = false)
public boolean enableRodWalkers = false;
/**
* marshal the data out to a object
*
@ -294,6 +299,9 @@ public class GATKArgumentCollection {
if (other.intervalMerging != this.intervalMerging) {
return false;
}
if (other.enableRodWalkers != this.enableRodWalkers) {
return false;
}
return true;
}

View File

@ -7,6 +7,7 @@ import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.MergingIterator;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.StingException;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import java.util.*;
@ -87,7 +88,7 @@ public class RodLocusView extends LocusView implements ReferenceOrderedView {
rodQueue = new MergingIterator<RODRecordList<ReferenceOrderedDatum>>(iterators);
throw new StingException("RodLocusView currently disabled");
//throw new StingException("RodLocusView currently disabled");
}
public RefMetaDataTracker getReferenceOrderedDataAtLocus( GenomeLoc loc ) {
@ -127,7 +128,7 @@ public class RodLocusView extends LocusView implements ReferenceOrderedView {
// calculate the number of skipped bases, and update lastLoc so we can do that again in the next()
long skippedBases = getSkippedBases( rodSite );
lastLoc = site;
return new AlignmentContext(site, new ArrayList<SAMRecord>(), new ArrayList<Integer>(), skippedBases);
return new AlignmentContext(site, new ReadBackedPileup(site), skippedBases);
}
private RefMetaDataTracker createTracker( Collection<RODRecordList<ReferenceOrderedDatum>> allTracksHere ) {

View File

@ -2,6 +2,7 @@ package org.broadinstitute.sting.gatk.traversals;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.gatk.WalkerManager;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.datasources.providers.*;
@ -13,6 +14,7 @@ import org.broadinstitute.sting.gatk.walkers.Walker;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import java.util.ArrayList;
@ -21,7 +23,7 @@ import java.util.ArrayList;
*/
public class TraverseLoci extends TraversalEngine {
final private static String LOCI_STRING = "sites";
final private static boolean ENABLE_ROD_TRAVERSAL = false;
//final private static boolean ENABLE_ROD_TRAVERSAL = false;
/**
@ -57,7 +59,7 @@ public class TraverseLoci extends TraversalEngine {
//ReferenceOrderedView referenceOrderedDataView = new ReferenceOrderedView( dataProvider );
ReferenceOrderedView referenceOrderedDataView = null;
if ( ! ENABLE_ROD_TRAVERSAL || WalkerManager.getWalkerDataSource(walker) != DataSource.REFERENCE_ORDERED_DATA )
if ( ! GenomeAnalysisEngine.instance.getArguments().enableRodWalkers || WalkerManager.getWalkerDataSource(walker) != DataSource.REFERENCE_ORDERED_DATA )
referenceOrderedDataView = new ManagingReferenceOrderedView( dataProvider );
else
referenceOrderedDataView = (RodLocusView)locusView;
@ -102,12 +104,13 @@ public class TraverseLoci extends TraversalEngine {
// We have a final map call to execute here to clean up the skipped based from the
// last position in the ROD to that in the interval
if ( ENABLE_ROD_TRAVERSAL && WalkerManager.getWalkerDataSource(walker) == DataSource.REFERENCE_ORDERED_DATA ) {
if ( GenomeAnalysisEngine.instance.getArguments().enableRodWalkers && WalkerManager.getWalkerDataSource(walker) == DataSource.REFERENCE_ORDERED_DATA ) {
RodLocusView rodLocusView = (RodLocusView)locusView;
long nSkipped = rodLocusView.getLastSkippedBases();
if ( nSkipped > 0 ) {
// no sense in making the call if you don't have anything interesting to say
AlignmentContext ac = new AlignmentContext(rodLocusView.getLocOneBeyondShard(), null, null, nSkipped);
GenomeLoc site = rodLocusView.getLocOneBeyondShard();
AlignmentContext ac = new AlignmentContext(site, new ReadBackedPileup(site), nSkipped);
M x = locusWalker.map(null, null, ac);
sum = locusWalker.reduce(x, sum);
}
@ -135,7 +138,7 @@ public class TraverseLoci extends TraversalEngine {
DataSource dataSource = WalkerManager.getWalkerDataSource(walker);
if( dataSource == DataSource.READS )
return new CoveredLocusView(dataProvider);
else if( dataSource == DataSource.REFERENCE || ! ENABLE_ROD_TRAVERSAL )
else if( dataSource == DataSource.REFERENCE || ! GenomeAnalysisEngine.instance.getArguments().enableRodWalkers )
return new AllLocusView(dataProvider);
else if( dataSource == DataSource.REFERENCE_ORDERED_DATA )
return new RodLocusView(dataProvider);

View File

@ -22,8 +22,8 @@ import java.util.*;
*/
@Requires(value={DataSource.REFERENCE},referenceMetaData={@RMD(name="eval",type=ReferenceOrderedDatum.class)}) // right now we have no base variant class for rods, this should change
//@Allows(value={DataSource.REFERENCE},referenceMetaData = {@RMD(name="eval",type=ReferenceOrderedDatum.class), @RMD(name="dbsnp",type=rodDbSNP.class),@RMD(name="hapmap-chip",type=ReferenceOrderedDatum.class), @RMD(name="interval",type=IntervalRod.class), @RMD(name="validation",type=RodGenotypeChipAsGFF.class)})
public class VariantEvalWalker extends RefWalker<Integer, Integer> {
//public class VariantEvalWalker extends RodWalker<Integer, Integer> {
//public class VariantEvalWalker extends RefWalker<Integer, Integer> {
public class VariantEvalWalker extends RodWalker<Integer, Integer> {
@Argument(shortName="minPhredConfidenceScore", doc="Minimum confidence score to consider an evaluation SNP a variant", required=false)
public double minConfidenceScore = -1.0;

View File

@ -177,7 +177,7 @@ public class VariantEvalWalkerIntegrationTest extends WalkerTest {
@Test
public void testEvalRuntimeWithLotsOfIntervals() {
List<String> md5 = new ArrayList<String>();
md5.add("");
md5.add("d11ea079fc1835514d392056a2c2a28d");
WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec(
"-T VariantEval -R " + oneKGLocation + "reference/human_b36_both.fasta " +
"-B eval,Variants," + validationDataLocation + "NA12878.pilot_3.all.geli.calls " +