First stage of ROD plumbing for MicroScheduler.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@614 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
5136724884
commit
dc944ec69b
|
|
@ -105,6 +105,9 @@ public class GenomeAnalysisTK extends CommandLineProgram {
|
|||
@Argument(fullName="numthreads",shortName="nt",doc="How many threads should be allocated to running this analysis.",required=false)
|
||||
protected int numThreads = 1;
|
||||
|
||||
@Argument(fullName="rodBind",shortName="B",doc="",required=false)
|
||||
protected ArrayList<String> ROD_BINDINGS = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* Collection of output streams used by the walker.
|
||||
*/
|
||||
|
|
@ -115,8 +118,6 @@ public class GenomeAnalysisTK extends CommandLineProgram {
|
|||
*/
|
||||
private static Logger logger = Logger.getLogger(GenomeAnalysisTK.class);
|
||||
|
||||
@Argument(fullName="rodBind",shortName="B",doc="",required=false)
|
||||
protected static ArrayList<String> ROD_BINDINGS = new ArrayList<String>();
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -168,7 +169,7 @@ public class GenomeAnalysisTK extends CommandLineProgram {
|
|||
* @param type
|
||||
* @param file
|
||||
*/
|
||||
private static void bindConvenienceRods(final String name, final String type, final String file )
|
||||
private void bindConvenienceRods(final String name, final String type, final String file )
|
||||
{
|
||||
ROD_BINDINGS.add(name);
|
||||
ROD_BINDINGS.add(type);
|
||||
|
|
@ -247,7 +248,7 @@ public class GenomeAnalysisTK extends CommandLineProgram {
|
|||
// is not filtered.
|
||||
if( !DISABLE_THREADING ) {
|
||||
logger.warn("Preliminary threading support ENABLED");
|
||||
microScheduler = MicroScheduler.create( walker, INPUT_FILES, REF_FILE_ARG, numThreads );
|
||||
microScheduler = MicroScheduler.create( walker, INPUT_FILES, REF_FILE_ARG, rods, numThreads );
|
||||
this.engine = microScheduler.getTraversalEngine();
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import org.broadinstitute.sting.gatk.dataSources.shards.Shard;
|
|||
import org.broadinstitute.sting.gatk.dataSources.simpleDataSources.SAMDataSource;
|
||||
import org.broadinstitute.sting.gatk.GenomeAnalysisTK;
|
||||
import org.broadinstitute.sting.gatk.OutputTracker;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedData;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.StingException;
|
||||
import org.broadinstitute.sting.utils.threading.ThreadPoolMonitor;
|
||||
|
|
@ -58,12 +60,12 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Reduce
|
|||
* @param refFile Reference for driving the traversal.
|
||||
* @param nThreadsToUse maximum number of threads to use to do the work
|
||||
*/
|
||||
protected HierarchicalMicroScheduler( List<File> reads, File refFile, int nThreadsToUse ) {
|
||||
protected HierarchicalMicroScheduler( List<File> reads, File refFile, List<ReferenceOrderedData<? extends ReferenceOrderedDatum>> rods, int nThreadsToUse ) {
|
||||
super( reads, refFile );
|
||||
|
||||
|
||||
this.threadPool = Executors.newFixedThreadPool(nThreadsToUse);
|
||||
traversalEngine = new TraverseLociByReference( reads, refFile, new java.util.ArrayList() );
|
||||
traversalEngine = new TraverseLociByReference( reads, refFile, rods );
|
||||
}
|
||||
|
||||
public TraversalEngine getTraversalEngine() {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import org.broadinstitute.sting.gatk.traversals.TraverseReads;
|
|||
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.ReadWalker;
|
||||
import org.broadinstitute.sting.gatk.walkers.Walker;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedData;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -37,16 +39,16 @@ public class LinearMicroScheduler extends MicroScheduler {
|
|||
* @param reads Reads file(s) to process.
|
||||
* @param refFile Reference for driving the traversal.
|
||||
*/
|
||||
protected LinearMicroScheduler(List<File> reads, File refFile, Walker walker) {
|
||||
protected LinearMicroScheduler(List<File> reads, File refFile, List<ReferenceOrderedData<? extends ReferenceOrderedDatum>> rods, Walker walker) {
|
||||
super(reads, refFile);
|
||||
|
||||
// determine if we're a read walker: they get a slightly different, but not in any way worse execute methodology. I pinky swear...
|
||||
isAReadWalker = (walker instanceof ReadWalker) ? true : false;
|
||||
|
||||
if (isAReadWalker) {
|
||||
traversalEngine = new TraverseByReads(reads, refFile, new java.util.ArrayList());
|
||||
traversalEngine = new TraverseByReads(reads, refFile, rods);
|
||||
} else {
|
||||
traversalEngine = new TraverseLociByReference(reads, refFile, new java.util.ArrayList());
|
||||
traversalEngine = new TraverseLociByReference(reads, refFile, rods);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import org.broadinstitute.sting.gatk.dataSources.simpleDataSources.SimpleDataSou
|
|||
import org.broadinstitute.sting.gatk.traversals.TraversalEngine;
|
||||
import org.broadinstitute.sting.gatk.walkers.TreeReducible;
|
||||
import org.broadinstitute.sting.gatk.walkers.Walker;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
||||
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedData;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.fasta.IndexedFastaSequenceFile;
|
||||
|
||||
|
|
@ -42,14 +44,14 @@ public abstract class MicroScheduler {
|
|||
* @param nThreadsToUse Number of threads to utilize.
|
||||
* @return The best-fit microscheduler.
|
||||
*/
|
||||
public static MicroScheduler create( Walker walker, List<File> reads, File ref, int nThreadsToUse ) {
|
||||
public static MicroScheduler create( Walker walker, List<File> reads, File ref, List<ReferenceOrderedData<? extends ReferenceOrderedDatum>> rods, int nThreadsToUse ) {
|
||||
if( walker instanceof TreeReducible && nThreadsToUse > 1 ) {
|
||||
logger.info("Creating hierarchical microscheduler");
|
||||
return new HierarchicalMicroScheduler( reads, ref, nThreadsToUse );
|
||||
return new HierarchicalMicroScheduler( reads, ref, rods, nThreadsToUse );
|
||||
}
|
||||
else {
|
||||
logger.info("Creating linear microscheduler");
|
||||
return new LinearMicroScheduler( reads, ref, walker );
|
||||
return new LinearMicroScheduler( reads, ref, rods, walker );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ public class PileupWalker extends LocusWalker<Integer, Integer> implements TreeR
|
|||
// Given result of map function
|
||||
public Integer reduceInit() { return 0; }
|
||||
public Integer reduce(Integer value, Integer sum) {
|
||||
return reduce(sum,value);
|
||||
return treeReduce(sum,value);
|
||||
}
|
||||
public Integer treeReduce(Integer lhs, Integer rhs) {
|
||||
return lhs + rhs;
|
||||
|
|
|
|||
Loading…
Reference in New Issue