diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java index ed4070104..221d623de 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java @@ -8,7 +8,7 @@ import java.util.List; import java.util.ArrayList; -public class AlleleBalance implements VariantAnnotation { +public class AlleleBalance extends StandardVariantAnnotation { public Pair annotate(ReferenceContext ref, ReadBackedPileup pileup, List genotypes) { diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java index 85e9258ac..77ffd714e 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java @@ -8,7 +8,7 @@ import org.broadinstitute.sting.utils.genotype.Genotype; import java.util.List; -public class DepthOfCoverage implements VariantAnnotation { +public class DepthOfCoverage extends StandardVariantAnnotation { public Pair annotate(ReferenceContext ref, ReadBackedPileup pileup, List genotypes) { int depth = pileup.getReads().size(); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java index 2031a8b85..78b447e01 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java @@ -11,7 +11,7 @@ import cern.jet.math.Arithmetic; import java.util.List; -public class FisherStrand implements VariantAnnotation { +public class FisherStrand extends StandardVariantAnnotation { public Pair annotate(ReferenceContext ref, ReadBackedPileup pileup, List genotypes) { diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java index 1a1277e53..6bb34b7de 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java @@ -9,7 +9,7 @@ import org.broadinstitute.sting.utils.genotype.Genotype; import java.util.List; -public class HomopolymerRun implements VariantAnnotation { +public class HomopolymerRun extends StandardVariantAnnotation { public Pair annotate(ReferenceContext ref, ReadBackedPileup pileup, List genotypes) { diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java index 9a83d648b..3b31bac47 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java @@ -9,7 +9,7 @@ import net.sf.samtools.SAMRecord; import java.util.List; -public class MappingQualityZero implements VariantAnnotation { +public class MappingQualityZero extends StandardVariantAnnotation { public Pair annotate(ReferenceContext ref, ReadBackedPileup pileup, List genotypes) { List reads = pileup.getReads(); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/OnOffGenotype.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/OnOffGenotype.java index 1b7ee840b..801dac6cd 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/OnOffGenotype.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/OnOffGenotype.java @@ -10,7 +10,7 @@ import org.broadinstitute.sting.utils.genotype.DiploidGenotype; import java.util.List; import java.util.ArrayList; -public class OnOffGenotype implements VariantAnnotation { +public class OnOffGenotype extends StandardVariantAnnotation { public Pair annotate(ReferenceContext ref, ReadBackedPileup pileup, List genotypes) { diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java index 878f739f1..ba1df8824 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java @@ -10,7 +10,7 @@ import net.sf.samtools.SAMRecord; import java.util.List; -public class RMSMappingQuality implements VariantAnnotation { +public class RMSMappingQuality extends StandardVariantAnnotation { public Pair annotate(ReferenceContext ref, ReadBackedPileup pileup, List genotypes) { List reads = pileup.getReads(); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java index 58f5edc46..80dcb36fa 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java @@ -8,7 +8,7 @@ import org.broadinstitute.sting.utils.genotype.Genotype; import java.util.List; -public class SpanningDeletions implements VariantAnnotation { +public class SpanningDeletions extends StandardVariantAnnotation { public Pair annotate(ReferenceContext ref, ReadBackedPileup pileup, List genotypes) { int deletions = 0; diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/StandardVariantAnnotation.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/StandardVariantAnnotation.java new file mode 100755 index 000000000..e1fd0c74d --- /dev/null +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/StandardVariantAnnotation.java @@ -0,0 +1,6 @@ +package org.broadinstitute.sting.gatk.walkers.annotator; + + +public abstract class StandardVariantAnnotation implements VariantAnnotation { + +} \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java index a54089775..3ea563229 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java @@ -31,6 +31,8 @@ public class VariantAnnotator extends RodWalker { protected String[] ANNOTATIONS; @Argument(fullName="useAllAnnotations", shortName="all", doc="Use all possible annotations", required=false) protected Boolean USE_ALL_ANNOTATIONS = false; + @Argument(fullName="useStandardAnnotations", shortName="standard", doc="Use all standard annotations", required=false) + protected Boolean USE_STANDARD_ANNOTATIONS = false; @Argument(fullName="list", shortName="ls", doc="List the available annotations and exit") protected Boolean LIST = false; @@ -43,15 +45,19 @@ public class VariantAnnotator extends RodWalker { // mapping from class name to class private static HashMap allAnnotations = null; + private static HashMap standardAnnotations = null; private static void determineAllAnnotations() { allAnnotations = new HashMap(); + standardAnnotations = new HashMap(); List> annotationClasses = PackageUtils.getClassesImplementingInterface(VariantAnnotation.class); for ( Class c : annotationClasses ) { try { VariantAnnotation annot = (VariantAnnotation) c.newInstance(); allAnnotations.put(c.getSimpleName().toUpperCase(), annot); + if ( annot instanceof StandardVariantAnnotation ) + standardAnnotations.put(c.getSimpleName().toUpperCase(), annot); } catch (InstantiationException e) { throw new StingException(String.format("Cannot instantiate annotation class '%s': must be concrete class", c.getSimpleName())); } catch (IllegalAccessException e) { @@ -93,7 +99,9 @@ public class VariantAnnotator extends RodWalker { determineAllAnnotations(); - if ( USE_ALL_ANNOTATIONS ) { + if ( USE_STANDARD_ANNOTATIONS ) { + requestedAnnotations = new ArrayList(standardAnnotations.values()); + } else if ( USE_ALL_ANNOTATIONS ) { requestedAnnotations = new ArrayList(allAnnotations.values()); } else { requestedAnnotations = new ArrayList(); @@ -170,9 +178,9 @@ public class VariantAnnotator extends RodWalker { } public static Map getAnnotations(ReferenceContext ref, AlignmentContext context, List genotypes) { - if ( allAnnotations == null ) + if ( standardAnnotations == null ) determineAllAnnotations(); - return getAnnotations(ref, context, genotypes, allAnnotations.values()); + return getAnnotations(ref, context, genotypes, standardAnnotations.values()); } public static Map getAnnotations(ReferenceContext ref, AlignmentContext context, List genotypes, Collection annotations) { diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java index b88e88a31..ec97c7b8d 100755 --- a/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperIntegrationTest.java @@ -47,7 +47,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest { public void testMultiSamplePilot1PointEM() { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -R /broad/1KG/reference/human_b36_both.fasta -I /humgen/gsa-scr1/GATK_Data/Validation_Data/low_coverage_CEU.chr1.10k-11k.bam -varout %s -L 1:10,023,400-10,024,000 -bm empirical -gm EM_POINT_ESTIMATE -confidence 30", 1, - Arrays.asList("623d98aa3ad025b4bace1f5f3fe48a91")); + Arrays.asList("fbb3ae6e835df5cf9b99dae5bf1fa8e5")); executeTest("testMultiSamplePilot1 - Point Estimate EM", spec); } @@ -81,7 +81,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest { public void testMultiSamplePilot1Joint() { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -R /broad/1KG/reference/human_b36_both.fasta -I /humgen/gsa-scr1/GATK_Data/Validation_Data/low_coverage_CEU.chr1.10k-11k.bam -varout %s -L 1:10,022,000-10,025,000 -bm empirical -gm JOINT_ESTIMATE -confidence 30", 1, - Arrays.asList("348e874b121ce663404344290dd63d42")); + Arrays.asList("e1a206a49982f7db5c3f4b65aa910b3a")); executeTest("testMultiSamplePilot1 - Joint Estimate", spec); } @@ -89,7 +89,7 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest { public void testMultiSamplePilot2Joint() { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -R /broad/1KG/reference/human_b36_both.fasta -I /humgen/gsa-scr1/GATK_Data/Validation_Data/pilot2_daughters.chr20.10k-11k.bam -varout %s -L 20:10,000,000-10,050,000 -bm empirical -gm JOINT_ESTIMATE -confidence 30", 1, - Arrays.asList("49653e64ac0999ff1c9c5b129c689dea")); + Arrays.asList("cec6081d89ada9b2924fe38c7a021921")); executeTest("testMultiSamplePilot2 - Joint Estimate", spec); } @@ -97,17 +97,17 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest { public void testSingleSamplePilot2Joint() { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -R /broad/1KG/reference/human_b36_both.fasta -I /humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,100,000 -bm empirical -gm JOINT_ESTIMATE -confidence 30", 1, - Arrays.asList("b2e037adb2c6967d5eb041ae7268e035")); + Arrays.asList("0cd57b2b6272202db0eca45376fdb01d")); executeTest("testSingleSamplePilot2 - Joint Estimate", spec); } - @Test - public void testGLF() { - WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( - "-T UnifiedGenotyper -R /broad/1KG/reference/human_b36_both.fasta -I /humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,050,000 -bm empirical -gm JOINT_ESTIMATE -confidence 10", 1, - Arrays.asList("c552f3adcad91ee5f3ce42c204026a68")); - executeTest("testGLF", spec); - } + //@Test + //public void testGLF() { + // WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( + // "-T UnifiedGenotyper -R /broad/1KG/reference/human_b36_both.fasta -I /humgen/gsa-scr1/GATK_Data/Validation_Data/NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,050,000 -bm empirical -gm JOINT_ESTIMATE -confidence 10", 1, + // Arrays.asList("a95b871bc0bc984f66815b20db7467fe")); + // executeTest("testGLF", spec); + //} // -------------------------------------------------------------------------------------------------------------- //