diff --git a/src/main/java/org/broadinstitute/hellbender/cmdline/StandardArgumentDefinitions.java b/src/main/java/org/broadinstitute/hellbender/cmdline/StandardArgumentDefinitions.java
index 6713293de6e..cbff502c7d1 100644
--- a/src/main/java/org/broadinstitute/hellbender/cmdline/StandardArgumentDefinitions.java
+++ b/src/main/java/org/broadinstitute/hellbender/cmdline/StandardArgumentDefinitions.java
@@ -33,6 +33,9 @@ private StandardArgumentDefinitions(){}
public static final String ADD_OUTPUT_SAM_PROGRAM_RECORD = "addOutputSAMProgramRecord";
public static final String ADD_OUTPUT_VCF_COMMANDLINE = "addOutputVCFCommandLine";
public static final String SEQUENCE_DICTIONARY_NAME = "sequenceDictionary";
+ public static final String ANNOTATION_LONG_NAME = "annotation";
+ public static final String ANNOTATION_GROUP_LONG_NAME = "annotationGroup";
+ public static final String ANNOTATIONS_TO_EXCLUDE_LONG_NAME = "annotationsToExclude";
public static final String INPUT_SHORT_NAME = "I";
public static final String OUTPUT_SHORT_NAME = "O";
@@ -65,6 +68,9 @@ private StandardArgumentDefinitions(){}
public static final String CLOUD_PREFETCH_BUFFER_SHORT_NAME = "CPB";
public static final String CLOUD_INDEX_PREFETCH_BUFFER_SHORT_NAME = "CIPB";
public static final String DISABLE_BAM_INDEX_CACHING_SHORT_NAME = "DBIC";
+ public static final String ANNOTATION_SHORT_NAME = "A";
+ public static final String ANNOTATION_GROUP_SHORT_NAME = "G";
+ public static final String ANNOTATIONS_TO_EXCLUDE_SHORT_NAME = "AX";
public static final String SPARK_PROPERTY_NAME = "conf";
diff --git a/src/main/java/org/broadinstitute/hellbender/cmdline/argumentcollections/VariantAnnotationArgumentCollection.java b/src/main/java/org/broadinstitute/hellbender/cmdline/argumentcollections/VariantAnnotationArgumentCollection.java
new file mode 100644
index 00000000000..ff279a76d6f
--- /dev/null
+++ b/src/main/java/org/broadinstitute/hellbender/cmdline/argumentcollections/VariantAnnotationArgumentCollection.java
@@ -0,0 +1,57 @@
+package org.broadinstitute.hellbender.cmdline.argumentcollections;
+
+import org.broadinstitute.barclay.argparser.Advanced;
+import org.broadinstitute.barclay.argparser.Argument;
+import org.broadinstitute.hellbender.cmdline.StandardArgumentDefinitions;
+import org.broadinstitute.hellbender.utils.Utils;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Arguments for requesting VariantContext annotations to be processed by {@link org.broadinstitute.hellbender.tools.walkers.annotator.VariantAnnotatorEngine}
+ * for tools that process variants objects.
+ */
+public class VariantAnnotationArgumentCollection implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Argument collection constructor which defines tool default annotation arguments when they are not overridden by the user
+ *
+ * @param defaultGroups List annotation group names to be used by default
+ * @param defaultAnnotations List of annotation class names to be used by default
+ * @param defaultAnnotationsToExclude List of annotation class names to exclude by default. These override the default annotations and annotation groups.
+ */
+ public VariantAnnotationArgumentCollection(List defaultGroups, List defaultAnnotations, List defaultAnnotationsToExclude) {
+ Utils.nonNull(defaultGroups);
+ Utils.nonNull(defaultAnnotations);
+ Utils.nonNull(defaultAnnotationsToExclude);
+
+ annotationGroupsToUse = new ArrayList<>(defaultGroups);
+ annotationsToUse = new ArrayList<>(defaultAnnotations);
+ annotationsToExclude = new ArrayList<>(defaultAnnotationsToExclude);
+ }
+
+ /**
+ * Which annotations to include in variant calls in the output. These supplement annotations provided by annotation groups.
+ */
+ @Argument(fullName=StandardArgumentDefinitions.ANNOTATION_LONG_NAME, shortName=StandardArgumentDefinitions.ANNOTATION_SHORT_NAME, doc="One or more specific annotations to add to variant calls", optional=true)
+ public List annotationsToUse = new ArrayList<>();
+
+ /**
+ * Which annotations to exclude from output in the variant calls. Note that this argument has higher priority than the
+ * -A or -G arguments, so these annotations will be excluded even if they are explicitly included with the other
+ * options.
+ */
+ @Argument(fullName=StandardArgumentDefinitions.ANNOTATIONS_TO_EXCLUDE_LONG_NAME, shortName=StandardArgumentDefinitions.ANNOTATIONS_TO_EXCLUDE_SHORT_NAME, doc="One or more specific annotations to exclude from variant calls", optional=true)
+ public List annotationsToExclude = new ArrayList<>();
+
+ /**
+ * Which groups of annotations to add to the output variant calls.
+ * Any requirements that are not met (e.g. failing to provide a pedigree file for a pedigree-based annotation) may cause the run to fail.
+ */
+ @Argument(fullName= StandardArgumentDefinitions.ANNOTATION_GROUP_LONG_NAME, shortName=StandardArgumentDefinitions.ANNOTATION_GROUP_SHORT_NAME, doc="One or more groups of annotations to apply to variant calls", optional=true)
+ public List annotationGroupsToUse = new ArrayList<>();
+
+}
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/HaplotypeCallerSpark.java b/src/main/java/org/broadinstitute/hellbender/tools/HaplotypeCallerSpark.java
index d71f18908bf..3e6dcd90b1f 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/HaplotypeCallerSpark.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/HaplotypeCallerSpark.java
@@ -207,7 +207,7 @@ public static JavaRDD callVariantsWithHaplotypeCaller(
final Broadcast referenceBroadcast = ctx.broadcast(reference);
final Broadcast hcArgsBroadcast = ctx.broadcast(hcArgs);
- final VariantAnnotatorEngine variantAnnotatorEngine = VariantAnnotatorEngine.ofSelectedMinusExcluded(hcArgs.annotationGroupsToUse, hcArgs.annotationsToUse, hcArgs.annotationsToExclude, hcArgs.dbsnp.dbsnp, hcArgs.comps);
+ final VariantAnnotatorEngine variantAnnotatorEngine = VariantAnnotatorEngine.ofSelectedMinusExcluded(hcArgs.variantAnnotationArgumentCollection, hcArgs.dbsnp.dbsnp, hcArgs.comps);
final Broadcast annotatorEngineBroadcast = ctx.broadcast(variantAnnotatorEngine);
final List shardBoundaries = getShardBoundaries(header, intervals, shardingArgs.readShardSize, shardingArgs.readShardPadding);
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/GenotypeGVCFs.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/GenotypeGVCFs.java
index 7d7545b0abc..4032cf31ac6 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/GenotypeGVCFs.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/GenotypeGVCFs.java
@@ -8,6 +8,7 @@
import org.broadinstitute.barclay.help.DocumentedFeature;
import org.broadinstitute.hellbender.cmdline.*;
import org.broadinstitute.hellbender.cmdline.argumentcollections.DbsnpArgumentCollection;
+import org.broadinstitute.hellbender.cmdline.argumentcollections.VariantAnnotationArgumentCollection;
import org.broadinstitute.hellbender.cmdline.programgroups.VariantProgramGroup;
import org.broadinstitute.hellbender.engine.*;
import org.broadinstitute.hellbender.tools.walkers.annotator.*;
@@ -94,26 +95,11 @@ public final class GenotypeGVCFs extends VariantWalker {
@ArgumentCollection
private GenotypeCalculationArgumentCollection genotypeArgs = new GenotypeCalculationArgumentCollection();
- /**
- * Which annotations to recompute for the combined output VCF file.
- */
- @Advanced
- @Argument(fullName="annotation", shortName="A", doc="One or more specific annotations to recompute", optional=true)
- private List annotationsToUse = new ArrayList<>();
-
-
- @Advanced
- @Argument(fullName="annotationsToExclude", shortName="AX", doc="One or more specific annotations to exclude from recomputation", optional=true)
- private List annotationsToExclude = new ArrayList<>();
-
- /**
- * This argument controls which groups of annotations to add to the output VCF file. Not recommended for normal
- * operation of the tool because it obscures the specific requirements of individual annotations. Any requirements
- * that are not met (e.g. failing to provide a pedigree file for a pedigree-based annotation) may cause the run to fail.
- */
- @Advanced
- @Argument(fullName="group", shortName="G", doc="One or more classes/groups of annotations to apply to variant calls", optional=true)
- private List annotationGroupsToUse = new ArrayList<>(Arrays.asList(new String[]{StandardAnnotation.class.getSimpleName()}));
+ @ArgumentCollection
+ private final VariantAnnotationArgumentCollection variantAnnotationArgumentCollection = new VariantAnnotationArgumentCollection(
+ Arrays.asList(StandardAnnotation.class.getSimpleName()),
+ Collections.emptyList(),
+ Collections.emptyList());
/**
* This option can only be activated if intervals are specified.
@@ -164,7 +150,7 @@ public void onTraversalStart() {
genotypingEngine = new MinimalGenotypingEngine(createUAC(), samples, new GeneralPloidyFailOverAFCalculatorProvider(genotypeArgs));
- annotationEngine = VariantAnnotatorEngine.ofSelectedMinusExcluded(annotationGroupsToUse, annotationsToUse, annotationsToExclude, dbsnp.dbsnp, Collections.emptyList());
+ annotationEngine = VariantAnnotatorEngine.ofSelectedMinusExcluded(variantAnnotationArgumentCollection, dbsnp.dbsnp, Collections.emptyList());
merger = new ReferenceConfidenceVariantContextMerger();
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/BaseQuality.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/BaseQuality.java
index 0a252130f95..a3650e40c22 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/BaseQuality.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/BaseQuality.java
@@ -1,9 +1,7 @@
package org.broadinstitute.hellbender.tools.walkers.annotator;
-import com.google.common.primitives.Doubles;
import com.google.common.primitives.Ints;
import htsjdk.variant.variantcontext.VariantContext;
-import org.apache.commons.math3.stat.descriptive.rank.Median;
import org.broadinstitute.hellbender.utils.GATKProtectedMathUtils;
import org.broadinstitute.hellbender.utils.Utils;
import org.broadinstitute.hellbender.utils.read.AlignmentUtils;
@@ -11,7 +9,6 @@
import org.broadinstitute.hellbender.utils.read.ReadUtils;
import java.util.List;
-import java.util.OptionalDouble;
import java.util.OptionalInt;
/**
@@ -19,7 +16,7 @@
*
* Created by David Benjamin on 3/20/17.
*/
-public class BaseQuality extends PerAlleleAnnotation {
+public class BaseQuality extends PerAlleleAnnotation implements StandardMutectAnnotation {
public static final String KEY = "MBQ";
@Override
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/Coverage.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/Coverage.java
index f4390a04c3d..f0d4cb6bac2 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/Coverage.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/Coverage.java
@@ -31,7 +31,7 @@
* DepthPerSampleHC calculates depth of coverage after filtering by HaplotypeCaller.
*
*/
-public final class Coverage extends InfoFieldAnnotation implements StandardAnnotation {
+public final class Coverage extends InfoFieldAnnotation implements StandardAnnotation, StandardMutectAnnotation {
@Override
public Map annotate(final ReferenceContext ref,
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/DepthPerAlleleBySample.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/DepthPerAlleleBySample.java
index f9cc6423c0e..4df9614cb91 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/DepthPerAlleleBySample.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/DepthPerAlleleBySample.java
@@ -34,7 +34,7 @@
* AlleleBalanceBySample calculates allele balance for each individual sample.
*
*/
-public final class DepthPerAlleleBySample extends GenotypeAnnotation implements StandardAnnotation {
+public final class DepthPerAlleleBySample extends GenotypeAnnotation implements StandardAnnotation, StandardMutectAnnotation {
@Override
public void annotate(final ReferenceContext ref,
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/FragmentLength.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/FragmentLength.java
index 5565d075510..0fb59f9a39b 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/FragmentLength.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/FragmentLength.java
@@ -1,15 +1,12 @@
package org.broadinstitute.hellbender.tools.walkers.annotator;
-import com.google.common.primitives.Doubles;
import com.google.common.primitives.Ints;
import htsjdk.variant.variantcontext.VariantContext;
-import org.apache.commons.math3.stat.descriptive.rank.Median;
import org.broadinstitute.hellbender.utils.GATKProtectedMathUtils;
import org.broadinstitute.hellbender.utils.Utils;
import org.broadinstitute.hellbender.utils.read.GATKRead;
import java.util.List;
-import java.util.OptionalDouble;
import java.util.OptionalInt;
/**
@@ -17,7 +14,7 @@
*
* Created by David Benjamin on 3/20/17.
*/
-public class FragmentLength extends PerAlleleAnnotation {
+public class FragmentLength extends PerAlleleAnnotation implements StandardMutectAnnotation {
public static final String KEY = "MFRL";
@Override
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/MappingQuality.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/MappingQuality.java
index 9eed1fcdcae..9b35ff0025d 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/MappingQuality.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/MappingQuality.java
@@ -1,17 +1,12 @@
package org.broadinstitute.hellbender.tools.walkers.annotator;
-import com.google.common.primitives.Doubles;
import com.google.common.primitives.Ints;
import htsjdk.variant.variantcontext.VariantContext;
-import org.apache.commons.math3.stat.descriptive.rank.Median;
import org.broadinstitute.hellbender.utils.GATKProtectedMathUtils;
import org.broadinstitute.hellbender.utils.Utils;
-import org.broadinstitute.hellbender.utils.read.AlignmentUtils;
import org.broadinstitute.hellbender.utils.read.GATKRead;
-import org.broadinstitute.hellbender.utils.read.ReadUtils;
import java.util.List;
-import java.util.OptionalDouble;
import java.util.OptionalInt;
/**
@@ -19,7 +14,7 @@
*
* Created by David Benjamin on 3/20/17.
*/
-public class MappingQuality extends PerAlleleAnnotation {
+public class MappingQuality extends PerAlleleAnnotation implements StandardMutectAnnotation {
public static final String KEY = "MMQ";
@Override
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/OxoGReadCounts.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/OxoGReadCounts.java
index 18ee9f38465..5c5882dad16 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/OxoGReadCounts.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/OxoGReadCounts.java
@@ -14,15 +14,11 @@
import org.broadinstitute.hellbender.utils.variant.GATKVCFConstants;
import org.broadinstitute.hellbender.utils.variant.GATKVCFHeaderLines;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
-import static org.broadinstitute.hellbender.utils.BaseUtils.Base.A;
-import static org.broadinstitute.hellbender.utils.BaseUtils.Base.C;
-
/**
* Count of read pairs in the F1R2 and F2R1 configurations supporting the reference and alternate alleles
@@ -36,7 +32,7 @@
* "Discovery and characterization of artefactual mutations in deep coverage targeted capture sequencing data due to oxidative DNA damage during sample preparation."
* by Costello et al.
*/
-public final class OxoGReadCounts extends GenotypeAnnotation {
+public final class OxoGReadCounts extends GenotypeAnnotation implements StandardMutectAnnotation {
@Override
public List getKeyNames() {
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/ReadPosition.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/ReadPosition.java
index 821d310800f..0ffd5bd2b22 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/ReadPosition.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/ReadPosition.java
@@ -16,7 +16,7 @@
*
* Created by David Benjamin on 3/20/17.
*/
-public class ReadPosition extends PerAlleleAnnotation {
+public class ReadPosition extends PerAlleleAnnotation implements StandardMutectAnnotation {
public static final String KEY = "MPOS";
@Override
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/StandardSomaticAnnotation.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/StandardMutectAnnotation.java
similarity index 58%
rename from src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/StandardSomaticAnnotation.java
rename to src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/StandardMutectAnnotation.java
index bb5196717c5..ed1e3f27377 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/StandardSomaticAnnotation.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/StandardMutectAnnotation.java
@@ -1,7 +1,7 @@
package org.broadinstitute.hellbender.tools.walkers.annotator;
/**
- * This is a marker interface used to indicate which annotations are "Standard" for MuTect only.
+ * This is a marker interface used to indicate which annotations are "Standard" for Mutect2 only.
*/
-public interface StandardSomaticAnnotation {
+public interface StandardMutectAnnotation extends Annotation {
}
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/StrandArtifact.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/StrandArtifact.java
index c850e0f1509..abefd5eabcf 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/StrandArtifact.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/StrandArtifact.java
@@ -21,7 +21,7 @@
*
* Created by tsato on 4/19/17.
*/
-public class StrandArtifact extends GenotypeAnnotation implements StandardSomaticAnnotation {
+public class StrandArtifact extends GenotypeAnnotation implements StandardMutectAnnotation {
public static final String POSTERIOR_PROBABILITIES_KEY = "SA_POST_PROB";
public static final String MAP_ALLELE_FRACTIONS_KEY = "SA_MAP_AF";
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/TandemRepeat.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/TandemRepeat.java
index b7d92d59108..51b6b55599f 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/TandemRepeat.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/TandemRepeat.java
@@ -24,7 +24,7 @@
*
*
*/
-public final class TandemRepeat extends InfoFieldAnnotation {
+public final class TandemRepeat extends InfoFieldAnnotation implements StandardMutectAnnotation {
@Override
public Map annotate(final ReferenceContext ref,
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/UniqueAltReadCount.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/UniqueAltReadCount.java
index 27b100b6d31..2bb88cc8413 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/UniqueAltReadCount.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/UniqueAltReadCount.java
@@ -35,7 +35,7 @@
* We filter the variant if the count is lower than a user-specified threshold.
* Mutect2FilteringEngine::applyDuplicatedAltReadFilter is the accompanying filter.
*/
-public class UniqueAltReadCount extends GenotypeAnnotation implements StandardSomaticAnnotation {
+public class UniqueAltReadCount extends GenotypeAnnotation {
public static final String UNIQUE_ALT_READ_SET_COUNT_KEY = "UNIQ_ALT_READ_COUNT";
@Override
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/VariantAnnotatorEngine.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/VariantAnnotatorEngine.java
index 9c586c3a532..f435ceb965c 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/VariantAnnotatorEngine.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/VariantAnnotatorEngine.java
@@ -4,6 +4,7 @@
import htsjdk.variant.variantcontext.*;
import htsjdk.variant.vcf.*;
import org.broadinstitute.barclay.argparser.CommandLineException;
+import org.broadinstitute.hellbender.cmdline.argumentcollections.VariantAnnotationArgumentCollection;
import org.broadinstitute.hellbender.engine.FeatureContext;
import org.broadinstitute.hellbender.engine.FeatureInput;
import org.broadinstitute.hellbender.engine.ReferenceContext;
@@ -79,6 +80,26 @@ public static VariantAnnotatorEngine ofSelectedMinusExcluded(final List
return new VariantAnnotatorEngine(AnnotationManager.ofSelectedMinusExcluded(annotationGroupsToUse, annotationsToUse, annotationsToExclude), dbSNPInput, comparisonFeatureInputs);
}
+ /**
+ * An overload of {@link org.broadinstitute.hellbender.tools.walkers.annotator.VariantAnnotatorEngine#ofSelectedMinusExcluded ofSelectedMinusExcluded}
+ * except that it accepts a {@link org.broadinstitute.hellbender.cmdline.argumentcollections.VariantAnnotationArgumentCollection} as input.
+ * @param argumentCollection VariantAnnotationArgumentCollection containing requested annotations.
+ * @param dbSNPInput input for variants from a known set from DbSNP or null if not provided.
+ * The annotation engine will mark variants overlapping anything in this set using {@link htsjdk.variant.vcf.VCFConstants#DBSNP_KEY}.
+ * @param comparisonFeatureInputs list of inputs with known variants.
+ * The annotation engine will mark variants overlapping anything in those sets using the name given by {@link FeatureInput#getName()}.
+ * Note: the DBSNP FeatureInput should be passed in separately, and not as part of this List - an GATKException will be thrown otherwise.
+ * Note: there are no non-DBSNP comparison FeatureInputs an empty List should be passed in here, rather than null.
+ * @return a VariantAnnotatorEngine initialized with the requested annotations
+ */
+ public static VariantAnnotatorEngine ofSelectedMinusExcluded(final VariantAnnotationArgumentCollection argumentCollection,
+ final FeatureInput dbSNPInput,
+ final List> comparisonFeatureInputs) {
+ return ofSelectedMinusExcluded(argumentCollection.annotationGroupsToUse,
+ argumentCollection.annotationsToUse,
+ argumentCollection.annotationsToExclude,
+ dbSNPInput, comparisonFeatureInputs);
+ }
private VariantOverlapAnnotator initializeOverlapAnnotator(final FeatureInput dbSNPInput, final List> featureInputs) {
final Map, String> overlaps = new LinkedHashMap<>();
for ( final FeatureInput fi : featureInputs) {
@@ -94,6 +115,7 @@ private VariantOverlapAnnotator initializeOverlapAnnotator(final FeatureInput annotationsToExclude = new ArrayList<>();
-
@Advanced
@Argument(fullName = "smithWaterman", shortName = "smithWaterman", doc = "Which Smith-Waterman implementation to use, generally FASTEST_AVAILABLE is the right choice", optional = true)
public SmithWatermanAligner.Implementation smithWatermanImplementation = SmithWatermanAligner.Implementation.FASTEST_AVAILABLE;
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerArgumentCollection.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerArgumentCollection.java
index 482220f85a0..9624387f024 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerArgumentCollection.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerArgumentCollection.java
@@ -2,10 +2,15 @@
import org.broadinstitute.barclay.argparser.Advanced;
import org.broadinstitute.barclay.argparser.Argument;
+import org.broadinstitute.barclay.argparser.ArgumentCollection;
+import org.broadinstitute.hellbender.cmdline.argumentcollections.VariantAnnotationArgumentCollection;
+import org.broadinstitute.hellbender.tools.walkers.annotator.StandardAnnotation;
+import org.broadinstitute.hellbender.tools.walkers.annotator.StandardHCAnnotation;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
/**
@@ -15,21 +20,15 @@ public class HaplotypeCallerArgumentCollection extends AssemblyBasedCallerArgume
private static final long serialVersionUID = 1L;
/**
- * Which annotations to add to the output VCF file. The single value 'none' removes the default annotations.
- * See the VariantAnnotator -list argument to view available annotations.
+ * When HaplotypeCaller is run with -ERC GVCF or -ERC BP_RESOLUTION, some annotations are excluded from the
+ * output by default because they will only be meaningful once they have been recalculated by GenotypeGVCFs. As
+ * of version 3.3 this concerns ChromosomeCounts, FisherStrand, StrandOddsRatio and QualByDepth.
*/
- @Advanced
- @Argument(fullName = "annotation", shortName = "A", doc = "One or more specific annotations to apply to variant calls", optional = true)
- public List annotationsToUse = new ArrayList<>();
-
- /**
- * Which groups of annotations to add to the output VCF file. The single value 'none' removes the default group. See
- * the VariantAnnotator -list argument to view available groups. Note that this usage is not recommended because
- * it obscures the specific requirements of individual annotations. Any requirements that are not met (e.g. failing
- * 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", optional = true)
- public List annotationGroupsToUse = new ArrayList<>(Arrays.asList(new String[]{"StandardAnnotation", "StandardHCAnnotation"}));
+ @ArgumentCollection
+ public VariantAnnotationArgumentCollection variantAnnotationArgumentCollection = new VariantAnnotationArgumentCollection(
+ Arrays.asList(StandardAnnotation.class.getSimpleName(), StandardHCAnnotation.class.getSimpleName()),
+ Collections.emptyList(),
+ Collections.emptyList());
/**
* You can use this argument to specify that HC should process a single sample out of a multisample BAM file. This
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerEngine.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerEngine.java
index 1c277c1b7fa..cab298797ac 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerEngine.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/haplotypecaller/HaplotypeCallerEngine.java
@@ -171,7 +171,7 @@ private void initialize(boolean createBamOutIndex, final boolean createBamOutMD5
initializeActiveRegionEvaluationGenotyperEngine();
if (annotationEngine == null) {
- annotationEngine = VariantAnnotatorEngine.ofSelectedMinusExcluded(hcArgs.annotationGroupsToUse, hcArgs.annotationsToUse, hcArgs.annotationsToExclude, hcArgs.dbsnp.dbsnp, hcArgs.comps);
+ annotationEngine = VariantAnnotatorEngine.ofSelectedMinusExcluded(hcArgs.variantAnnotationArgumentCollection, hcArgs.dbsnp.dbsnp, hcArgs.comps);
}
@@ -225,13 +225,13 @@ private void validateAndInitializeArgs() {
hcArgs.genotypeArgs.STANDARD_CONFIDENCE_FOR_CALLING = -0.0;
// also, we don't need to output several of the annotations
- hcArgs.annotationsToExclude.add(ChromosomeCounts.class.getSimpleName());
- hcArgs.annotationsToExclude.add(FisherStrand.class.getSimpleName());
- hcArgs.annotationsToExclude.add(StrandOddsRatio.class.getSimpleName());
- hcArgs.annotationsToExclude.add(QualByDepth.class.getSimpleName());
+ hcArgs.variantAnnotationArgumentCollection.annotationsToExclude.add(ChromosomeCounts.class.getSimpleName());
+ hcArgs.variantAnnotationArgumentCollection.annotationsToExclude.add(FisherStrand.class.getSimpleName());
+ hcArgs.variantAnnotationArgumentCollection.annotationsToExclude.add(StrandOddsRatio.class.getSimpleName());
+ hcArgs.variantAnnotationArgumentCollection.annotationsToExclude.add(QualByDepth.class.getSimpleName());
// but we definitely want certain other ones
- hcArgs.annotationsToUse.add(StrandBiasBySample.class.getSimpleName());
+ hcArgs.variantAnnotationArgumentCollection.annotationsToUse.add(StrandBiasBySample.class.getSimpleName());
logger.info("Standard Emitting and Calling confidence set to 0.0 for reference-model confidence output");
if ( ! hcArgs.annotateAllSitesWithPLs ) {
logger.info("All sites annotated with PLs forced to true for reference-model confidence output");
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/M2ArgumentCollection.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/M2ArgumentCollection.java
index d34b76233f2..d5ef3c0a845 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/M2ArgumentCollection.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/M2ArgumentCollection.java
@@ -1,15 +1,15 @@
package org.broadinstitute.hellbender.tools.walkers.mutect;
import htsjdk.variant.variantcontext.VariantContext;
-import org.broadinstitute.barclay.argparser.Advanced;
import org.broadinstitute.barclay.argparser.Argument;
-import org.broadinstitute.barclay.argparser.Hidden;
+import org.broadinstitute.barclay.argparser.ArgumentCollection;
+import org.broadinstitute.hellbender.cmdline.argumentcollections.VariantAnnotationArgumentCollection;
import org.broadinstitute.hellbender.engine.FeatureInput;
+import org.broadinstitute.hellbender.tools.walkers.annotator.StandardMutectAnnotation;
import org.broadinstitute.hellbender.tools.walkers.haplotypecaller.AssemblyBasedCallerArgumentCollection;
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.List;
+import java.util.Collections;
public class M2ArgumentCollection extends AssemblyBasedCallerArgumentCollection {
private static final long serialVersionUID = 9341L;
@@ -100,24 +100,15 @@ public class M2ArgumentCollection extends AssemblyBasedCallerArgumentCollection
@Argument(fullName = "normal_lod", optional = true, doc = "LOD threshold for calling normal variant non-germline.")
public double NORMAL_LOD_THRESHOLD = 2.2;
- /**
- * Which annotations to add to the output VCF file. By default the tool adds all of the following annotations.
- * If an annotation that a filter depends upon is absent, then the particular filtering will not occur and no warning will be given.
- */
- @Advanced
- @Argument(fullName="annotation", shortName="A", doc="One or more specific annotations to apply to variant calls.", optional = true)
- protected List annotationsToUse = new ArrayList<>(Arrays.asList(new String[]{"Coverage", "DepthPerAlleleBySample",
- "TandemRepeat", "OxoGReadCounts", "ReadPosition", "BaseQuality", "MappingQuality",
- "FragmentLength", "StrandArtifact"}));
/**
- * Which groups of annotations to add to the output VCF file. The single value 'none' removes the default group.
- * Note that this usage is not recommended because it obscures the specific requirements of individual annotations.
+ * Set of annotation arguments to use.
* Any requirements that are not met, e.g. failing to provide a pedigree file for a pedigree-based annotation, may cause the run to fail.
- * For somatic analyses, the StandardSomaticAnnotation group currently contains one annotations: StrandArtifact.
- * Note the latter is redundant to an annotation given by the --annotation argument default.
*/
- @Argument(fullName = "group", shortName = "G", doc = "One or more classes/groups of annotations to apply to variant calls", optional = true)
- public List annotationGroupsToUse = new ArrayList<>(Arrays.asList(new String[]{}));
+ @ArgumentCollection
+ VariantAnnotationArgumentCollection variantAnnotationArgumentCollection = new VariantAnnotationArgumentCollection(
+ Arrays.asList(StandardMutectAnnotation.class.getSimpleName()),
+ Collections.emptyList(),
+ Collections.emptyList());
}
diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2Engine.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2Engine.java
index 986ba13f7af..498872e691e 100644
--- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2Engine.java
+++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/mutect/Mutect2Engine.java
@@ -112,9 +112,7 @@ private void initialize(final boolean createBamOutIndex, final boolean createBam
" sample name " + MTAC.normalSampleName);
}
- annotationEngine = VariantAnnotatorEngine.ofSelectedMinusExcluded(MTAC.annotationGroupsToUse,
- MTAC.annotationsToUse,
- MTAC.annotationsToExclude,
+ annotationEngine = VariantAnnotatorEngine.ofSelectedMinusExcluded(MTAC.variantAnnotationArgumentCollection,
MTAC.dbsnp.dbsnp,
MTAC.comps);