Re-add the plugin path.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1271 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2009-07-16 22:48:44 +00:00
parent 7c30c30d26
commit df1c61e049
4 changed files with 47 additions and 14 deletions

View File

@ -3,6 +3,7 @@ package org.broadinstitute.sting.gatk;
import org.broadinstitute.sting.utils.cmdLine.CommandLineProgram;
import org.broadinstitute.sting.utils.cmdLine.ArgumentFactory;
import org.broadinstitute.sting.utils.cmdLine.ArgumentCollection;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import org.broadinstitute.sting.utils.StingException;
import org.broadinstitute.sting.utils.xReadLines;
import org.broadinstitute.sting.gatk.walkers.Walker;
@ -42,17 +43,22 @@ import net.sf.samtools.SAMFileReader;
/**
* @author aaron
* <p/>
* Generate a executable class for the SomaticCoverageWalker
*/
public abstract class CommandLineExecutable extends CommandLineProgram {
// our genome analysis engine
private GenomeAnalysisEngine GATKEngine = new GenomeAnalysisEngine();
/**
* Get an instance of the GATK engine.
* @return The GATK engine that will power the requested traversal.
*/
protected abstract GenomeAnalysisEngine getGATKEngine();
// get the analysis name
protected abstract String getAnalysisName();
/**
* Gets the GATK argument bundle.
* @return A structure consisting of whatever arguments should be used to initialize the GATK engine.
*/
protected abstract GATKArgumentCollection getArgumentCollection();
// override select arguments
@ -65,10 +71,11 @@ public abstract class CommandLineExecutable extends CommandLineProgram {
* @return the return code to exit the program with
*/
protected int execute() {
Walker<?,?> mWalker = GATKEngine.getWalkerByName(getAnalysisName());
GenomeAnalysisEngine GATKEngine = getGATKEngine();
GATKArgumentCollection arguments = getArgumentCollection();
Walker<?,?> mWalker = GATKEngine.getWalkerByName(getAnalysisName());
// load the arguments into the walkers
loadArgumentsIntoObject(arguments);
loadArgumentsIntoObject(mWalker);
@ -101,7 +108,7 @@ public abstract class CommandLineExecutable extends CommandLineProgram {
protected Class[] getArgumentSources() {
// No walker info? No plugins.
if (getAnalysisName() == null) return new Class[] {};
return new Class[] { GATKEngine.getWalkerByName(getAnalysisName()).getClass() };
return new Class[] { getGATKEngine().getWalkerByName(getAnalysisName()).getClass() };
}
@Override

View File

@ -36,13 +36,18 @@ import net.sf.samtools.SAMFileReader;
* the gatk engine should deal with any data related information.
*/
public class CommandLineGATK extends CommandLineExecutable {
// our genome analysis engine
private GenomeAnalysisEngine GATKEngine = null;
@Argument(fullName = "analysis_type", shortName = "T", doc = "Type of analysis to run")
public String analysisName = null;
private String analysisName = null;
@Argument(fullName = "plugin_path", doc = "Which path will the GATK search for plugin walkers.", required = false)
private String pluginPath = null;
// our argument collection, the collection of command line args we accept
@ArgumentCollection
protected GATKArgumentCollection argCollection = new GATKArgumentCollection();
private GATKArgumentCollection argCollection = new GATKArgumentCollection();
/**
* Get pleasing info about the GATK.
@ -59,6 +64,19 @@ public class CommandLineGATK extends CommandLineExecutable {
return header;
}
/**
* Lazy load the GATK engine. This current CANNOT happen until after the command-line arguments are populated.
* TODO: Make this chain of events more explicit. Perhaps an abstract initialize method after clp arguments are parsed?
* @return The GATK engine that will power the requested traversal.
*/
@Override
protected GenomeAnalysisEngine getGATKEngine() {
if( GATKEngine == null )
GATKEngine = new GenomeAnalysisEngine( pluginPath );
return GATKEngine;
}
@Override
protected String getAnalysisName() {
return analysisName;

View File

@ -63,9 +63,6 @@ public class GenomeAnalysisEngine {
/** our walker manager */
private final WalkerManager walkerManager;
/** plugin path for the walker manager. */
public final String pluginPathName = null;
/**
* our constructor, where all the work is done
* <p/>
@ -73,7 +70,7 @@ public class GenomeAnalysisEngine {
* new MicroScheduler class we'll be able to delete that function.
*
*/
public GenomeAnalysisEngine() {
public GenomeAnalysisEngine( String pluginPathName ) {
// make sure our instance variable points to this analysis engine
instance = this;
walkerManager = new WalkerManager(pluginPathName);

View File

@ -2,6 +2,7 @@ package org.broadinstitute.sting.playground.somaticcoverage;
import org.broadinstitute.sting.gatk.CommandLineExecutable;
import org.broadinstitute.sting.gatk.GATKArgumentCollection;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.cmdLine.Argument;
import java.io.File;
@ -41,7 +42,9 @@ import java.util.ArrayList;
*
* a executable command line for the Somatic Coverage Walker.
*/
public class SomaticCoverageTool extends CommandLineExecutable {
public class SomaticCoverageTool extends CommandLineExecutable {
// our genome analysis engine
private GenomeAnalysisEngine GATKEngine = null;
// the two sam/bam files, one for cancer, one for normal
@Argument(fullName = "bam_file", shortName = "I", doc = "The bam files, one for the tumor one for the normal", required = true)
@ -57,6 +60,14 @@ public class SomaticCoverageTool extends CommandLineExecutable {
}
}
@Override
protected GenomeAnalysisEngine getGATKEngine() {
if( GATKEngine == null )
GATKEngine = new GenomeAnalysisEngine( null );
return GATKEngine;
}
/**
* a required method, returns the analysis name. This is usually the walker
* name with 'Walker' stripped off.