From 0b1e243a7b8c3210c7daf6a50bfb9bd26848be88 Mon Sep 17 00:00:00 2001 From: rpoplin Date: Wed, 10 Feb 2010 15:52:20 +0000 Subject: [PATCH] CountCovariates now sorts the list of standard covariate classes coming from PackageUtils.getClassesImplementingInterface(). As a result some of the integration tests now make use of -standard git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2817 348d0f76-0448-11de-a6fe-93d51630548a --- .../recalibration/CovariateCounterWalker.java | 25 +++++++++++++------ .../varianteval/VariantEvalWalker.java | 2 +- .../sting/utils/PackageUtils.java | 1 + .../RecalibrationWalkersIntegrationTest.java | 10 ++------ 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/CovariateCounterWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/CovariateCounterWalker.java index fb9865e27..4992e9d7a 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/CovariateCounterWalker.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/CovariateCounterWalker.java @@ -165,14 +165,25 @@ public class CovariateCounterWalker extends LocusWalker { } // Next add the standard covariates if -standard was specified by the user if( USE_STANDARD_COVARIATES ) { + // We want the standard covariates to appear in a consistent order but the packageUtils method gives a random order + // A list of Classes can't be sorted, but a list of Class names can be + final List standardClassNames = new ArrayList(); for( Class covClass : standardClasses ) { - try { - final Covariate covariate = (Covariate)covClass.newInstance(); - requestedCovariates.add( covariate ); - } catch ( InstantiationException e ) { - throw new StingException( String.format("Can not instantiate covariate class '%s': must be concrete class.", covClass.getSimpleName()) ); - } catch ( IllegalAccessException e ) { - throw new StingException( String.format("Can not instantiate covariate class '%s': must have no-arg constructor.", covClass.getSimpleName()) ); + standardClassNames.add( covClass.getName() ); + } + Collections.sort(standardClassNames); // Sort the list of class names + for( String className : standardClassNames ) { + for( Class covClass : standardClasses ) { // Find the class that matches this class name + if( covClass.getName().equals( className ) ) { + try { + final Covariate covariate = (Covariate)covClass.newInstance(); + requestedCovariates.add( covariate ); + } catch ( InstantiationException e ) { + throw new StingException( String.format("Can not instantiate covariate class '%s': must be concrete class.", covClass.getSimpleName()) ); + } catch ( IllegalAccessException e ) { + throw new StingException( String.format("Can not instantiate covariate class '%s': must have no-arg constructor.", covClass.getSimpleName()) ); + } + } } } } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEvalWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEvalWalker.java index 76cb51aac..5db36821c 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEvalWalker.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEvalWalker.java @@ -38,7 +38,7 @@ public class VariantEvalWalker extends RodWalker { @Argument(shortName="printVariants", doc="If true, prints the variants in all of the variant tracks that are examined", required=false) public boolean printVariants = false; - @Argument(shortName="badHWEThreshold", doc="Only sites with deviations froim Hardy-Weinberg equilibrium with P-values < than this threshold are flagged", required=false) + @Argument(shortName="badHWEThreshold", doc="Only sites with deviations from Hardy-Weinberg equilibrium with P-values < than this threshold are flagged", required=false) public double badHWEThreshold = 1e-3; @Argument(fullName="evalContainsGenotypes", shortName = "G", doc="If true, the input list of variants will be treated as a genotyping file, containing assertions of actual genotype values for a particular person. Analyses that only make sense on at the population level will be disabled, while those operating on genotypes will be enabled", required=false) diff --git a/java/src/org/broadinstitute/sting/utils/PackageUtils.java b/java/src/org/broadinstitute/sting/utils/PackageUtils.java index 3ff474686..08935b4a8 100755 --- a/java/src/org/broadinstitute/sting/utils/PackageUtils.java +++ b/java/src/org/broadinstitute/sting/utils/PackageUtils.java @@ -5,6 +5,7 @@ import org.reflections.scanners.SubTypesScanner; import org.reflections.util.AbstractConfiguration; import org.reflections.util.ClasspathHelper; +import java.util.Collections; import java.util.Set; import java.util.ArrayList; import java.util.List; diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/recalibration/RecalibrationWalkersIntegrationTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/recalibration/RecalibrationWalkersIntegrationTest.java index 130a387ee..ee73a87c8 100755 --- a/java/test/org/broadinstitute/sting/gatk/walkers/recalibration/RecalibrationWalkersIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/gatk/walkers/recalibration/RecalibrationWalkersIntegrationTest.java @@ -123,10 +123,7 @@ public class RecalibrationWalkersIntegrationTest extends WalkerTest { " --DBSNP /humgen/gsa-scr1/GATK_Data/dbsnp_129_b36.rod" + " -T CountCovariates" + " -I " + bam + - " -cov ReadGroupCovariate" + - " -cov QualityScoreCovariate" + - " -cov CycleCovariate" + - " -cov DinucCovariate" + + " -standard" + " -U" + " -L 1:10,000,000-20,000,000" + " --solid_recal_mode REMOVE_REF_BIAS" + @@ -184,10 +181,7 @@ public class RecalibrationWalkersIntegrationTest extends WalkerTest { " -T CountCovariates" + " -I " + bam + " -L 1:10,000,000-10,200,000" + - " -cov ReadGroupCovariate" + - " -cov QualityScoreCovariate" + - " -cov CycleCovariate" + - " -cov DinucCovariate" + + " -standard" + " --solid_recal_mode SET_Q_ZERO" + " -recalFile %s", 1, // just one output file