diff --git a/java/src/org/broad/tribble/vcf/VCFCompoundHeaderLine.java b/java/src/org/broad/tribble/vcf/VCFCompoundHeaderLine.java new file mode 100644 index 000000000..da3370bf7 --- /dev/null +++ b/java/src/org/broad/tribble/vcf/VCFCompoundHeaderLine.java @@ -0,0 +1,120 @@ +package org.broad.tribble.vcf; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * a base class for compound header lines, which include info lines and format lines (so far) + */ +public abstract class VCFCompoundHeaderLine extends VCFHeaderLine { + public enum SupportedHeaderLineType { + INFO(true), FORMAT(false); + + public final boolean allowFlagValues; + SupportedHeaderLineType(boolean flagValues) { + allowFlagValues = flagValues; + } + + } + + // the field types + private String name; + private int count; + private String description; + private VCFHeaderLineType type; + + // access methods + public String getName() { return name; } + public int getCount() { return count; } + public String getDescription() { return description; } + public VCFHeaderLineType getType() { return type; } + + // our type of line, i.e. format, info, etc + private final SupportedHeaderLineType lineType; + + // line numerical values are allowed to be unbounded (or unknown), which is + // marked with a dot (.) + public static int UNBOUNDED = -1; // the value we store internally for unbounded types + public static String UNBOUNDED_ENCODING_VCF4 = "."; // the encoding for vcf 4 + public static String UNBOUNDED_ENCODING_VCF3 = "-1"; // the encoding for vcf 3 + + /** + * create a VCF format header line + * + * @param name the name for this header line + * @param count the count for this header line + * @param type the type for this header line + * @param description the description for this header line + */ + protected VCFCompoundHeaderLine(String name, int count, VCFHeaderLineType type, String description, SupportedHeaderLineType lineType) { + super(lineType.toString(), ""); + this.name = name; + this.count = count; + this.type = type; + this.description = description; + this.lineType = lineType; + } + + /** + * create a VCF format header line + * + * @param line the header line + * @param version the VCF header version + * + */ + protected VCFCompoundHeaderLine(String line, VCFHeaderVersion version, SupportedHeaderLineType lineType) { + super(lineType.toString(), "", version); + Map mapping = VCFHeaderLineTranslator.parseLine(version,line, Arrays.asList("ID","Number","Type","Description")); + name = mapping.get("ID"); + count = version == VCFHeaderVersion.VCF4_0 ? + mapping.get("Number").equals(UNBOUNDED_ENCODING_VCF4) ? UNBOUNDED : Integer.valueOf(mapping.get("Number")) : + mapping.get("Number").equals(UNBOUNDED_ENCODING_VCF3) ? UNBOUNDED : Integer.valueOf(mapping.get("Number")); + type = VCFHeaderLineType.valueOf(mapping.get("Type")); + if (type == VCFHeaderLineType.Flag && !allowFlagValues()) + throw new IllegalArgumentException("Flag is an unsupported type for this kind of field"); + description = mapping.get("Description"); + this.lineType = lineType; + } + + /** + * make a string representation of this header line + * @return a string representation + */ + protected String makeStringRep() { + if (mVersion == VCFHeaderVersion.VCF3_3 || mVersion == VCFHeaderVersion.VCF3_2) + return String.format(lineType.toString()+"=%s,%d,%s,\"%s\"", name, count, type.toString(), description); + else if (mVersion == VCFHeaderVersion.VCF4_0) { + Map map = new LinkedHashMap(); + map.put("ID", name); + // TODO: this next line should change when we have more than two used encoding schemes + map.put("Number", count == UNBOUNDED ? (mVersion == VCFHeaderVersion.VCF4_0 ? UNBOUNDED_ENCODING_VCF4 : UNBOUNDED_ENCODING_VCF3) : count); + map.put("Type", type); + map.put("Description", description); + return lineType.toString() + "=" + VCFHeaderLineTranslator.toValue(this.mVersion,map); + } + else throw new RuntimeException("Unsupported VCFVersion " + mVersion); + } + + /** + * returns true if we're equal to another compounder header line + * @param o a compound header line + * @return true if equal + */ + public boolean equals(Object o) { + if ( !(o instanceof VCFCompoundHeaderLine) ) + return false; + VCFCompoundHeaderLine other = (VCFCompoundHeaderLine)o; + return name.equals(other.name) && + count == other.count && + description.equals(other.description) && + type == other.type; + } + + /** + * do we allow flag (boolean) values? (i.e. booleans where you don't have specify the value, AQ means AQ=true) + * @return true if we do, false otherwise + */ + abstract boolean allowFlagValues(); + +} diff --git a/java/src/org/broad/tribble/vcf/VCFFilterHeaderLine.java b/java/src/org/broad/tribble/vcf/VCFFilterHeaderLine.java index afd988878..a2553175e 100755 --- a/java/src/org/broad/tribble/vcf/VCFFilterHeaderLine.java +++ b/java/src/org/broad/tribble/vcf/VCFFilterHeaderLine.java @@ -1,7 +1,5 @@ package org.broad.tribble.vcf; -import org.broad.tribble.util.ParsingUtils; - import java.util.Arrays; import java.util.LinkedHashMap; import java.util.Map; @@ -13,8 +11,8 @@ import java.util.Map; */ public class VCFFilterHeaderLine extends VCFHeaderLine { - private String mName; - private String mDescription; + private String name; + private String description; /** @@ -25,8 +23,8 @@ public class VCFFilterHeaderLine extends VCFHeaderLine { */ public VCFFilterHeaderLine(String name, String description) { super("FILTER", ""); - mName = name; - mDescription = description; + this.name = name; + this.description = description; } /** @@ -38,17 +36,17 @@ public class VCFFilterHeaderLine extends VCFHeaderLine { protected VCFFilterHeaderLine(String line, VCFHeaderVersion version) { super("FILTER", "", version); Map mapping = VCFHeaderLineTranslator.parseLine(version,line, Arrays.asList("ID","Description")); - mName = mapping.get("ID"); - mDescription = mapping.get("Description"); + name = mapping.get("ID"); + description = mapping.get("Description"); } protected String makeStringRep() { if (mVersion == VCFHeaderVersion.VCF3_3 || mVersion == VCFHeaderVersion.VCF3_2) - return String.format("FILTER=%s,\"%s\"", mName, mDescription); + return String.format("FILTER=%s,\"%s\"", name, description); else if (mVersion == VCFHeaderVersion.VCF4_0) { Map map = new LinkedHashMap(); - map.put("ID",mName); - map.put("Description",mDescription); + map.put("ID", name); + map.put("Description", description); return "FILTER=" + VCFHeaderLineTranslator.toValue(this.mVersion,map); } else throw new RuntimeException("Unsupported VCFVersion " + mVersion); @@ -58,15 +56,15 @@ public class VCFFilterHeaderLine extends VCFHeaderLine { if ( !(o instanceof VCFFilterHeaderLine) ) return false; VCFFilterHeaderLine other = (VCFFilterHeaderLine)o; - return mName.equals(other.mName) && - mDescription.equals(other.mDescription); + return name.equals(other.name) && + description.equals(other.description); } - public String getmName() { - return mName; + public String getName() { + return name; } - public String getmDescription() { - return mDescription; + public String getDescription() { + return description; } } \ No newline at end of file diff --git a/java/src/org/broad/tribble/vcf/VCFFormatHeaderLine.java b/java/src/org/broad/tribble/vcf/VCFFormatHeaderLine.java index 9f60127d8..c48c7c1c5 100755 --- a/java/src/org/broad/tribble/vcf/VCFFormatHeaderLine.java +++ b/java/src/org/broad/tribble/vcf/VCFFormatHeaderLine.java @@ -1,11 +1,5 @@ package org.broad.tribble.vcf; -import org.broad.tribble.util.ParsingUtils; - -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.Map; - /** * @author ebanks @@ -14,113 +8,21 @@ import java.util.Map; *

* A class representing a key=value entry for genotype FORMAT fields in the VCF header */ -public class VCFFormatHeaderLine extends VCFHeaderLine implements VCFNamedHeaderLine { +public class VCFFormatHeaderLine extends VCFCompoundHeaderLine { - // the format field types - public enum FORMAT_TYPE { - Integer, Float, String; - public Object convert(String value) { - switch (this) { - case Integer: - // Take care of case when string might have say "43.0" but we request an Integer. - return Math.round(java.lang.Float.valueOf(value)); // the java.lang is needed since we use Integer as a enum name - case Float: - return java.lang.Float.valueOf(value); - case String: - return value; - default: - throw new IllegalStateException("field." + this + " doesn't have a set conversion approach"); - } - } + public VCFFormatHeaderLine(String name, int count, VCFHeaderLineType type, String description) { + super(name, count, type, description, SupportedHeaderLineType.FORMAT); + if (type == VCFHeaderLineType.Flag) + throw new IllegalArgumentException("Flag is an unsupported type for format fields"); } - private String mName; - private int mCount; - private String mDescription; - private FORMAT_TYPE mType; - - // format line numerical values are allowed to be unbounded (or unknown), which is - // marked with a dot (.) - public static int UNBOUNDED = -1; - public static String UNBOUNDED_ENCODING_VCF4 = "."; - public static String UNBOUNDED_ENCODING_VCF3 = "-1"; - - /** - * create a VCF format header line - * - * @param name the name for this header line - * @param count the count for this header line - * @param type the type for this header line - * @param description the description for this header line - */ - public VCFFormatHeaderLine(String name, int count, FORMAT_TYPE type, String description) { - super("FORMAT", ""); - mName = name; - mCount = count; - mType = type; - mDescription = description; - } - - /** - * create a VCF format header line - * - * @param line the header line - * @param version the VCF header version - * - */ protected VCFFormatHeaderLine(String line, VCFHeaderVersion version) { - super("FORMAT", "", version); - Map mapping = VCFHeaderLineTranslator.parseLine(version,line, Arrays.asList("ID","Number","Type","Description")); - mName = mapping.get("ID"); - mCount = version == VCFHeaderVersion.VCF4_0 ? - mapping.get("Number").equals(UNBOUNDED_ENCODING_VCF4) ? UNBOUNDED : Integer.valueOf(mapping.get("Number")) : - mapping.get("Number").equals(UNBOUNDED_ENCODING_VCF3) ? UNBOUNDED : Integer.valueOf(mapping.get("Number")); - mType = FORMAT_TYPE.valueOf(mapping.get("Type")); - mDescription = mapping.get("Description"); + super(line, version, SupportedHeaderLineType.FORMAT); } - protected String makeStringRep() { - if (mVersion == VCFHeaderVersion.VCF3_3 || mVersion == VCFHeaderVersion.VCF3_2) - return String.format("FORMAT=%s,%d,%s,\"%s\"", mName, mCount, mType.toString(), mDescription); - else if (mVersion == VCFHeaderVersion.VCF4_0) { - Map map = new LinkedHashMap(); - map.put("ID",mName); - map.put("Number",mCount == UNBOUNDED ? (mVersion == VCFHeaderVersion.VCF4_0 ? UNBOUNDED_ENCODING_VCF4 : UNBOUNDED_ENCODING_VCF3) : mCount); - map.put("Type",mType); - map.put("Description",mDescription); - return "FORMAT=" + VCFHeaderLineTranslator.toValue(this.mVersion,map); - } - else throw new RuntimeException("Unsupported VCFVersion " + mVersion); - } - - public String getName() { return mName; } - public int getCount() { return mCount; } - public String getDescription() { return mDescription; } - public FORMAT_TYPE getType() { return mType; } - - public boolean equals(Object o) { - if ( !(o instanceof VCFFormatHeaderLine) ) - return false; - VCFFormatHeaderLine other = (VCFFormatHeaderLine)o; - return mName.equals(other.mName) && - mCount == other.mCount && - mDescription.equals(other.mDescription) && - mType == other.mType; - } - - public String getmName() { - return mName; - } - - public int getmCount() { - return mCount; - } - - public String getmDescription() { - return mDescription; - } - - public FORMAT_TYPE getmType() { - return mType; + // format fields do not allow flag values (that wouldn't make much sense, how would you encode this in the genotype). + @Override + boolean allowFlagValues() { + return false; } } \ No newline at end of file diff --git a/java/src/org/broad/tribble/vcf/VCFGenotypeRecord.java b/java/src/org/broad/tribble/vcf/VCFGenotypeRecord.java index c70a082d2..98b423cfb 100644 --- a/java/src/org/broad/tribble/vcf/VCFGenotypeRecord.java +++ b/java/src/org/broad/tribble/vcf/VCFGenotypeRecord.java @@ -9,7 +9,7 @@ import java.util.*; * * Class VCFGenotypeRecord * - * A descriptions should go here. Blame aaron if it's missing. + * the basics of a genotype call in VCF */ public class VCFGenotypeRecord { @@ -365,10 +365,10 @@ public class VCFGenotypeRecord { public static Set getSupportedHeaderStrings(VCFHeaderVersion version) { Set result = new HashSet(); - result.add(new VCFFormatHeaderLine(GENOTYPE_KEY, 1, VCFFormatHeaderLine.FORMAT_TYPE.String, "Genotype")); - result.add(new VCFFormatHeaderLine(GENOTYPE_QUALITY_KEY, 1, VCFFormatHeaderLine.FORMAT_TYPE.Float, "Genotype Quality")); - result.add(new VCFFormatHeaderLine(DEPTH_KEY, 1, VCFFormatHeaderLine.FORMAT_TYPE.Integer, "Read Depth (only filtered reads used for calling)")); - result.add(new VCFFormatHeaderLine(GENOTYPE_LIKELIHOODS_KEY, 3, VCFFormatHeaderLine.FORMAT_TYPE.Float, "Log-scaled likelihoods for AA,AB,BB genotypes where A=ref and B=alt; not applicable if site is not biallelic")); + result.add(new VCFFormatHeaderLine(GENOTYPE_KEY, 1, VCFHeaderLineType.String, "Genotype")); + result.add(new VCFFormatHeaderLine(GENOTYPE_QUALITY_KEY, 1, VCFHeaderLineType.Float, "Genotype Quality")); + result.add(new VCFFormatHeaderLine(DEPTH_KEY, 1, VCFHeaderLineType.Integer, "Read Depth (only filtered reads used for calling)")); + result.add(new VCFFormatHeaderLine(GENOTYPE_LIKELIHOODS_KEY, 3, VCFHeaderLineType.Float, "Log-scaled likelihoods for AA,AB,BB genotypes where A=ref and B=alt; not applicable if site is not biallelic")); //result.add(new VCFFormatHeaderLine(HAPLOTYPE_QUALITY_KEY, 1, VCFFormatHeaderLine.INFO_TYPE.Integer, "Haplotype Quality")); return result; } diff --git a/java/src/org/broad/tribble/vcf/VCFHeaderLineType.java b/java/src/org/broad/tribble/vcf/VCFHeaderLineType.java new file mode 100644 index 000000000..2ba2ecbad --- /dev/null +++ b/java/src/org/broad/tribble/vcf/VCFHeaderLineType.java @@ -0,0 +1,28 @@ +package org.broad.tribble.vcf; + +/** + * the type encodings we use for fields in VCF header lines + */ +public enum VCFHeaderLineType { + Integer, Float, String, Character, Flag; + + public Object convert(String value, VCFCompoundHeaderLine.SupportedHeaderLineType hlt) { + switch (this) { + case Integer: + return java.lang.Integer.valueOf(value); // the java.lang is needed since we use Integer as a enum name + case Float: + return java.lang.Float.valueOf(value); + case String: + return value; + case Character: + if (value.length()!= 0) + throw new IllegalStateException("INFO_TYPE." + this + " requires fields of length 1, what was provided was " + value); + return value; + case Flag: + if (hlt.allowFlagValues) + return value.equals("0") ? false : true; + default: + throw new IllegalStateException("INFO_TYPE." + this + " doesn't have a set conversion approach"); + } + } +} diff --git a/java/src/org/broad/tribble/vcf/VCFInfoHeaderLine.java b/java/src/org/broad/tribble/vcf/VCFInfoHeaderLine.java index b788e8156..7b8b69cbf 100755 --- a/java/src/org/broad/tribble/vcf/VCFInfoHeaderLine.java +++ b/java/src/org/broad/tribble/vcf/VCFInfoHeaderLine.java @@ -1,9 +1,5 @@ package org.broad.tribble.vcf; -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.Map; - /** * @author ebanks @@ -12,112 +8,19 @@ import java.util.Map; *

* A class representing a key=value entry for INFO fields in the VCF header */ -public class VCFInfoHeaderLine extends VCFHeaderLine implements VCFNamedHeaderLine { +public class VCFInfoHeaderLine extends VCFCompoundHeaderLine { - // the info field types - public enum INFO_TYPE { - Integer, Float, String, Character, Flag; - - public Object convert(String value) { - switch (this) { - case Integer: - return java.lang.Integer.valueOf(value); // the java.lang is needed since we use Integer as a enum name - case Float: - return java.lang.Float.valueOf(value); - case String: - case Character: - return value; - case Flag: - return value.equals("0") ? false : true; - default: - throw new IllegalStateException("INFO_TYPE." + this + " doesn't have a set conversion approach"); - } - } + public VCFInfoHeaderLine(String name, int count, VCFHeaderLineType type, String description) { + super(name, count, type, description, SupportedHeaderLineType.INFO); } - private String mName; - private int mCount; - private String mDescription; - private INFO_TYPE mType; - - - // info line numerical values are allowed to be unbounded (or unknown), which is - // marked with a dot (.) - public static int UNBOUNDED = -1; - public static String UNBOUNDED_ENCODING_VCF4 = "."; - public static String UNBOUNDED_ENCODING_VCF3 = "-1"; - - /** - * create a VCF info header line - * - * @param name the name for this header line - * @param count the count for this header line - * @param type the type for this header line - * @param description the description for this header line - */ - public VCFInfoHeaderLine(String name, int count, INFO_TYPE type, String description) { - super("INFO", ""); - mName = name; - mCount = count; - mType = type; - mDescription = description; - } - - /** - * create a VCF info header line - * - * @param line the header line - * @param version the VCF version - */ protected VCFInfoHeaderLine(String line, VCFHeaderVersion version) { - super("INFO", "", version); - Map mapping = VCFHeaderLineTranslator.parseLine(version,line, Arrays.asList("ID","Number","Type","Description")); - mName = mapping.get("ID"); - mCount = version == VCFHeaderVersion.VCF4_0 ? - mapping.get("Number").equals(UNBOUNDED_ENCODING_VCF4) ? UNBOUNDED : Integer.valueOf(mapping.get("Number")) : - mapping.get("Number").equals(UNBOUNDED_ENCODING_VCF3) ? UNBOUNDED : Integer.valueOf(mapping.get("Number")); - mType = INFO_TYPE.valueOf(mapping.get("Type")); - mDescription = mapping.get("Description"); - } - - protected String makeStringRep() { - if (mVersion == VCFHeaderVersion.VCF3_3 || mVersion == VCFHeaderVersion.VCF3_2) - return String.format("INFO=%s,%d,%s,\"%s\"", mName, mCount, mType.toString(), mDescription); - else if (mVersion == VCFHeaderVersion.VCF4_0) { - Map map = new LinkedHashMap(); - map.put("ID",mName); - map.put("Number",mCount == UNBOUNDED ? (mVersion == VCFHeaderVersion.VCF4_0 ? UNBOUNDED_ENCODING_VCF4 : UNBOUNDED_ENCODING_VCF3) : mCount); - map.put("Type",mType); - map.put("Description",mDescription); - return "INFO=" + VCFHeaderLineTranslator.toValue(this.mVersion,map); - } - else throw new RuntimeException("Unsupported VCFVersion " + mVersion); - } - - public boolean equals(Object o) { - if ( !(o instanceof VCFInfoHeaderLine) ) - return false; - VCFInfoHeaderLine other = (VCFInfoHeaderLine)o; - return mName.equals(other.mName) && - mCount == other.mCount && - mDescription.equals(other.mDescription) && - mType == other.mType; + super(line, version, SupportedHeaderLineType.INFO); } + // info fields allow flag values @Override - public String getmName() { - return mName; - } - - public int getmCount() { - return mCount; - } - - public String getmDescription() { - return mDescription; - } - - public INFO_TYPE getmType() { - return mType; + boolean allowFlagValues() { + return true; } } \ No newline at end of file diff --git a/java/src/org/broad/tribble/vcf/VCFNamedHeaderLine.java b/java/src/org/broad/tribble/vcf/VCFNamedHeaderLine.java index 8e9f1e20c..14f0a5d9d 100755 --- a/java/src/org/broad/tribble/vcf/VCFNamedHeaderLine.java +++ b/java/src/org/broad/tribble/vcf/VCFNamedHeaderLine.java @@ -24,13 +24,7 @@ package org.broad.tribble.vcf; -/** - * Created by IntelliJ IDEA. - * User: depristo - * Date: Jul 2, 2010 - * Time: 2:40:45 PM - * To change this template use File | Settings | File Templates. - */ +/** an interface for named header lines **/ public interface VCFNamedHeaderLine { - String getmName(); + String getName(); } diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4Codec.java b/java/src/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4Codec.java index 18797cd1b..75eda244f 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4Codec.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4Codec.java @@ -54,8 +54,8 @@ public class VCF4Codec implements FeatureCodec, NameAwareCodec { private String[] genotypeKeyArray = new String[100]; // a mapping of the VCF fields to their type, filter fields, and format fields, for quick lookup to validate against - TreeMap infoFields = new TreeMap(); - TreeMap formatFields = new TreeMap(); + TreeMap infoFields = new TreeMap(); + TreeMap formatFields = new TreeMap(); ArrayList filterFields = new ArrayList(); // do we want to validate the info, format, and filter fields @@ -113,11 +113,11 @@ public class VCF4Codec implements FeatureCodec, NameAwareCodec { // setup our look-up lists for validation for (VCFHeaderLine hl : headerLines) { if (hl.getClass() == VCFFilterHeaderLine.class) - this.filterFields.add(((VCFFilterHeaderLine)hl).getmName()); + this.filterFields.add(((VCFFilterHeaderLine)hl).getName()); if (hl.getClass() == VCFFormatHeaderLine.class) - this.formatFields.put(((VCFFormatHeaderLine)hl).getmName(),((VCFFormatHeaderLine)hl).getmType()); + this.formatFields.put(((VCFFormatHeaderLine)hl).getName(),((VCFFormatHeaderLine)hl).getType()); if (hl.getClass() == VCFInfoHeaderLine.class) - this.infoFields.put(((VCFInfoHeaderLine)hl).getmName(),((VCFInfoHeaderLine)hl).getmType()); + this.infoFields.put(((VCFInfoHeaderLine)hl).getName(),((VCFInfoHeaderLine)hl).getType()); } // sort the lists so we can binary search them later on Collections.sort(filterFields); @@ -223,13 +223,13 @@ public class VCF4Codec implements FeatureCodec, NameAwareCodec { List objects = new ArrayList(); String[] split = str.split(","); for (String substring : split) { - VCFInfoHeaderLine.INFO_TYPE type = infoFields.get(key); - objects.add(type != null ? type.convert(substring) : substring); + VCFHeaderLineType type = infoFields.get(key); + objects.add(type != null ? type.convert(substring,VCFCompoundHeaderLine.SupportedHeaderLineType.INFO) : substring); } value = objects; } else { - VCFInfoHeaderLine.INFO_TYPE type = infoFields.get(key); - value = type != null ? type.convert(str) : str; + VCFHeaderLineType type = infoFields.get(key); + value = type != null ? type.convert(str,VCFCompoundHeaderLine.SupportedHeaderLineType.INFO) : str; } //System.out.printf("%s %s%n", key, value); } else { diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/Alignability.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/Alignability.java index ffdf8bf49..e01fd44db 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/Alignability.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/Alignability.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -37,5 +38,5 @@ public class Alignability implements InfoFieldAnnotation { public List getKeyNames() { return Arrays.asList("Alignability"); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Alignability according to a mask file (3 is best, 0 is worst)")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Integer, "Alignability according to a mask file (3 is best, 0 is worst)")); } } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java index 3ac64aa6a..a86c34479 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java @@ -25,6 +25,7 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -109,5 +110,5 @@ public class AlleleBalance implements InfoFieldAnnotation, StandardAnnotation { public List getKeyNames() { return Arrays.asList("AB"); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("AB", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Allele Balance for hets (ref/(ref+alt))")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("AB", 1, VCFHeaderLineType.Float, "Allele Balance for hets (ref/(ref+alt))")); } } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseQualityRankSumTest.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseQualityRankSumTest.java index b322f2a2b..c76082e3e 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseQualityRankSumTest.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseQualityRankSumTest.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; import org.broadinstitute.sting.utils.pileup.PileupElement; @@ -12,7 +13,7 @@ public class BaseQualityRankSumTest /*extends RankSumTest*/ { // todo -- seems math in this test is dubious, need to recheck and verify (p-values wildly divergent from R or MATLAB) public List getKeyNames() { return Arrays.asList("BaseQRankSum"); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("BaseQRankSum", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Phred-scaled p-value From Wilcoxon Rank Sum Test of Het Vs. Ref Base Qualities")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("BaseQRankSum", 1, VCFHeaderLineType.Float, "Phred-scaled p-value From Wilcoxon Rank Sum Test of Het Vs. Ref Base Qualities")); } protected void fillQualsFromPileup(byte ref, char alt, ReadBackedPileup pileup, List refQuals, List altQuals) { for ( PileupElement p : pileup ) { diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ChromosomeCounts.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ChromosomeCounts.java index a0183b118..347f7e2aa 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ChromosomeCounts.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ChromosomeCounts.java @@ -25,6 +25,7 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFRecord; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; @@ -39,9 +40,9 @@ import java.util.*; public class ChromosomeCounts implements InfoFieldAnnotation, StandardAnnotation { private String[] keyNames = { VCFRecord.ALLELE_NUMBER_KEY, VCFRecord.ALLELE_COUNT_KEY, VCFRecord.ALLELE_FREQUENCY_KEY }; - private VCFInfoHeaderLine[] descriptions = { new VCFInfoHeaderLine(VCFRecord.ALLELE_FREQUENCY_KEY, -1, VCFInfoHeaderLine.INFO_TYPE.Float, "Allele Frequency"), - new VCFInfoHeaderLine(VCFRecord.ALLELE_COUNT_KEY, -1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Allele count in genotypes, for each ALT allele, in the same order as listed"), - new VCFInfoHeaderLine(VCFRecord.ALLELE_NUMBER_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Total number of alleles in called genotypes") }; + private VCFInfoHeaderLine[] descriptions = { new VCFInfoHeaderLine(VCFRecord.ALLELE_FREQUENCY_KEY, -1, VCFHeaderLineType.Float, "Allele Frequency"), + new VCFInfoHeaderLine(VCFRecord.ALLELE_COUNT_KEY, -1, VCFHeaderLineType.Integer, "Allele count in genotypes, for each ALT allele, in the same order as listed"), + new VCFInfoHeaderLine(VCFRecord.ALLELE_NUMBER_KEY, 1, VCFHeaderLineType.Integer, "Total number of alleles in called genotypes") }; public Map annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map stratifiedContexts, VariantContext vc) { diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java index ca2de7047..3f5190bdf 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFRecord; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; @@ -30,5 +31,5 @@ public class DepthOfCoverage implements InfoFieldAnnotation, StandardAnnotation public List getKeyNames() { return Arrays.asList(VCFRecord.DEPTH_KEY); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Total Depth")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Integer, "Total Depth")); } } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java index d660e901f..81c2c746a 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java @@ -1,6 +1,7 @@ package org.broadinstitute.sting.gatk.walkers.annotator; import org.broad.tribble.vcf.VCFFormatHeaderLine; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broadinstitute.sting.gatk.contexts.*; import org.broadinstitute.sting.gatk.contexts.variantcontext.*; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; @@ -93,5 +94,5 @@ public class DepthPerAlleleBySample implements GenotypeAnnotation, ExperimentalA public List getKeyNames() { return Arrays.asList("AD"); } - public List getDescriptions() { return Arrays.asList(new VCFFormatHeaderLine(getKeyNames().get(0), -1, VCFFormatHeaderLine.FORMAT_TYPE.Integer, "Depth in genotypes for each ALT allele, in the same order as listed")); } + public List getDescriptions() { return Arrays.asList(new VCFFormatHeaderLine(getKeyNames().get(0), -1, VCFHeaderLineType.Integer, "Depth in genotypes for each ALT allele, in the same order as listed")); } } \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GCContent.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GCContent.java index 9e6003481..a63a1f75d 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GCContent.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GCContent.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -25,7 +26,7 @@ public class GCContent implements InfoFieldAnnotation, ExperimentalAnnotation { public List getKeyNames() { return Arrays.asList("GC"); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("GC", 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "GC content within 20 bp +/- the variant")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("GC", 1, VCFHeaderLineType.Integer, "GC content within 20 bp +/- the variant")); } public boolean useZeroQualityReads() { return false; } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java index e0e636084..719ab8fe0 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java @@ -25,6 +25,7 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -280,5 +281,5 @@ public class HaplotypeScore implements InfoFieldAnnotation, StandardAnnotation { } public List getKeyNames() { return Arrays.asList("HaplotypeScore"); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HaplotypeScore", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Consistency of the site with two (and only two) segregating haplotypes")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HaplotypeScore", 1, VCFHeaderLineType.Float, "Consistency of the site with two (and only two) segregating haplotypes")); } } \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HardyWeinberg.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HardyWeinberg.java index 036f267f3..5705347c1 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HardyWeinberg.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HardyWeinberg.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -63,5 +64,5 @@ public class HardyWeinberg implements InfoFieldAnnotation, WorkInProgressAnnotat public List getKeyNames() { return Arrays.asList("HW"); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HW", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Phred-scaled p-value for Hardy-Weinberg violation")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HW", 1, VCFHeaderLineType.Float, "Phred-scaled p-value for Hardy-Weinberg violation")); } } \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java index fa4df7288..2545e7717 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -40,7 +41,7 @@ public class HomopolymerRun implements InfoFieldAnnotation, StandardAnnotation { public List getKeyNames() { return Arrays.asList("HRun"); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HRun", 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Largest Contiguous Homopolymer Run of Variant Allele In Either Direction")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HRun", 1, VCFHeaderLineType.Integer, "Largest Contiguous Homopolymer Run of Variant Allele In Either Direction")); } public boolean useZeroQualityReads() { return false; } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/LowMQ.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/LowMQ.java index c7cfc0955..fcd87c3ec 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/LowMQ.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/LowMQ.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -41,5 +42,5 @@ public class LowMQ implements InfoFieldAnnotation { public List getKeyNames() { return Arrays.asList("LowMQ"); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 3, VCFInfoHeaderLine.INFO_TYPE.Integer, "3-tuple: ,,")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 3, VCFHeaderLineType.Integer, "3-tuple: ,,")); } } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityRankSumTest.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityRankSumTest.java index 5062919cb..1c9c9312e 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityRankSumTest.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityRankSumTest.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; import org.broadinstitute.sting.utils.pileup.PileupElement; @@ -12,7 +13,7 @@ public class MappingQualityRankSumTest /*extends RankSumTest*/ { public List getKeyNames() { return Arrays.asList("MQRankSum"); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("MQRankSum", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Phred-scaled p-value From Wilcoxon Rank Sum Test of Het Vs. Ref Read Mapping Qualities")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("MQRankSum", 1, VCFHeaderLineType.Float, "Phred-scaled p-value From Wilcoxon Rank Sum Test of Het Vs. Ref Read Mapping Qualities")); } protected void fillQualsFromPileup(byte ref, char alt, ReadBackedPileup pileup, List refQuals, List altQuals) { for ( PileupElement p : pileup ) { diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java index 66322d36c..a7ee2ae2b 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -37,5 +38,5 @@ public class MappingQualityZero implements InfoFieldAnnotation, StandardAnnotati public List getKeyNames() { return Arrays.asList("MQ0"); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Total Mapping Quality Zero Reads")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Integer, "Total Mapping Quality Zero Reads")); } } \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java index e21306ec8..898309e92 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -37,7 +38,7 @@ public class QualByDepth implements InfoFieldAnnotation, StandardAnnotation { public List getKeyNames() { return Arrays.asList("QD"); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Variant Confidence/Quality by Depth")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Float, "Variant Confidence/Quality by Depth")); } private int variationQualByDepth(final Map genotypes, Map stratifiedContexts) { int depth = 0; diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualityAdjustedSecondBaseLod.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualityAdjustedSecondBaseLod.java index b60eb13c7..4bb323d99 100644 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualityAdjustedSecondBaseLod.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualityAdjustedSecondBaseLod.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -21,7 +22,7 @@ public class QualityAdjustedSecondBaseLod implements InfoFieldAnnotation, Experi public List getKeyNames() { return Arrays.asList(KEY_NAME); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME, 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Adjusted residual quality based on second-base skew")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME, 1, VCFHeaderLineType.Float, "Adjusted residual quality based on second-base skew")); } public Map annotate( RefMetaDataTracker tracker, ReferenceContext ref, Map contexts, VariantContext vc) { String chi = skewCalc.getAnnotation(ref, contexts, vc); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java index bdad04063..bf3c98116 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFRecord; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; @@ -39,5 +40,5 @@ public class RMSMappingQuality implements InfoFieldAnnotation, StandardAnnotatio public List getKeyNames() { return Arrays.asList(VCFRecord.RMS_MAPPING_QUALITY_KEY); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Float, "RMS Mapping Quality")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Float, "RMS Mapping Quality")); } } \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SecondBaseSkew.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SecondBaseSkew.java index 01cdd9de2..fe1122a1e 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SecondBaseSkew.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SecondBaseSkew.java @@ -25,6 +25,7 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.utils.collections.Pair; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; @@ -50,7 +51,7 @@ public class SecondBaseSkew implements InfoFieldAnnotation, ExperimentalAnnotati public List getKeyNames() { return Arrays.asList(KEY_NAME); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME, 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Chi-square Secondary Base Skew")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME, 1, VCFHeaderLineType.Float, "Chi-square Secondary Base Skew")); } public Map annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map stratifiedContexts, VariantContext vc) { if ( stratifiedContexts.size() == 0 ) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java index 403b22663..49c5bb533 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -35,5 +36,5 @@ public class SpanningDeletions implements InfoFieldAnnotation, StandardAnnotatio public List getKeyNames() { return Arrays.asList("Dels"); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("Dels", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Fraction of Reads Containing Spanning Deletions")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("Dels", 1, VCFHeaderLineType.Float, "Fraction of Reads Containing Spanning Deletions")); } } \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorEngine.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorEngine.java index c125fa198..16e400669 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorEngine.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorEngine.java @@ -38,9 +38,7 @@ import java.util.Set; import java.util.Map.Entry; import org.broad.tribble.dbsnp.DbSNPFeature; -import org.broad.tribble.vcf.VCFHeaderLine; -import org.broad.tribble.vcf.VCFInfoHeaderLine; -import org.broad.tribble.vcf.VCFRecord; +import org.broad.tribble.vcf.*; import org.broadinstitute.sting.gatk.GenomeAnalysisEngine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -178,7 +176,7 @@ public class VariantAnnotatorEngine { for ( GenotypeAnnotation annotation : requestedGenotypeAnnotations ) descriptions.addAll(annotation.getDescriptions()); for ( Map.Entry dbSet : dbAnnotations.entrySet() ) - descriptions.add(new VCFInfoHeaderLine(dbSet.getValue(), 0, VCFInfoHeaderLine.INFO_TYPE.Flag, (dbSet.getKey().equals(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME) ? "dbSNP" : dbSet.getValue()) + " Membership")); + descriptions.add(new VCFInfoHeaderLine(dbSet.getValue(), 0, VCFHeaderLineType.Flag, (dbSet.getKey().equals(DbSNPHelper.STANDARD_DBSNP_TRACK_NAME) ? "dbSNP" : dbSet.getValue()) + " Membership")); return descriptions; } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/concordance/IndelSubsets.java b/java/src/org/broadinstitute/sting/gatk/walkers/concordance/IndelSubsets.java index af64530fc..9f4d0f0dc 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/concordance/IndelSubsets.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/concordance/IndelSubsets.java @@ -1,8 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.concordance; -import org.broad.tribble.vcf.VCFGenotypeRecord; -import org.broad.tribble.vcf.VCFInfoHeaderLine; -import org.broad.tribble.vcf.VCFRecord; +import org.broad.tribble.vcf.*; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.StingException; @@ -103,5 +101,5 @@ public class IndelSubsets implements ConcordanceType { } public String getInfoName() { return "IndelSubsets"; } - public VCFInfoHeaderLine getInfoDescription() { return new VCFInfoHeaderLine(getInfoName(), 1, VCFInfoHeaderLine.INFO_TYPE.String, "Indel-related subsets"); } + public VCFInfoHeaderLine getInfoDescription() { return new VCFInfoHeaderLine(getInfoName(), 1, VCFHeaderLineType.String, "Indel-related subsets"); } } \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/concordance/NWayVenn.java b/java/src/org/broadinstitute/sting/gatk/walkers/concordance/NWayVenn.java index 5cb852300..eb50ad78f 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/concordance/NWayVenn.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/concordance/NWayVenn.java @@ -1,6 +1,7 @@ package org.broadinstitute.sting.gatk.walkers.concordance; import org.broad.tribble.vcf.VCFGenotypeRecord; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; @@ -41,5 +42,5 @@ public class NWayVenn implements ConcordanceType { } public String getInfoName() { return "NwayVenn"; } - public VCFInfoHeaderLine getInfoDescription() { return new VCFInfoHeaderLine(getInfoName(), 1, VCFInfoHeaderLine.INFO_TYPE.String, "N-way Venn split"); } + public VCFInfoHeaderLine getInfoDescription() { return new VCFInfoHeaderLine(getInfoName(), 1, VCFHeaderLineType.String, "N-way Venn split"); } } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/concordance/SNPGenotypeConcordance.java b/java/src/org/broadinstitute/sting/gatk/walkers/concordance/SNPGenotypeConcordance.java index 095180cb9..fd8cdca8f 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/concordance/SNPGenotypeConcordance.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/concordance/SNPGenotypeConcordance.java @@ -1,6 +1,7 @@ package org.broadinstitute.sting.gatk.walkers.concordance; import org.broad.tribble.vcf.VCFGenotypeRecord; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.utils.StingException; @@ -116,5 +117,5 @@ public class SNPGenotypeConcordance implements ConcordanceType { } public String getInfoName() { return "SnpConcordance"; } - public VCFInfoHeaderLine getInfoDescription() { return new VCFInfoHeaderLine(getInfoName(), 1, VCFInfoHeaderLine.INFO_TYPE.String, "SNP concordance test"); } + public VCFInfoHeaderLine getInfoDescription() { return new VCFInfoHeaderLine(getInfoName(), 1, VCFHeaderLineType.String, "SNP concordance test"); } } \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/concordance/SimpleVenn.java b/java/src/org/broadinstitute/sting/gatk/walkers/concordance/SimpleVenn.java index 1e7c9f6eb..480dedb1e 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/concordance/SimpleVenn.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/concordance/SimpleVenn.java @@ -1,8 +1,6 @@ package org.broadinstitute.sting.gatk.walkers.concordance; -import org.broad.tribble.vcf.VCFGenotypeRecord; -import org.broad.tribble.vcf.VCFInfoHeaderLine; -import org.broad.tribble.vcf.VCFRecord; +import org.broad.tribble.vcf.*; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.utils.StingException; @@ -64,5 +62,5 @@ public class SimpleVenn implements ConcordanceType { } public String getInfoName() { return "Venn"; } - public VCFInfoHeaderLine getInfoDescription() { return new VCFInfoHeaderLine(getInfoName(), 1, VCFInfoHeaderLine.INFO_TYPE.String, "2-way Venn split"); } + public VCFInfoHeaderLine getInfoDescription() { return new VCFInfoHeaderLine(getInfoName(), 1, VCFHeaderLineType.String, "2-way Venn split"); } } diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/filters/VariantFiltrationWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/filters/VariantFiltrationWalker.java index a2382738b..18219ad72 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/filters/VariantFiltrationWalker.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/filters/VariantFiltrationWalker.java @@ -100,7 +100,7 @@ public class VariantFiltrationWalker extends RodWalker { hInfo.add(new VCFFilterHeaderLine(exp.name, exp.exp.toString())); if ( genotypeFilterExps.size() > 0 ) - hInfo.add(new VCFFormatHeaderLine(VCFGenotypeRecord.GENOTYPE_FILTER_KEY, 1, VCFFormatHeaderLine.FORMAT_TYPE.String, "Genotype-level filter")); + hInfo.add(new VCFFormatHeaderLine(VCFGenotypeRecord.GENOTYPE_FILTER_KEY, 1, VCFHeaderLineType.String, "Genotype-level filter")); List dataSources = getToolkit().getRodDataSources(); for ( ReferenceOrderedDataSource source : dataSources ) { diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java index 1fc81e759..b12951b84 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java @@ -141,13 +141,13 @@ public class UnifiedGenotyper extends LocusWalker { Set hInfo = new HashSet(); hInfo.add(new VCFHeaderLine("source", "SequenomValidationConverter")); hInfo.add(new VCFHeaderLine("reference", getToolkit().getArguments().referenceFile.getName())); - hInfo.add(new VCFInfoHeaderLine("NoCallPct", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Percent of no-calls")); - hInfo.add(new VCFInfoHeaderLine("HomRefPct", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Percent of homozygous reference genotypes")); - hInfo.add(new VCFInfoHeaderLine("HetPct", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Percent of heterozygous genotypes")); - hInfo.add(new VCFInfoHeaderLine("HomVarPct", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Percent homozygous variant genotypes")); - hInfo.add(new VCFInfoHeaderLine("HW", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Phred-scaled Hardy-Weinberg violation p-value")); - hInfo.add(new VCFInfoHeaderLine(VCFRecord.ALLELE_COUNT_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Allele count in genotypes, for each ALT allele, in the same order as listed")); - hInfo.add(new VCFInfoHeaderLine(VCFRecord.ALLELE_NUMBER_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Total number of alleles in called genotypes")); + hInfo.add(new VCFInfoHeaderLine("NoCallPct", 1, VCFHeaderLineType.Float, "Percent of no-calls")); + hInfo.add(new VCFInfoHeaderLine("HomRefPct", 1, VCFHeaderLineType.Float, "Percent of homozygous reference genotypes")); + hInfo.add(new VCFInfoHeaderLine("HetPct", 1, VCFHeaderLineType.Float, "Percent of heterozygous genotypes")); + hInfo.add(new VCFInfoHeaderLine("HomVarPct", 1, VCFHeaderLineType.Float, "Percent homozygous variant genotypes")); + hInfo.add(new VCFInfoHeaderLine("HW", 1, VCFHeaderLineType.Float, "Phred-scaled Hardy-Weinberg violation p-value")); + hInfo.add(new VCFInfoHeaderLine(VCFRecord.ALLELE_COUNT_KEY, 1, VCFHeaderLineType.Integer, "Allele count in genotypes, for each ALT allele, in the same order as listed")); + hInfo.add(new VCFInfoHeaderLine(VCFRecord.ALLELE_NUMBER_KEY, 1, VCFHeaderLineType.Integer, "Total number of alleles in called genotypes")); hInfo.add(new VCFFilterHeaderLine("HardyWeinbergViolation", "The validation is in Hardy-Weinberg violation")); hInfo.add(new VCFFilterHeaderLine("HighNoCallRate", "The validation no-call rate is too high")); hInfo.add(new VCFFilterHeaderLine("TooManyHomVars", "The validation homozygous variant rate is too high")); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/ApplyVariantCuts.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/ApplyVariantCuts.java index e1b235dd8..f70512f10 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/ApplyVariantCuts.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/ApplyVariantCuts.java @@ -25,8 +25,6 @@ package org.broadinstitute.sting.gatk.walkers.variantrecalibration; -import Jama.Matrix; -import org.broad.tribble.dbsnp.DbSNPFeature; import org.broad.tribble.vcf.*; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; @@ -47,7 +45,6 @@ import org.broadinstitute.sting.utils.text.XReadLines; import java.io.File; import java.io.FileNotFoundException; -import java.io.IOException; import java.util.*; /** @@ -107,7 +104,7 @@ public class ApplyVariantCuts extends RodWalker { // setup the header fields final Set hInfo = new HashSet(); hInfo.addAll(VCFUtils.getHeaderFields(getToolkit())); - hInfo.add(new VCFInfoHeaderLine("OQ", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "The original variant quality score")); + hInfo.add(new VCFInfoHeaderLine("OQ", 1, VCFHeaderLineType.Float, "The original variant quality score")); hInfo.add(new VCFHeaderLine("source", "VariantOptimizer")); vcfWriter = new VCFWriter( new File(OUTPUT_FILENAME) ); final TreeSet samples = new TreeSet(); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrator.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrator.java index 782d37f2f..ec777d751 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrator.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrator.java @@ -39,7 +39,6 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker; import org.broadinstitute.sting.utils.*; import org.broadinstitute.sting.utils.collections.ExpandingArrayList; import org.broadinstitute.sting.commandline.Argument; -import org.broadinstitute.sting.utils.genotype.vcf.VCFReader; import org.broadinstitute.sting.utils.genotype.vcf.VCFUtils; import org.broadinstitute.sting.utils.genotype.vcf.VCFWriter; @@ -134,7 +133,7 @@ public class VariantRecalibrator extends RodWalker samples = new TreeSet(); final List dataSources = this.getToolkit().getRodDataSources(); hInfo.addAll(VCFUtils.getHeaderFields(getToolkit())); - hInfo.add(new VCFInfoHeaderLine("OQ", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "The original variant quality score")); + hInfo.add(new VCFInfoHeaderLine("OQ", 1, VCFHeaderLineType.Float, "The original variant quality score")); hInfo.add(new VCFHeaderLine("source", "VariantOptimizer")); samples.addAll(SampleUtils.getUniqueSamplesFromRods(getToolkit())); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/CombineVariants.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/CombineVariants.java index 456b0748f..2313b11d1 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/CombineVariants.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/CombineVariants.java @@ -109,7 +109,7 @@ public class CombineVariants extends RodWalker { //System.out.printf("Merging in header %s%n", source); for ( VCFHeaderLine line : source.getMetaData()) { String key = line.getKey(); - if ( line instanceof VCFNamedHeaderLine ) key = key + "." + ((VCFNamedHeaderLine) line).getmName(); + if ( line instanceof VCFNamedHeaderLine ) key = key + "." + ((VCFNamedHeaderLine) line).getName(); if ( map.containsKey(key) ) { VCFHeaderLine other = map.get(key); @@ -119,13 +119,13 @@ public class CombineVariants extends RodWalker { else if ( ! line.getClass().equals(other.getClass()) ) throw new IllegalStateException("Incompatible header types: " + line + " " + other ); else if ( line instanceof VCFFilterHeaderLine ) { - String lineName = ((VCFFilterHeaderLine) line).getmName(); - String otherName = ((VCFFilterHeaderLine) other).getmName(); + String lineName = ((VCFFilterHeaderLine) line).getName(); + String otherName = ((VCFFilterHeaderLine) other).getName(); if ( ! lineName.equals(otherName) ) throw new IllegalStateException("Incompatible header types: " + line + " " + other ); } else { - //String lineName = ((VCFInfoHeaderLine) line).getmName(); - //String otherName = ((VCFFilterHeaderLine) other).getmName(); + //String lineName = ((VCFInfoHeaderLine) line).getName(); + //String otherName = ((VCFFilterHeaderLine) other).getName(); // todo -- aaron, please complete these comparisons when INFO and Format header lines are made into one //if ( (lineType != null && ! lineType.equals(otherType)) || (lineCount != null && !lineCounts.equals(otherCount))) diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelAnnotator.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelAnnotator.java index c3feb4030..6b01b45e5 100644 --- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelAnnotator.java +++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelAnnotator.java @@ -1,10 +1,7 @@ package org.broadinstitute.sting.oneoffprojects.walkers; import org.broad.tribble.FeatureReader; -import org.broad.tribble.vcf.VCFHeader; -import org.broad.tribble.vcf.VCFHeaderLine; -import org.broad.tribble.vcf.VCFInfoHeaderLine; -import org.broad.tribble.vcf.VCFRecord; +import org.broad.tribble.vcf.*; import org.broadinstitute.sting.commandline.Argument; import org.broadinstitute.sting.gatk.contexts.AlignmentContext; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; @@ -13,7 +10,6 @@ import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqCodec; import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqFeature; import org.broadinstitute.sting.gatk.refdata.tracks.builders.TribbleRMDTrackBuilder; import org.broadinstitute.sting.gatk.refdata.utils.FeatureToGATKFeatureIterator; -import org.broadinstitute.sting.gatk.refdata.utils.GATKFeatureIterator; import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList; import org.broadinstitute.sting.gatk.walkers.RodWalker; import org.broadinstitute.sting.utils.SampleUtils; @@ -83,7 +79,7 @@ public class IndelAnnotator extends RodWalker{ hInfo.add(new VCFHeaderLine("source", "IndelAnnotator")); hInfo.add(new VCFHeaderLine("annotatorReference", getToolkit().getArguments().referenceFile.getName())); HashSet anno = new HashSet(); - anno.add(new VCFInfoHeaderLine("type",1,VCFInfoHeaderLine.INFO_TYPE.String,"Genomic interpretation (according to RefSeq)")); + anno.add(new VCFInfoHeaderLine("type",1, VCFHeaderLineType.String,"Genomic interpretation (according to RefSeq)")); hInfo.addAll(anno); vcfWriter = new VCFWriter(out); diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/InsertSizeDistribution.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/InsertSizeDistribution.java index 620e9c988..aad365972 100644 --- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/InsertSizeDistribution.java +++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/InsertSizeDistribution.java @@ -1,4 +1,5 @@ package org.broadinstitute.sting.oneoffprojects.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -22,7 +23,7 @@ import java.util.Arrays; public class InsertSizeDistribution implements InfoFieldAnnotation { private final long INSERT_SIZE_LOWER_BOUND = 500; public List getKeyNames() { return Arrays.asList("INSIZE"); } - public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0),1,VCFInfoHeaderLine.INFO_TYPE.Integer,"Do not use this if your name is not Chris")); } + public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0),1, VCFHeaderLineType.Integer,"Do not use this if your name is not Chris")); } public Map annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map context, VariantContext variant) { int weirdInsertSizeReads = 0; diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfNonrefBasesSupportingSNP.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfNonrefBasesSupportingSNP.java index 5a146e771..12c618ce3 100644 --- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfNonrefBasesSupportingSNP.java +++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfNonrefBasesSupportingSNP.java @@ -25,6 +25,7 @@ package org.broadinstitute.sting.oneoffprojects.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; @@ -53,7 +54,7 @@ public class ProportionOfNonrefBasesSupportingSNP implements InfoFieldAnnotation public List getKeyNames() { return Arrays.asList(KEY_NAME); } public List getDescriptions() { - return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME,1,VCFInfoHeaderLine.INFO_TYPE.Float,"Simple proportion of non-reference bases that are the SNP base")); + return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME,1, VCFHeaderLineType.Float,"Simple proportion of non-reference bases that are the SNP base")); } public Map annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map context, VariantContext vc) { diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfRefSecondBasesSupportingSNP.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfRefSecondBasesSupportingSNP.java index 2f22c6432..0544f6f67 100644 --- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfRefSecondBasesSupportingSNP.java +++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfRefSecondBasesSupportingSNP.java @@ -25,6 +25,7 @@ package org.broadinstitute.sting.oneoffprojects.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation; @@ -98,6 +99,6 @@ public class ProportionOfRefSecondBasesSupportingSNP implements InfoFieldAnnotat public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME, - 1,VCFInfoHeaderLine.INFO_TYPE.Float,"Simple proportion of second best base calls for reference base that support the SNP base")); + 1, VCFHeaderLineType.Float,"Simple proportion of second best base calls for reference base that support the SNP base")); } } diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfSNPSecondBasesSupportingRef.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfSNPSecondBasesSupportingRef.java index ba2fb12cd..4a82299bd 100644 --- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfSNPSecondBasesSupportingRef.java +++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfSNPSecondBasesSupportingRef.java @@ -25,6 +25,7 @@ package org.broadinstitute.sting.oneoffprojects.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -106,7 +107,7 @@ public class ProportionOfSNPSecondBasesSupportingRef implements InfoFieldAnnotat public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME, - 1,VCFInfoHeaderLine.INFO_TYPE.Float,"Simple proportion of second best base calls for SNP base that support the Ref base")); + 1, VCFHeaderLineType.Float,"Simple proportion of second best base calls for SNP base that support the Ref base")); } diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ThousandGenomesAnnotator.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ThousandGenomesAnnotator.java index 994d75fe7..de1c6c1c5 100644 --- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ThousandGenomesAnnotator.java +++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ThousandGenomesAnnotator.java @@ -1,5 +1,6 @@ package org.broadinstitute.sting.oneoffprojects.walkers.annotator; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broad.tribble.vcf.VCFRecord; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; @@ -27,7 +28,7 @@ public class ThousandGenomesAnnotator implements InfoFieldAnnotation { public List getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), - 1,VCFInfoHeaderLine.INFO_TYPE.String,"Is this site seen in Pilot1 or Pilot2 of 1KG?")); + 1, VCFHeaderLineType.String,"Is this site seen in Pilot1 or Pilot2 of 1KG?")); } public Map annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map context, VariantContext vc) { diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/BeagleOutputToVCFWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/BeagleOutputToVCFWalker.java index a583cd7c9..c2297698d 100755 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/BeagleOutputToVCFWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/BeagleOutputToVCFWalker.java @@ -33,15 +33,12 @@ import org.broadinstitute.sting.gatk.contexts.variantcontext.*; import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrderedDataSource; import org.broadinstitute.sting.gatk.refdata.features.beagle.BeagleFeature; import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; -import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum; import org.broadinstitute.sting.gatk.refdata.VariantContextAdaptors; import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack; -import org.broadinstitute.sting.gatk.walkers.DataSource; import org.broadinstitute.sting.gatk.walkers.RodWalker; import org.broadinstitute.sting.gatk.walkers.RMD; import org.broadinstitute.sting.gatk.walkers.Requires; import org.broadinstitute.sting.utils.GenomeLoc; -import org.broadinstitute.sting.utils.StingException; import org.broadinstitute.sting.utils.genotype.vcf.VCFReader; import org.broadinstitute.sting.utils.genotype.vcf.VCFUtils; import org.broadinstitute.sting.utils.genotype.vcf.VCFWriter; @@ -82,7 +79,7 @@ public class BeagleOutputToVCFWalker extends RodWalker { final Set hInfo = new HashSet(); hInfo.addAll(VCFUtils.getHeaderFields(getToolkit())); - hInfo.add(new VCFInfoHeaderLine("R2", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "r2 Value reported by Beable on each site")); + hInfo.add(new VCFInfoHeaderLine("R2", 1, VCFHeaderLineType.Float, "r2 Value reported by Beable on each site")); hInfo.add(new VCFHeaderLine("source", "BeagleImputation")); final List dataSources = this.getToolkit().getRodDataSources(); diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/annotator/GenomicAnnotation.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/annotator/GenomicAnnotation.java index d51d37de8..13ac6ae7e 100644 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/annotator/GenomicAnnotation.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/annotator/GenomicAnnotation.java @@ -28,6 +28,7 @@ package org.broadinstitute.sting.playground.gatk.walkers.annotator; import java.util.*; import java.util.Map.Entry; +import org.broad.tribble.vcf.VCFHeaderLineType; import org.broad.tribble.vcf.VCFInfoHeaderLine; import org.broadinstitute.sting.gatk.contexts.ReferenceContext; import org.broadinstitute.sting.gatk.contexts.StratifiedAlignmentContext; @@ -209,8 +210,8 @@ public class GenomicAnnotation implements InfoFieldAnnotation { * bindingName.columnName1=column1Value, bindingName.columnName2=column2Value * (eg. dbSNP.avHet=0.7, dbSNP.ref_allele=A) * - * @param annotatorInputTableFeature AnnotatorInputTableFeature corresponding to one record in one -B input file. - * @param name The binding name of the given AnnotatorInputTableFeature. + * @param record AnnotatorInputTableFeature corresponding to one record in one -B input file. + * @param bindingName The binding name of the given AnnotatorInputTableFeature. * @return The map of columnName -> columnValue pairs. */ public static Map convertRecordToAnnotations( String bindingName, Map record) { @@ -255,7 +256,7 @@ public class GenomicAnnotation implements InfoFieldAnnotation { public List getDescriptions() { - return Arrays.asList(new VCFInfoHeaderLine("GenericAnnotation", 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "For each variant in the 'variants' ROD, finds all entries in the other -B files that overlap the variant's position. ")); + return Arrays.asList(new VCFInfoHeaderLine("GenericAnnotation", 1, VCFHeaderLineType.Integer, "For each variant in the 'variants' ROD, finds all entries in the other -B files that overlap the variant's position. ")); } public List getKeyNames() { diff --git a/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFWriter.java b/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFWriter.java index 4f7da63b7..f0fff117e 100644 --- a/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFWriter.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFWriter.java @@ -7,7 +7,6 @@ import org.broadinstitute.sting.gatk.contexts.variantcontext.Genotype; import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContext; import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.MathUtils; -import org.broadinstitute.sting.utils.StingException; import org.broadinstitute.sting.utils.Utils; import org.broadinstitute.sting.utils.genotype.CalledGenotype; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; @@ -34,8 +33,8 @@ public class VCFWriter { private static final List mGenotypeRecords = new ArrayList(); // Properties only used when using VCF4.0 encoding - Map typeUsedForFormatString = new HashMap(); - Map typeUsedForInfoFields = new HashMap(); + Map typeUsedForFormatString = new HashMap(); + Map typeUsedForInfoFields = new HashMap(); Map numberUsedForInfoFields = new HashMap(); Map numberUsedForFormatFields = new HashMap(); @@ -113,16 +112,16 @@ public class VCFWriter { if (line.getClass() == VCFFormatHeaderLine.class) { VCFFormatHeaderLine a = (VCFFormatHeaderLine)line; - String key = a.getmName(); - typeUsedForFormatString.put(key,a.getmType()); - int num = a.getmCount(); + String key = a.getName(); + typeUsedForFormatString.put(key,a.getType()); + int num = a.getCount(); numberUsedForFormatFields.put(key,num); } else if (line.getClass() == VCFInfoHeaderLine.class) { VCFInfoHeaderLine a = (VCFInfoHeaderLine)line; - String key = a.getmName(); - typeUsedForInfoFields.put(key,a.getmType()); - int num = a.getmCount(); + String key = a.getName(); + typeUsedForInfoFields.put(key,a.getType()); + int num = a.getCount(); numberUsedForInfoFields.put(key, num); } @@ -393,9 +392,9 @@ public class VCFWriter { Object newVal; if (typeUsedForFormatString.containsKey(key)) { - VCFFormatHeaderLine.FORMAT_TYPE formatType = typeUsedForFormatString.get(key); + VCFHeaderLineType formatType = typeUsedForFormatString.get(key); if (!val.getClass().equals(String.class)) - newVal = formatType.convert(String.valueOf(val)); + newVal = formatType.convert(String.valueOf(val), VCFCompoundHeaderLine.SupportedHeaderLineType.FORMAT); else newVal = val; diff --git a/java/test/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4UnitTest.java b/java/test/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4UnitTest.java index e133cb95a..7ce6331a4 100644 --- a/java/test/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4UnitTest.java +++ b/java/test/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4UnitTest.java @@ -8,7 +8,6 @@ import org.broadinstitute.sting.gatk.contexts.variantcontext.Genotype; import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContext; import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.GenomeLocParser; -import org.broadinstitute.sting.utils.StingException; import org.broadinstitute.sting.utils.collections.Pair; import org.broadinstitute.sting.utils.genotype.vcf.VCFWriter; import org.junit.Assert; @@ -56,25 +55,25 @@ public class VCF4UnitTest extends BaseTest { VCFInfoHeaderLine ihLIne = (VCFInfoHeaderLine)line; // test a normal info line - if (ihLIne.getmName().equals("NS")) { - Assert.assertEquals(VCFInfoHeaderLine.INFO_TYPE.Integer,ihLIne.getmType()); - Assert.assertEquals(1,ihLIne.getmCount()); - Assert.assertTrue("Number of Samples With Data".equals(ihLIne.getmDescription())); + if (ihLIne.getName().equals("NS")) { + Assert.assertEquals(VCFHeaderLineType.Integer,ihLIne.getType()); + Assert.assertEquals(1,ihLIne.getCount()); + Assert.assertTrue("Number of Samples With Data".equals(ihLIne.getDescription())); seenRecords++; } // test a info line that uses the period to represent an unbounded value - if (ihLIne.getmName().equals("AF")) { - Assert.assertEquals(VCFInfoHeaderLine.INFO_TYPE.Float,ihLIne.getmType()); - Assert.assertEquals(VCFInfoHeaderLine.UNBOUNDED,ihLIne.getmCount()); - Assert.assertTrue("Allele Frequency".equals(ihLIne.getmDescription())); + if (ihLIne.getName().equals("AF")) { + Assert.assertEquals(VCFHeaderLineType.Float,ihLIne.getType()); + Assert.assertEquals(VCFInfoHeaderLine.UNBOUNDED,ihLIne.getCount()); + Assert.assertTrue("Allele Frequency".equals(ihLIne.getDescription())); seenRecords++; } } // check the vcf filter header lines if (line instanceof VCFFilterHeaderLine) { VCFFilterHeaderLine fhLIne = (VCFFilterHeaderLine)line; - if (fhLIne.getmName().equals("q10")) { - Assert.assertTrue("Quality below 10".equals(fhLIne.getmDescription())); + if (fhLIne.getName().equals("q10")) { + Assert.assertTrue("Quality below 10".equals(fhLIne.getDescription())); seenRecords++; } } @@ -82,10 +81,10 @@ public class VCF4UnitTest extends BaseTest { // check the vcf info header lines if (line instanceof VCFFormatHeaderLine) { VCFFormatHeaderLine ifLIne = (VCFFormatHeaderLine)line; - if (ifLIne.getmName().equals("GT")) { - Assert.assertEquals(VCFFormatHeaderLine.FORMAT_TYPE.String,ifLIne.getmType()); - Assert.assertEquals(1,ifLIne.getmCount()); - Assert.assertTrue("Genotype".equals(ifLIne.getmDescription())); + if (ifLIne.getName().equals("GT")) { + Assert.assertEquals(VCFHeaderLineType.String,ifLIne.getType()); + Assert.assertEquals(1,ifLIne.getCount()); + Assert.assertTrue("Genotype".equals(ifLIne.getDescription())); seenRecords++; } } @@ -101,10 +100,10 @@ public class VCF4UnitTest extends BaseTest { File tempFile = null; try { tempFile = File.createTempFile("VCF4Test","vcf"); + tempFile.deleteOnExit(); } catch (IOException e) { Assert.fail("Couldn't create a temporary file "); } - // write it to disk VCFWriter writer = new VCFWriter(tempFile); writer.writeHeader(testSetup.getHeader()); diff --git a/java/test/org/broadinstitute/sting/utils/genotype/vcf/VCFHeaderUnitTest.java b/java/test/org/broadinstitute/sting/utils/genotype/vcf/VCFHeaderUnitTest.java index d4106b78e..0be287f7d 100644 --- a/java/test/org/broadinstitute/sting/utils/genotype/vcf/VCFHeaderUnitTest.java +++ b/java/test/org/broadinstitute/sting/utils/genotype/vcf/VCFHeaderUnitTest.java @@ -1,8 +1,6 @@ package org.broadinstitute.sting.utils.genotype.vcf; -import org.broad.tribble.vcf.VCFHeader; -import org.broad.tribble.vcf.VCFHeaderLine; -import org.broad.tribble.vcf.VCFHeaderVersion; +import org.broad.tribble.vcf.*; import org.broadinstitute.sting.BaseTest; import org.broadinstitute.sting.gatk.refdata.features.vcf4.VCF4Codec; import org.junit.Assert; @@ -81,7 +79,17 @@ public class VCFHeaderUnitTest extends BaseTest { Assert.assertTrue(md5sum.equals(md5SumFile(myTempFile))); } + @Test + public void checkInfoCanHaveFlagValues() { + VCFHeaderLineType type = VCFHeaderLineType.Flag; + type.convert("true", VCFCompoundHeaderLine.SupportedHeaderLineType.INFO); + } + @Test(expected=IllegalStateException.class) + public void checkFormatCannotHaveFlagValues() { + VCFHeaderLineType type = VCFHeaderLineType.Flag; + type.convert("true", VCFCompoundHeaderLine.SupportedHeaderLineType.FORMAT); + } public String[] VCF3_3headerStrings = {