part one of combining format and info header lines code into a single abstract class for Mark; plus some 'm' removals from access methods for Eric. Adding fixes for CombineVariants next.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3719 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
e7220bc885
commit
3347d1ca7c
|
|
@ -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<String,String> 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<String,Object> map = new LinkedHashMap<String,Object>();
|
||||
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();
|
||||
|
||||
}
|
||||
|
|
@ -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<String,String> 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<String,Object> map = new LinkedHashMap<String,Object>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
|||
* <p/>
|
||||
* 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<String,String> 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<String,Object> map = new LinkedHashMap<String,Object>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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<VCFFormatHeaderLine> getSupportedHeaderStrings(VCFHeaderVersion version) {
|
||||
Set<VCFFormatHeaderLine> result = new HashSet<VCFFormatHeaderLine>();
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
|||
* <p/>
|
||||
* 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<String,String> 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<String,Object> map = new LinkedHashMap<String,Object>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<String, VCFInfoHeaderLine.INFO_TYPE> infoFields = new TreeMap<String, VCFInfoHeaderLine.INFO_TYPE>();
|
||||
TreeMap<String, VCFFormatHeaderLine.FORMAT_TYPE> formatFields = new TreeMap<String, VCFFormatHeaderLine.FORMAT_TYPE>();
|
||||
TreeMap<String, VCFHeaderLineType> infoFields = new TreeMap<String, VCFHeaderLineType>();
|
||||
TreeMap<String, VCFHeaderLineType> formatFields = new TreeMap<String, VCFHeaderLineType>();
|
||||
ArrayList<String> filterFields = new ArrayList<String>();
|
||||
|
||||
// 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<Object> objects = new ArrayList<Object>();
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("Alignability"); }
|
||||
|
||||
public List<VCFInfoHeaderLine> 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<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Integer, "Alignability according to a mask file (3 is best, 0 is worst)")); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("AB"); }
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("AB", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Allele Balance for hets (ref/(ref+alt))")); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("AB", 1, VCFHeaderLineType.Float, "Allele Balance for hets (ref/(ref+alt))")); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("BaseQRankSum"); }
|
||||
|
||||
public List<VCFInfoHeaderLine> 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<VCFInfoHeaderLine> 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<Integer> refQuals, List<Integer> altQuals) {
|
||||
for ( PileupElement p : pileup ) {
|
||||
|
|
|
|||
|
|
@ -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<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList(VCFRecord.DEPTH_KEY); }
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Total Depth")); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Integer, "Total Depth")); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("AD"); }
|
||||
|
||||
public List<VCFFormatHeaderLine> 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<VCFFormatHeaderLine> 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")); }
|
||||
}
|
||||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("GC"); }
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("GC", 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "GC content within 20 bp +/- the variant")); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("GC", 1, VCFHeaderLineType.Integer, "GC content within 20 bp +/- the variant")); }
|
||||
|
||||
public boolean useZeroQualityReads() { return false; }
|
||||
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("HaplotypeScore"); }
|
||||
public List<VCFInfoHeaderLine> 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<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HaplotypeScore", 1, VCFHeaderLineType.Float, "Consistency of the site with two (and only two) segregating haplotypes")); }
|
||||
}
|
||||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("HW"); }
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HW", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Phred-scaled p-value for Hardy-Weinberg violation")); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HW", 1, VCFHeaderLineType.Float, "Phred-scaled p-value for Hardy-Weinberg violation")); }
|
||||
}
|
||||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("HRun"); }
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("HRun", 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Largest Contiguous Homopolymer Run of Variant Allele In Either Direction")); }
|
||||
public List<VCFInfoHeaderLine> 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; }
|
||||
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("LowMQ"); }
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 3, VCFInfoHeaderLine.INFO_TYPE.Integer, "3-tuple: <fraction of reads with MQ=0>,<fraction of reads with MQ<=10>,<total nubmer of reads>")); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 3, VCFHeaderLineType.Integer, "3-tuple: <fraction of reads with MQ=0>,<fraction of reads with MQ<=10>,<total nubmer of reads>")); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("MQRankSum"); }
|
||||
|
||||
public List<VCFInfoHeaderLine> 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<VCFInfoHeaderLine> 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<Integer> refQuals, List<Integer> altQuals) {
|
||||
for ( PileupElement p : pileup ) {
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("MQ0"); }
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "Total Mapping Quality Zero Reads")); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Integer, "Total Mapping Quality Zero Reads")); }
|
||||
}
|
||||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("QD"); }
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Variant Confidence/Quality by Depth")); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Float, "Variant Confidence/Quality by Depth")); }
|
||||
|
||||
private int variationQualByDepth(final Map<String, Genotype> genotypes, Map<String, StratifiedAlignmentContext> stratifiedContexts) {
|
||||
int depth = 0;
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList(KEY_NAME); }
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME, 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Adjusted residual quality based on second-base skew")); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME, 1, VCFHeaderLineType.Float, "Adjusted residual quality based on second-base skew")); }
|
||||
|
||||
public Map<String, Object> annotate( RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> contexts, VariantContext vc) {
|
||||
String chi = skewCalc.getAnnotation(ref, contexts, vc);
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList(VCFRecord.RMS_MAPPING_QUALITY_KEY); }
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFInfoHeaderLine.INFO_TYPE.Float, "RMS Mapping Quality")); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0), 1, VCFHeaderLineType.Float, "RMS Mapping Quality")); }
|
||||
}
|
||||
|
|
@ -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<String> getKeyNames() { return Arrays.asList(KEY_NAME); }
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME, 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Chi-square Secondary Base Skew")); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(KEY_NAME, 1, VCFHeaderLineType.Float, "Chi-square Secondary Base Skew")); }
|
||||
|
||||
public Map<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> stratifiedContexts, VariantContext vc) {
|
||||
if ( stratifiedContexts.size() == 0 )
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("Dels"); }
|
||||
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("Dels", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Fraction of Reads Containing Spanning Deletions")); }
|
||||
public List<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine("Dels", 1, VCFHeaderLineType.Float, "Fraction of Reads Containing Spanning Deletions")); }
|
||||
}
|
||||
|
|
@ -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<String, String> 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"); }
|
||||
}
|
||||
|
|
@ -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"); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"); }
|
||||
}
|
||||
|
|
@ -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"); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public class VariantFiltrationWalker extends RodWalker<Integer, Integer> {
|
|||
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<ReferenceOrderedDataSource> dataSources = getToolkit().getRodDataSources();
|
||||
for ( ReferenceOrderedDataSource source : dataSources ) {
|
||||
|
|
|
|||
|
|
@ -141,13 +141,13 @@ public class UnifiedGenotyper extends LocusWalker<VariantCallContext, UnifiedGen
|
|||
|
||||
// annotation (INFO) fields from UnifiedGenotyper
|
||||
if ( UG_engine.annotateDbsnp )
|
||||
headerInfo.add(new VCFInfoHeaderLine(VCFRecord.DBSNP_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "dbSNP Membership"));
|
||||
headerInfo.add(new VCFInfoHeaderLine(VCFRecord.DBSNP_KEY, 1, VCFHeaderLineType.Integer, "dbSNP Membership"));
|
||||
if ( UG_engine.annotateHapmap2 )
|
||||
headerInfo.add(new VCFInfoHeaderLine(VCFRecord.HAPMAP2_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "HapMap2 Membership"));
|
||||
headerInfo.add(new VCFInfoHeaderLine(VCFRecord.HAPMAP2_KEY, 1, VCFHeaderLineType.Integer, "HapMap2 Membership"));
|
||||
if ( UG_engine.annotateHapmap3 )
|
||||
headerInfo.add(new VCFInfoHeaderLine(VCFRecord.HAPMAP3_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Integer, "HapMap3 Membership"));
|
||||
headerInfo.add(new VCFInfoHeaderLine(VCFRecord.HAPMAP3_KEY, 1, VCFHeaderLineType.Integer, "HapMap3 Membership"));
|
||||
if ( !UAC.NO_SLOD )
|
||||
headerInfo.add(new VCFInfoHeaderLine(VCFRecord.STRAND_BIAS_KEY, 1, VCFInfoHeaderLine.INFO_TYPE.Float, "Strand Bias"));
|
||||
headerInfo.add(new VCFInfoHeaderLine(VCFRecord.STRAND_BIAS_KEY, 1, VCFHeaderLineType.Float, "Strand Bias"));
|
||||
|
||||
// FORMAT and INFO fields
|
||||
headerInfo.addAll(VCFGenotypeRecord.getSupportedHeaderStrings(VCFHeaderVersion.VCF3_3));
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
|
|||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.utils.QualityUtils;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.utils.genotype.vcf.*;
|
||||
import org.broadinstitute.sting.utils.genotype.vcf.VCFWriter;
|
||||
|
||||
import java.util.*;
|
||||
|
|
@ -124,13 +123,13 @@ public class SequenomValidationConverter extends RodWalker<VCFRecord,Integer> {
|
|||
Set<VCFHeaderLine> hInfo = new HashSet<VCFHeaderLine>();
|
||||
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"));
|
||||
|
|
|
|||
|
|
@ -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<Integer, Integer> {
|
|||
// setup the header fields
|
||||
final Set<VCFHeaderLine> hInfo = new HashSet<VCFHeaderLine>();
|
||||
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<String> samples = new TreeSet<String>();
|
||||
|
|
|
|||
|
|
@ -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<ExpandingArrayList<VariantDat
|
|||
final TreeSet<String> samples = new TreeSet<String>();
|
||||
final List<ReferenceOrderedDataSource> 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()));
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
|
|||
//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<Integer, Integer> {
|
|||
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)))
|
||||
|
|
|
|||
|
|
@ -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<Integer,Long>{
|
|||
hInfo.add(new VCFHeaderLine("source", "IndelAnnotator"));
|
||||
hInfo.add(new VCFHeaderLine("annotatorReference", getToolkit().getArguments().referenceFile.getName()));
|
||||
HashSet<VCFInfoHeaderLine> anno = new HashSet<VCFInfoHeaderLine>();
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList("INSIZE"); }
|
||||
public List<VCFInfoHeaderLine> 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<VCFInfoHeaderLine> getDescriptions() { return Arrays.asList(new VCFInfoHeaderLine(getKeyNames().get(0),1, VCFHeaderLineType.Integer,"Do not use this if your name is not Chris")); }
|
||||
|
||||
public Map<String,Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> context, VariantContext variant) {
|
||||
int weirdInsertSizeReads = 0;
|
||||
|
|
|
|||
|
|
@ -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<String> getKeyNames() { return Arrays.asList(KEY_NAME); }
|
||||
|
||||
public List<VCFInfoHeaderLine> 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<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> context, VariantContext vc) {
|
||||
|
|
|
|||
|
|
@ -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<VCFInfoHeaderLine> 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"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<VCFInfoHeaderLine> 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"));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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<VCFInfoHeaderLine> 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<String, Object> annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map<String, StratifiedAlignmentContext> context, VariantContext vc) {
|
||||
|
|
|
|||
|
|
@ -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<Integer, Integer> {
|
|||
|
||||
final Set<VCFHeaderLine> hInfo = new HashSet<VCFHeaderLine>();
|
||||
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<ReferenceOrderedDataSource> dataSources = this.getToolkit().getRodDataSources();
|
||||
|
|
|
|||
|
|
@ -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<String, String> convertRecordToAnnotations( String bindingName, Map<String, String> record) {
|
||||
|
|
@ -255,7 +256,7 @@ public class GenomicAnnotation implements InfoFieldAnnotation {
|
|||
|
||||
|
||||
public List<VCFInfoHeaderLine> 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<String> getKeyNames() {
|
||||
|
|
|
|||
|
|
@ -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<VCFGenotypeRecord> mGenotypeRecords = new ArrayList<VCFGenotypeRecord>();
|
||||
|
||||
// Properties only used when using VCF4.0 encoding
|
||||
Map<String, VCFFormatHeaderLine.FORMAT_TYPE> typeUsedForFormatString = new HashMap<String, VCFFormatHeaderLine.FORMAT_TYPE>();
|
||||
Map<String, VCFInfoHeaderLine.INFO_TYPE> typeUsedForInfoFields = new HashMap<String, VCFInfoHeaderLine.INFO_TYPE>();
|
||||
Map<String, VCFHeaderLineType> typeUsedForFormatString = new HashMap<String, VCFHeaderLineType>();
|
||||
Map<String, VCFHeaderLineType> typeUsedForInfoFields = new HashMap<String, VCFHeaderLineType>();
|
||||
Map<String, Integer> numberUsedForInfoFields = new HashMap<String, Integer>();
|
||||
Map<String, Integer> numberUsedForFormatFields = new HashMap<String, Integer>();
|
||||
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue