From c040da427dc138e8ef896143e3f14ab8b80f2a4e Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Fri, 1 Apr 2016 00:12:41 -0400 Subject: [PATCH] Replace string literals for annotation groups. Closes #1216. --- .../gatk/tools/walkers/cancer/m2/MuTect2.java | 2 +- .../walkers/haplotypecaller/HaplotypeCaller.java | 4 +++- .../tools/walkers/variantutils/CombineGVCFs.java | 3 ++- .../tools/walkers/variantutils/GenotypeGVCFs.java | 14 ++++++++++---- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/cancer/m2/MuTect2.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/cancer/m2/MuTect2.java index aadfd905c..79299e87a 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/cancer/m2/MuTect2.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/cancer/m2/MuTect2.java @@ -1066,7 +1066,7 @@ public class MuTect2 extends ActiveRegionWalker, Integer> i * Which groups of annotations to add to the output VCF file. See the VariantAnnotator -list argument to view available groups. */ @Argument(fullName="group", shortName="G", doc="One or more classes/groups of annotations to apply to variant calls", required=false) - //protected String[] annotationGroupsToUse = { "Standard" }; + //protected String[] annotationGroupsToUse = { StandardAnnotation.class.getSimpleName() }; protected String[] annotationClassesToUse = { }; /** diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCaller.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCaller.java index 05c06cfd9..f85a254a8 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCaller.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/haplotypecaller/HaplotypeCaller.java @@ -62,6 +62,8 @@ import org.broadinstitute.gatk.engine.GenomeAnalysisEngine; import org.broadinstitute.gatk.engine.arguments.DbsnpArgumentCollection; import org.broadinstitute.gatk.engine.io.DirectOutputTracker; import org.broadinstitute.gatk.engine.io.stubs.SAMFileWriterStub; +import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.StandardAnnotation; +import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.StandardHCAnnotation; import org.broadinstitute.gatk.utils.contexts.AlignmentContext; import org.broadinstitute.gatk.utils.contexts.AlignmentContextUtils; import org.broadinstitute.gatk.utils.contexts.ReferenceContext; @@ -328,7 +330,7 @@ public class HaplotypeCaller extends ActiveRegionWalker, In * to provide a pedigree file for a pedigree-based annotation) may cause the run to fail. */ @Argument(fullName="group", shortName="G", doc="One or more classes/groups of annotations to apply to variant calls", required=false) - protected List annotationGroupsToUse = new ArrayList<>(Arrays.asList(new String[]{ "Standard", "StandardHCAnnotation" })); + protected List annotationGroupsToUse = new ArrayList<>(Arrays.asList(new String[]{StandardAnnotation.class.getSimpleName(), StandardHCAnnotation.class.getSimpleName() })); @ArgumentCollection private HaplotypeCallerArgumentCollection HCAC = new HaplotypeCallerArgumentCollection(); diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CombineGVCFs.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CombineGVCFs.java index 1a7fd423d..ca2988d81 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CombineGVCFs.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/variantutils/CombineGVCFs.java @@ -54,6 +54,7 @@ package org.broadinstitute.gatk.tools.walkers.variantutils; import org.broadinstitute.gatk.engine.arguments.DbsnpArgumentCollection; import org.broadinstitute.gatk.tools.walkers.annotator.VariantAnnotatorEngine; import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.AnnotatorCompatible; +import org.broadinstitute.gatk.tools.walkers.annotator.interfaces.StandardAnnotation; import org.broadinstitute.gatk.utils.commandline.*; import org.broadinstitute.gatk.engine.CommandLineGATK; import org.broadinstitute.gatk.utils.contexts.AlignmentContext; @@ -129,7 +130,7 @@ public class CombineGVCFs extends RodWalker annotationGroupsToUse = new ArrayList<>(Arrays.asList(new String[]{"Standard"})); + protected List annotationGroupsToUse = new ArrayList<>(Arrays.asList(new String[]{StandardAnnotation.class.getSimpleName()})); /** @@ -222,9 +224,13 @@ public class GenotypeGVCFs extends RodWalkeremptyList(), this, toolkit); // create the genotyping engine - boolean doAlleleSpecificGenotyping = annotationsToUse.contains(GATKVCFConstants.AS_QUAL_BY_DEPTH_KEY) || annotationGroupsToUse.contains("AS_Standard"); - genotypingEngine = new UnifiedGenotypingEngine(createUAC(), samples, toolkit.getGenomeLocParser(), GeneralPloidyFailOverAFCalculatorProvider.createThreadSafeProvider(toolkit, genotypeArgs, logger), - toolkit.getArguments().BAQMode, doAlleleSpecificGenotyping); + // when checking for presence of AS_StandardAnnotation we must deal with annoying feature that + // the class name with or without the trailing "Annotation" are both valid command lines + boolean doAlleleSpecificGenotyping = annotationsToUse.contains(GATKVCFConstants.AS_QUAL_BY_DEPTH_KEY) + || annotationGroupsToUse.contains(AS_StandardAnnotation.class.getSimpleName()) + || annotationGroupsToUse.contains(AS_StandardAnnotation.class.getSimpleName().replace("Annotation", "")); + genotypingEngine = new UnifiedGenotypingEngine(createUAC(), samples, toolkit.getGenomeLocParser(), + GeneralPloidyFailOverAFCalculatorProvider.createThreadSafeProvider(toolkit, genotypeArgs, logger), toolkit.getArguments().BAQMode, doAlleleSpecificGenotyping); // take care of the VCF headers final Set headerLines = VCFUtils.smartMergeHeaders(vcfRods.values(), true);