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:
parent
5289230eb8
commit
491ed70b44
|
|
@ -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
|
// 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
|
// branching based on the input data, but this should disapear when all the traversals are switched over
|
||||||
if (!(my_walker instanceof LocusWindowWalker) && !args.useNewTraverseByLocusWindow) {
|
if (my_walker instanceof LocusWindowWalker && !args.useNewTraverseByLocusWindow) {
|
||||||
microScheduler = createMicroscheduler(my_walker, rods);
|
|
||||||
} else { // we have an old style traversal, once we're done return
|
|
||||||
legacyTraversal(my_walker, rods);
|
legacyTraversal(my_walker, rods);
|
||||||
return;
|
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
|
// Prepare the sort ordering w.r.t. the sequence dictionary
|
||||||
|
|
@ -194,7 +194,7 @@ public class GenomeAnalysisEngine {
|
||||||
MicroScheduler microScheduler = null;
|
MicroScheduler microScheduler = null;
|
||||||
|
|
||||||
// we need to verify different parameter based on the walker type
|
// 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
|
// create the MicroScheduler
|
||||||
if( argCollection.walkAllLoci )
|
if( argCollection.walkAllLoci )
|
||||||
Utils.scareUser("Argument --all_loci is deprecated. Please annotate your walker with @By(DataSource.REFERENCE) to perform a by-reference traversal.");
|
Utils.scareUser("Argument --all_loci is deprecated. Please annotate your walker with @By(DataSource.REFERENCE) to perform a by-reference traversal.");
|
||||||
|
|
|
||||||
|
|
@ -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.datasources.simpleDataSources.SAMDataSource;
|
||||||
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedData;
|
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.traversals.TraversalEngine;
|
import org.broadinstitute.sting.gatk.traversals.*;
|
||||||
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.walkers.*;
|
import org.broadinstitute.sting.gatk.walkers.*;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocParser;
|
import org.broadinstitute.sting.utils.GenomeLocParser;
|
||||||
import org.broadinstitute.sting.utils.GenomeLocSortedSet;
|
import org.broadinstitute.sting.utils.GenomeLocSortedSet;
|
||||||
|
|
@ -107,6 +104,8 @@ public abstract class MicroScheduler {
|
||||||
traversalEngine = new TraverseReads(reads.getReadsFiles(), refFile, rods);
|
traversalEngine = new TraverseReads(reads.getReadsFiles(), refFile, rods);
|
||||||
} else if (walker instanceof LocusWalker) {
|
} else if (walker instanceof LocusWalker) {
|
||||||
traversalEngine = new TraverseLoci(reads.getReadsFiles(), refFile, rods);
|
traversalEngine = new TraverseLoci(reads.getReadsFiles(), refFile, rods);
|
||||||
|
} else if (walker instanceof LocusWindowWalker) {
|
||||||
|
traversalEngine = new TraverseLocusWindows(reads.getReadsFiles(), refFile, rods);
|
||||||
} else if (walker instanceof DuplicateWalker) {
|
} else if (walker instanceof DuplicateWalker) {
|
||||||
traversalEngine = new TraverseDuplicates(reads.getReadsFiles(), refFile, rods);
|
traversalEngine = new TraverseDuplicates(reads.getReadsFiles(), refFile, rods);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -184,6 +183,13 @@ public abstract class MicroScheduler {
|
||||||
drivingDataSource.getSequenceDictionary(),
|
drivingDataSource.getSequenceDictionary(),
|
||||||
SHARD_SIZE, maxIterations);
|
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
|
} else
|
||||||
throw new StingException("Unable to support walker of type" + walker.getClass().getName());
|
throw new StingException("Unable to support walker of type" + walker.getClass().getName());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,11 @@ public class TraverseLocusWindows extends TraversalEngine {
|
||||||
|
|
||||||
LocusContext locus = getLocusContext(readView.iterator(), interval);
|
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
|
// Iterate forward to get all reference ordered data covering this interval
|
||||||
final RefMetaDataTracker tracker = referenceOrderedDataView.getReferenceOrderedDataAtLocus(locus.getLocation());
|
final RefMetaDataTracker tracker = referenceOrderedDataView.getReferenceOrderedDataAtLocus(locus.getLocation());
|
||||||
|
|
@ -94,4 +98,14 @@ public class TraverseLocusWindows extends TraversalEngine {
|
||||||
return locus;
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@ import net.sf.samtools.SAMRecord;
|
||||||
* Time: 11:23:14 AM
|
* Time: 11:23:14 AM
|
||||||
* To change this template use File | Settings | File Templates.
|
* To change this template use File | Settings | File Templates.
|
||||||
*/
|
*/
|
||||||
public class PrintLocusContextWalker extends LocusWalker<LocusContext, Integer> implements TreeReducible<Integer> {
|
public class PrintLocusContextWalker extends LocusWindowWalker<LocusContext, Integer> implements TreeReducible<Integer> {
|
||||||
public LocusContext map(RefMetaDataTracker tracker, char ref, LocusContext context) {
|
public LocusContext map(RefMetaDataTracker tracker, String ref, LocusContext context) {
|
||||||
out.printf( "In map: ref = %c, loc = %s, reads = %s%n", ref,
|
out.printf( "In map: ref = %s, loc = %s, reads = %s%n", ref,
|
||||||
context.getLocation(),
|
context.getLocation(),
|
||||||
Arrays.deepToString( getReadNames(context.getReads()) ) );
|
Arrays.deepToString( getReadNames(context.getReads()) ) );
|
||||||
return context;
|
return context;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue