InfoFieldAnnotation now an abstract class extended by annotations so doc system works

This commit is contained in:
Mark DePristo 2011-07-25 10:47:11 -04:00
parent 2039ce6102
commit 7f8e6a97ee
26 changed files with 35 additions and 29 deletions

View File

@ -42,7 +42,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class AlleleBalance implements InfoFieldAnnotation { public class AlleleBalance extends InfoFieldAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )

View File

@ -8,7 +8,7 @@ import java.util.Map;
public abstract class AnnotationByDepth implements InfoFieldAnnotation { public abstract class AnnotationByDepth extends InfoFieldAnnotation {
protected int annotationByVariantDepth(final Map<String, Genotype> genotypes, Map<String, AlignmentContext> stratifiedContexts) { protected int annotationByVariantDepth(final Map<String, Genotype> genotypes, Map<String, AlignmentContext> stratifiedContexts) {

View File

@ -46,7 +46,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class BaseCounts implements InfoFieldAnnotation { public class BaseCounts extends InfoFieldAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )

View File

@ -43,7 +43,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class ChromosomeCounts implements InfoFieldAnnotation, StandardAnnotation { public class ChromosomeCounts extends InfoFieldAnnotation implements StandardAnnotation {
private String[] keyNames = { VCFConstants.ALLELE_NUMBER_KEY, VCFConstants.ALLELE_COUNT_KEY, VCFConstants.ALLELE_FREQUENCY_KEY }; private String[] keyNames = { VCFConstants.ALLELE_NUMBER_KEY, VCFConstants.ALLELE_COUNT_KEY, VCFConstants.ALLELE_FREQUENCY_KEY };
private VCFInfoHeaderLine[] descriptions = { new VCFInfoHeaderLine(VCFConstants.ALLELE_FREQUENCY_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Float, "Allele Frequency, for each ALT allele, in the same order as listed"), private VCFInfoHeaderLine[] descriptions = { new VCFInfoHeaderLine(VCFConstants.ALLELE_FREQUENCY_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Float, "Allele Frequency, for each ALT allele, in the same order as listed"),

View File

@ -16,7 +16,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class DepthOfCoverage implements InfoFieldAnnotation, StandardAnnotation { public class DepthOfCoverage extends InfoFieldAnnotation implements StandardAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )

View File

@ -42,7 +42,7 @@ import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import java.util.*; import java.util.*;
public class FisherStrand implements InfoFieldAnnotation, StandardAnnotation { public class FisherStrand extends InfoFieldAnnotation implements StandardAnnotation {
private static final String FS = "FS"; private static final String FS = "FS";
private static final double MIN_PVALUE = 1E-320; private static final double MIN_PVALUE = 1E-320;

View File

@ -16,7 +16,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class GCContent implements InfoFieldAnnotation, ExperimentalAnnotation { public class GCContent extends InfoFieldAnnotation implements ExperimentalAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
double content = computeGCContent(ref); double content = computeGCContent(ref);

View File

@ -23,7 +23,7 @@ import java.util.Map;
*/ */
// A set of annotations calculated directly from the GLs // A set of annotations calculated directly from the GLs
public class GLstats implements InfoFieldAnnotation, StandardAnnotation { public class GLstats extends InfoFieldAnnotation implements StandardAnnotation {
private static final int MIN_SAMPLES = 10; private static final int MIN_SAMPLES = 10;

View File

@ -48,7 +48,7 @@ import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import java.util.*; import java.util.*;
public class HaplotypeScore implements InfoFieldAnnotation, StandardAnnotation { public class HaplotypeScore extends InfoFieldAnnotation implements StandardAnnotation {
private final static boolean DEBUG = false; private final static boolean DEBUG = false;
private final static int MIN_CONTEXT_WING_SIZE = 10; private final static int MIN_CONTEXT_WING_SIZE = 10;
private final static int MAX_CONSENSUS_HAPLOTYPES_TO_CONSIDER = 50; private final static int MAX_CONSENSUS_HAPLOTYPES_TO_CONSIDER = 50;

View File

@ -18,7 +18,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class HardyWeinberg implements InfoFieldAnnotation, WorkInProgressAnnotation { public class HardyWeinberg extends InfoFieldAnnotation implements WorkInProgressAnnotation {
private static final int MIN_SAMPLES = 10; private static final int MIN_SAMPLES = 10;
private static final int MIN_GENOTYPE_QUALITY = 10; private static final int MIN_GENOTYPE_QUALITY = 10;

View File

@ -16,7 +16,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class HomopolymerRun implements InfoFieldAnnotation, StandardAnnotation { public class HomopolymerRun extends InfoFieldAnnotation implements StandardAnnotation {
private boolean ANNOTATE_INDELS = true; private boolean ANNOTATE_INDELS = true;

View File

@ -19,7 +19,7 @@ import java.util.*;
* Time: 11:47:33 AM * Time: 11:47:33 AM
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
public class IndelType implements InfoFieldAnnotation, ExperimentalAnnotation { public class IndelType extends InfoFieldAnnotation implements ExperimentalAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {

View File

@ -16,7 +16,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class LowMQ implements InfoFieldAnnotation { public class LowMQ extends InfoFieldAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )

View File

@ -18,7 +18,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class MappingQualityZero implements InfoFieldAnnotation, StandardAnnotation { public class MappingQualityZero extends InfoFieldAnnotation implements StandardAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )

View File

@ -18,7 +18,7 @@ import java.util.Map;
public class MappingQualityZeroFraction implements InfoFieldAnnotation, ExperimentalAnnotation { public class MappingQualityZeroFraction extends InfoFieldAnnotation implements ExperimentalAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )

View File

@ -21,7 +21,7 @@ import java.util.Map;
* Date: 5/16/11 * Date: 5/16/11
*/ */
public class NBaseCount implements InfoFieldAnnotation { public class NBaseCount extends InfoFieldAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if( stratifiedContexts.size() == 0 ) if( stratifiedContexts.size() == 0 )
return null; return null;

View File

@ -16,7 +16,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class QualByDepth extends AnnotationByDepth implements InfoFieldAnnotation, StandardAnnotation { public class QualByDepth extends AnnotationByDepth implements StandardAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )

View File

@ -20,7 +20,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class RMSMappingQuality implements InfoFieldAnnotation, StandardAnnotation { public class RMSMappingQuality extends InfoFieldAnnotation implements StandardAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )

View File

@ -21,7 +21,7 @@ import java.util.Map;
public abstract class RankSumTest implements InfoFieldAnnotation, StandardAnnotation { public abstract class RankSumTest extends InfoFieldAnnotation implements StandardAnnotation {
static final double INDEL_LIKELIHOOD_THRESH = 0.1; static final double INDEL_LIKELIHOOD_THRESH = 0.1;
static final boolean DEBUG = false; static final boolean DEBUG = false;

View File

@ -41,7 +41,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class SampleList implements InfoFieldAnnotation { public class SampleList extends InfoFieldAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( vc.isMonomorphic() || !vc.hasGenotypes() ) if ( vc.isMonomorphic() || !vc.hasGenotypes() )

View File

@ -16,7 +16,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class SpanningDeletions implements InfoFieldAnnotation, StandardAnnotation { public class SpanningDeletions extends InfoFieldAnnotation implements StandardAnnotation {
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) { public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, AlignmentContext> stratifiedContexts, VariantContext vc) {
if ( stratifiedContexts.size() == 0 ) if ( stratifiedContexts.size() == 0 )

View File

@ -24,7 +24,7 @@ import java.util.Map;
* Time: 3:14 PM * Time: 3:14 PM
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
public class TechnologyComposition implements ExperimentalAnnotation,InfoFieldAnnotation { public class TechnologyComposition extends InfoFieldAnnotation implements ExperimentalAnnotation {
private String nSLX = "NumSLX"; private String nSLX = "NumSLX";
private String n454 ="Num454"; private String n454 ="Num454";
private String nSolid = "NumSOLiD"; private String nSolid = "NumSOLiD";

View File

@ -48,7 +48,7 @@ import java.util.Map.Entry;
* *
* For details, see: http://www.broadinstitute.org/gsa/wiki/index.php/GenomicAnnotator * For details, see: http://www.broadinstitute.org/gsa/wiki/index.php/GenomicAnnotator
*/ */
public class GenomicAnnotation implements InfoFieldAnnotation { public class GenomicAnnotation extends InfoFieldAnnotation {
public static final String CHR_COLUMN = "chr"; public static final String CHR_COLUMN = "chr";
public static final String START_COLUMN = "start"; public static final String START_COLUMN = "start";

View File

@ -4,20 +4,22 @@ 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.utils.codecs.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
import org.broadinstitute.sting.utils.variantcontext.VariantContext; 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 InfoFieldAnnotation { @DocumentedGATKFeature(enable = true, groupName = "VariantAnnotator INFO-field annotations", summary = "VariantAnnotator annotations, written to INFO Field")
public abstract class InfoFieldAnnotation {
// return annotations for the given contexts split by sample // return annotations for the given contexts split by sample
public 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 // return the INFO keys
public List<String> getKeyNames(); 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 List<VCFInfoHeaderLine> getDescriptions(); public abstract List<VCFInfoHeaderLine> getDescriptions();
} }

View File

@ -36,7 +36,7 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
public @interface DocumentedGATKFeature { public @interface DocumentedGATKFeature {
public boolean enable() default true; public boolean enable() default false;
public String groupName(); public String groupName();
public String summary() default ""; public String summary() default "";
public Class<? extends DocumentedGATKFeatureHandler> handler() default GenericDocumentationHandler.class; public Class<? extends DocumentedGATKFeatureHandler> handler() default GenericDocumentationHandler.class;

View File

@ -57,7 +57,7 @@ public class GATKDoclet {
* @throws java.io.IOException if output can't be written. * @throws java.io.IOException if output can't be written.
*/ */
public static boolean start(RootDoc rootDoc) throws IOException { public static boolean start(RootDoc rootDoc) throws IOException {
logger.setLevel(Level.INFO); logger.setLevel(Level.DEBUG);
// load arguments // load arguments
for(String[] options: rootDoc.options()) { for(String[] options: rootDoc.options()) {
if(options[0].equals("-build-timestamp")) if(options[0].equals("-build-timestamp"))
@ -95,6 +95,10 @@ public class GATKDoclet {
for ( ClassDoc doc : rootDoc.classes() ) { for ( ClassDoc doc : rootDoc.classes() ) {
logger.debug("Considering " + doc); logger.debug("Considering " + doc);
Class clazz = getClassForClassDoc(doc); Class clazz = getClassForClassDoc(doc);
if ( clazz != null && clazz.getName().equals("org.broadinstitute.sting.gatk.walkers.annotator.AlleleBalance"))
logger.debug("foo");
DocumentedGATKFeature feature = getFeatureForClassDoc(doc); DocumentedGATKFeature feature = getFeatureForClassDoc(doc);
DocumentedGATKFeatureHandler handler = createHandler(doc, feature); DocumentedGATKFeatureHandler handler = createHandler(doc, feature);
if ( handler != null && handler.shouldBeProcessed(doc) ) { if ( handler != null && handler.shouldBeProcessed(doc) ) {