TraverseByLocusWindow -- asstd bug fixes.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1109 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2009-06-25 22:51:38 +00:00
parent 5289230eb8
commit 491ed70b44
4 changed files with 32 additions and 12 deletions

View File

@ -118,11 +118,11 @@ public class GenomeAnalysisEngine {
// if we're a read or a locus walker, we use the new system. Right now we have complicated
// branching based on the input data, but this should disapear when all the traversals are switched over
if (!(my_walker instanceof LocusWindowWalker) && !args.useNewTraverseByLocusWindow) {
microScheduler = createMicroscheduler(my_walker, rods);
} else { // we have an old style traversal, once we're done return
if (my_walker instanceof LocusWindowWalker && !args.useNewTraverseByLocusWindow) {
legacyTraversal(my_walker, rods);
return;
} else { // we have an old style traversal, once we're done return
microScheduler = createMicroscheduler(my_walker, rods);
}
// Prepare the sort ordering w.r.t. the sequence dictionary
@ -194,7 +194,7 @@ public class GenomeAnalysisEngine {
MicroScheduler microScheduler = null;
// we need to verify different parameter based on the walker type
if (my_walker instanceof LocusWalker) {
if (my_walker instanceof LocusWalker || my_walker instanceof LocusWindowWalker) {
// create the MicroScheduler
if( argCollection.walkAllLoci )
Utils.scareUser("Argument --all_loci is deprecated. Please annotate your walker with @By(DataSource.REFERENCE) to perform a by-reference traversal.");

View File

@ -36,10 +36,7 @@ import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrde
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.SAMDataSource;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedData;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.traversals.TraversalEngine;
import org.broadinstitute.sting.gatk.traversals.TraverseDuplicates;
import org.broadinstitute.sting.gatk.traversals.TraverseLoci;
import org.broadinstitute.sting.gatk.traversals.TraverseReads;
import org.broadinstitute.sting.gatk.traversals.*;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.GenomeLocSortedSet;
@ -107,6 +104,8 @@ public abstract class MicroScheduler {
traversalEngine = new TraverseReads(reads.getReadsFiles(), refFile, rods);
} else if (walker instanceof LocusWalker) {
traversalEngine = new TraverseLoci(reads.getReadsFiles(), refFile, rods);
} else if (walker instanceof LocusWindowWalker) {
traversalEngine = new TraverseLocusWindows(reads.getReadsFiles(), refFile, rods);
} else if (walker instanceof DuplicateWalker) {
traversalEngine = new TraverseDuplicates(reads.getReadsFiles(), refFile, rods);
} else {
@ -184,6 +183,13 @@ public abstract class MicroScheduler {
drivingDataSource.getSequenceDictionary(),
SHARD_SIZE, maxIterations);
}
} else if (walker instanceof LocusWindowWalker) {
if( intervals == null )
throw new StingException("Unable to shard: walker is of type LocusWindow, but no intervals were provided");
shardStrategy = ShardStrategyFactory.shatter(ShardStrategyFactory.SHATTER_STRATEGY.INTERVAL,
drivingDataSource.getSequenceDictionary(),
SHARD_SIZE,
intervals, maxIterations);
} else
throw new StingException("Unable to support walker of type" + walker.getClass().getName());

View File

@ -47,7 +47,11 @@ public class TraverseLocusWindows extends TraversalEngine {
LocusContext locus = getLocusContext(readView.iterator(), interval);
String referenceSubsequence = new String(referenceView.getReferenceBases(interval));
// The TraverseByLocusWindow expands intervals to cover all reads in a non-standard way.
// TODO: Convert this approach to the standard.
GenomeLoc expandedInterval = locus.getLocation();
String referenceSubsequence = new String(referenceView.getReferenceBases(expandedInterval));
// Iterate forward to get all reference ordered data covering this interval
final RefMetaDataTracker tracker = referenceOrderedDataView.getReferenceOrderedDataAtLocus(locus.getLocation());
@ -94,4 +98,14 @@ public class TraverseLocusWindows extends TraversalEngine {
return locus;
}
/**
* Temporary override of printOnTraversalDone.
* TODO: Add some sort of TE.getName() function once all TraversalEngines are ported.
* @param sum Result of the computation.
* @param <T> Type of the result.
*/
public <T> void printOnTraversalDone( T sum ) {
printOnTraversalDone( "intervals", sum );
}
}

View File

@ -17,9 +17,9 @@ import net.sf.samtools.SAMRecord;
* Time: 11:23:14 AM
* To change this template use File | Settings | File Templates.
*/
public class PrintLocusContextWalker extends LocusWalker<LocusContext, Integer> implements TreeReducible<Integer> {
public LocusContext map(RefMetaDataTracker tracker, char ref, LocusContext context) {
out.printf( "In map: ref = %c, loc = %s, reads = %s%n", ref,
public class PrintLocusContextWalker extends LocusWindowWalker<LocusContext, Integer> implements TreeReducible<Integer> {
public LocusContext map(RefMetaDataTracker tracker, String ref, LocusContext context) {
out.printf( "In map: ref = %s, loc = %s, reads = %s%n", ref,
context.getLocation(),
Arrays.deepToString( getReadNames(context.getReads()) ) );
return context;