Added the ability in VE2 to select which eval modules to run, so that you aren't forced to use all of them. You can use --list to list all of the possible modules to run.

Heads up everyone: by default, *no* modules are run.  Please add "-all" to your scripts to maintain the previous behavior.



git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3161 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2010-04-13 22:15:58 +00:00
parent 0b575596f8
commit dde092fb61
2 changed files with 47 additions and 5 deletions

View File

@ -101,6 +101,18 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
protected String[] SAMPLES = {};
private List<String> SAMPLES_LIST = null;
//
// Arguments for choosing which modules to run
//
@Argument(fullName="evalModule", shortName="E", doc="One or more specific eval modules to apply to the eval track(s)", required=false)
protected String[] modulesToUse = {};
@Argument(fullName="useAllModules", shortName="all", doc="Use all possible eval modules", required=false)
protected Boolean USE_ALL_MODULES = false;
@Argument(fullName="list", shortName="ls", doc="List the available eval modules and exit")
protected Boolean LIST = false;
//
// Arguments for Mendelian Violation calculations
//
@ -117,7 +129,7 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
@Argument(shortName = "Q", fullName="minPhredConfidenceScore", doc="Minimum confidence score to consider an evaluation SNP a variant", required=false)
public double minQualScore = NO_MIN_QUAL_SCORE;
/** Right now we will only be looking at SNPS */
// Right now we will only be looking at SNPS
EnumSet<VariantContext.Type> ALLOW_VARIANT_CONTEXT_TYPES = EnumSet.of(VariantContext.Type.SNP, VariantContext.Type.NO_VARIATION);
@Argument(shortName="rsID", fullName="rsID", doc="If provided, list of rsID and build number for capping known snps by their build date", required=false)
@ -214,9 +226,13 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
// --------------------------------------------------------------------------------------------------------------
public void initialize() {
if ( LIST )
listModulesAndExit();
SAMPLES_LIST = Arrays.asList(SAMPLES);
determineAllEvalations();
determineEvalations();
List<VariantContextUtils.JexlVCMatchExp> selectExps = VariantContextUtils.initializeMatchExps(SELECT_NAMES, SELECT_EXPS);
for ( ReferenceOrderedDataSource d : this.getToolkit().getRodDataSources() ) {
@ -246,6 +262,15 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
}
}
private void listModulesAndExit() {
List<Class<? extends VariantEvaluator>> veClasses = PackageUtils.getClassesImplementingInterface(VariantEvaluator.class);
out.println("\nAvailable eval modules:");
for (int i = 0; i < veClasses.size(); i++)
out.println("\t" + veClasses.get(i).getSimpleName());
out.println();
System.exit(0);
}
private static Set<String> getrsIDsToExclude(File rsIDFile, int maxRsIDBuild) {
List<String> toExclude = new LinkedList<String>();
@ -283,8 +308,25 @@ public class VariantEval2Walker extends RodWalker<Integer, Integer> {
return ex;
}
private void determineAllEvalations() {
evaluationClasses = PackageUtils.getClassesImplementingInterface(VariantEvaluator.class);
private void determineEvalations() {
// create a map for all eval modules for easy lookup
HashMap<String, Class<? extends VariantEvaluator>> classMap = new HashMap<String, Class<? extends VariantEvaluator>>();
for ( Class<? extends VariantEvaluator> c : PackageUtils.getClassesImplementingInterface(VariantEvaluator.class) )
classMap.put(c.getSimpleName(), c);
if ( USE_ALL_MODULES ) {
evaluationClasses = new ArrayList<Class<? extends VariantEvaluator>>(classMap.values());
} else {
// get the specific classes provided
evaluationClasses = new ArrayList<Class<? extends VariantEvaluator>>(modulesToUse.length);
for ( String module : modulesToUse ) {
Class<? extends VariantEvaluator> moduleClass = classMap.get(module);
if ( moduleClass == null )
throw new StingException("Class " + module + " is not found; please check that you have specified the class name correctly");
evaluationClasses.add(moduleClass);
}
}
for ( VariantEvaluator e : instantiateEvalationsSet() ) {
// for collecting purposes
variantEvaluationNames.add(e.getName());

View File

@ -9,7 +9,7 @@ import java.util.Map;
public class VariantEval2IntegrationTest extends WalkerTest {
private static String cmdRoot = "-T VariantEval2" +
" -R " + oneKGLocation + "reference/human_b36_both.fasta -reportType Grep";
" -R " + oneKGLocation + "reference/human_b36_both.fasta -reportType Grep -all";
private static String root = cmdRoot +
" -D " + GATKDataLocation + "dbsnp_129_b36.rod" +