From 5bbf1882c5ecc9ac58db35ac2e892af8a6921abe Mon Sep 17 00:00:00 2001 From: Laura Gauthier Date: Fri, 2 Aug 2019 11:35:35 -0400 Subject: [PATCH] Item #3 -- "Address my maintenance concerns about AnnotationUtils.isAlleleSpecific()" --- .../tools/walkers/annotator/AnnotationUtils.java | 11 +---------- .../annotator/allelespecific/AS_InbreedingCoeff.java | 2 +- .../annotator/allelespecific/AS_QualByDepth.java | 2 +- .../allelespecific/AS_RMSMappingQuality.java | 2 +- .../annotator/allelespecific/AS_RankSumTest.java | 2 +- .../annotator/allelespecific/AS_StrandBiasTest.java | 2 +- 6 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/AnnotationUtils.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/AnnotationUtils.java index 124045e9bd6..b167173bd93 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/AnnotationUtils.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/AnnotationUtils.java @@ -50,16 +50,7 @@ public static String encodeAnyASList( final List somethingList) { * @return true if the annotation is expected to have values per-allele */ public static boolean isAlleleSpecific(final InfoFieldAnnotation annotation) { - if (annotation instanceof AS_RankSumTest) { - return true; - } - if (annotation instanceof AS_StrandBiasTest) { - return true; - } - if (annotation instanceof AS_RMSMappingQuality) { - return true; - } - if (annotation instanceof AS_StandardAnnotation) { + if (annotation instanceof AlleleSpecificAnnotation) { return true; } return false; diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_InbreedingCoeff.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_InbreedingCoeff.java index 886397e7062..a3bb4f229bd 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_InbreedingCoeff.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_InbreedingCoeff.java @@ -40,7 +40,7 @@ */ //TODO: this can't extend InbreedingCoeff because that one is Standard and it would force this to be output all the time; should fix code duplication nonetheless @DocumentedFeature(groupName=HelpConstants.DOC_CAT_ANNOTATORS, groupSummary=HelpConstants.DOC_CAT_ANNOTATORS_SUMMARY, summary="Allele-specific likelihood-based test for the consanguinity among samples (AS_InbreedingCoeff)") -public final class AS_InbreedingCoeff extends InfoFieldAnnotation implements AS_StandardAnnotation { +public final class AS_InbreedingCoeff extends InfoFieldAnnotation implements AS_StandardAnnotation, AlleleSpecificAnnotation { public static final int MIN_SAMPLES = 10; private Set founderIds; //TODO: either use this or enter a bug report diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_QualByDepth.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_QualByDepth.java index 42066f1eecd..e3d21b64444 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_QualByDepth.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_QualByDepth.java @@ -46,7 +46,7 @@ * */ @DocumentedFeature(groupName=HelpConstants.DOC_CAT_ANNOTATORS, groupSummary=HelpConstants.DOC_CAT_ANNOTATORS_SUMMARY, summary="Allele-specific call confidence normalized by depth of sample reads supporting the allele (AS_QD)") -public class AS_QualByDepth extends InfoFieldAnnotation implements ReducibleAnnotation, AS_StandardAnnotation { +public class AS_QualByDepth extends InfoFieldAnnotation implements ReducibleAnnotation, AS_StandardAnnotation, AlleleSpecificAnnotation { @Override public List getKeyNames() { return Arrays.asList(GATKVCFConstants.AS_QUAL_BY_DEPTH_KEY); } diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_RMSMappingQuality.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_RMSMappingQuality.java index 5eaf0ed8d28..bd88f204fa0 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_RMSMappingQuality.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_RMSMappingQuality.java @@ -43,7 +43,7 @@ * */ @DocumentedFeature(groupName=HelpConstants.DOC_CAT_ANNOTATORS, groupSummary=HelpConstants.DOC_CAT_ANNOTATORS_SUMMARY, summary="Allele-specific root-mean-square of the mapping quality of reads across all samples (AS_MQ)") -public final class AS_RMSMappingQuality extends InfoFieldAnnotation implements AS_StandardAnnotation, ReducibleAnnotation { +public final class AS_RMSMappingQuality extends InfoFieldAnnotation implements AS_StandardAnnotation, ReducibleAnnotation, AlleleSpecificAnnotation { private final String printFormat = "%.2f"; diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_RankSumTest.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_RankSumTest.java index 77559e6197f..4565d5e5aef 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_RankSumTest.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_RankSumTest.java @@ -21,7 +21,7 @@ /** * Allele-specific implementation of rank sum test annotations */ -public abstract class AS_RankSumTest extends RankSumTest implements ReducibleAnnotation { +public abstract class AS_RankSumTest extends RankSumTest implements ReducibleAnnotation, AlleleSpecificAnnotation { private static final Logger logger = LogManager.getLogger(AS_RankSumTest.class); public static final String RAW_DELIM = ","; diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_StrandBiasTest.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_StrandBiasTest.java index d4fa7cd33bd..2ab6eba625d 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_StrandBiasTest.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/annotator/allelespecific/AS_StrandBiasTest.java @@ -18,7 +18,7 @@ /** * Allele-specific implementation of strand bias annotations */ -public abstract class AS_StrandBiasTest extends StrandBiasTest implements ReducibleAnnotation { +public abstract class AS_StrandBiasTest extends StrandBiasTest implements ReducibleAnnotation, AlleleSpecificAnnotation { private final static Logger logger = LogManager.getLogger(AS_StrandBiasTest.class); public static final String SPLIT_DELIM = "\\|"; //String.split takes a regex, so we need to escape the pipe public static final String PRINT_DELIM = "|";