Refactor so that GenotypeAnnotation and InfoFieldAnnotation share common superclass VariantAnnotatorAnnotation
This commit is contained in:
parent
7f8e6a97ee
commit
1a268ff1fd
|
|
@ -15,7 +15,7 @@ import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
public class AlleleBalanceBySample implements GenotypeAnnotation, ExperimentalAnnotation {
|
public class AlleleBalanceBySample extends GenotypeAnnotation implements ExperimentalAnnotation {
|
||||||
|
|
||||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext stratifiedContext, VariantContext vc, Genotype g) {
|
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext stratifiedContext, VariantContext vc, Genotype g) {
|
||||||
Double ratio = annotateSNP(stratifiedContext, vc, g);
|
Double ratio = annotateSNP(stratifiedContext, vc, g);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class DepthPerAlleleBySample implements GenotypeAnnotation, StandardAnnotation {
|
public class DepthPerAlleleBySample extends GenotypeAnnotation implements StandardAnnotation {
|
||||||
|
|
||||||
private static String REF_ALLELE = "REF";
|
private static String REF_ALLELE = "REF";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ import java.util.Map;
|
||||||
* Time: 6:46:25 PM
|
* Time: 6:46:25 PM
|
||||||
* To change this template use File | Settings | File Templates.
|
* To change this template use File | Settings | File Templates.
|
||||||
*/
|
*/
|
||||||
public class MappingQualityZeroBySample implements GenotypeAnnotation {
|
public class MappingQualityZeroBySample extends GenotypeAnnotation {
|
||||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref,
|
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref,
|
||||||
AlignmentContext context, VariantContext vc, Genotype g) {
|
AlignmentContext context, VariantContext vc, Genotype g) {
|
||||||
if ( g == null || !g.isCalled() )
|
if ( g == null || !g.isCalled() )
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ import java.util.Map;
|
||||||
* Time: 3:59:27 PM
|
* Time: 3:59:27 PM
|
||||||
* To change this template use File | Settings | File Templates.
|
* To change this template use File | Settings | File Templates.
|
||||||
*/
|
*/
|
||||||
public class ReadDepthAndAllelicFractionBySample implements GenotypeAnnotation {
|
public class ReadDepthAndAllelicFractionBySample extends GenotypeAnnotation {
|
||||||
|
|
||||||
private static String REF_ALLELE = "REF";
|
private static String REF_ALLELE = "REF";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,12 @@ import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public interface GenotypeAnnotation {
|
public abstract class GenotypeAnnotation extends VariantAnnotatorAnnotation {
|
||||||
|
|
||||||
// return annotations for the given contexts/genotype split by sample
|
// return annotations for the given contexts/genotype split by sample
|
||||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext stratifiedContext, VariantContext vc, Genotype g);
|
public abstract Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext stratifiedContext, VariantContext vc, Genotype g);
|
||||||
|
|
||||||
// return the FORMAT keys
|
|
||||||
public List<String> getKeyNames();
|
|
||||||
|
|
||||||
// return the descriptions used for the VCF FORMAT meta field
|
// return the descriptions used for the VCF FORMAT meta field
|
||||||
public List<VCFFormatHeaderLine> getDescriptions();
|
public abstract List<VCFFormatHeaderLine> getDescriptions();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ package org.broadinstitute.sting.gatk.walkers.annotator.interfaces;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
|
import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotator;
|
||||||
import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
|
import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
|
||||||
import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
|
import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
|
||||||
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||||
|
|
@ -10,16 +11,10 @@ import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@DocumentedGATKFeature(enable = true, groupName = "VariantAnnotator INFO-field annotations", summary = "VariantAnnotator annotations, written to INFO Field")
|
public abstract class InfoFieldAnnotation extends VariantAnnotatorAnnotation {
|
||||||
public abstract class InfoFieldAnnotation {
|
|
||||||
|
|
||||||
// return annotations for the given contexts split by sample
|
// return annotations for the given contexts split by sample
|
||||||
public abstract Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc);
|
public abstract Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc);
|
||||||
|
|
||||||
// return the INFO keys
|
|
||||||
public abstract List<String> getKeyNames();
|
|
||||||
|
|
||||||
// return the descriptions used for the VCF INFO meta field
|
// return the descriptions used for the VCF INFO meta field
|
||||||
public abstract List<VCFInfoHeaderLine> getDescriptions();
|
public abstract List<VCFInfoHeaderLine> getDescriptions();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2011, The Broad Institute
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use,
|
||||||
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following
|
||||||
|
* conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.broadinstitute.sting.gatk.walkers.annotator.interfaces;
|
||||||
|
|
||||||
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
|
import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
|
||||||
|
import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
|
||||||
|
import org.broadinstitute.sting.utils.variantcontext.VariantContext;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@DocumentedGATKFeature(enable = true, groupName = "VariantAnnotator annotations", summary = "VariantAnnotator annotations")
|
||||||
|
public abstract class VariantAnnotatorAnnotation {
|
||||||
|
// return the INFO keys
|
||||||
|
public abstract List<String> getKeyNames();
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue