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 *
* Class VCFFormatHeaderLine * * A class representing a key=value entry for genotype FORMAT fields in the VCF header */ public class VCFFormatHeaderLine extends VCFHeaderLine { // the format field types public enum FORMAT_TYPE { Integer, Float, String; 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: return value; default: throw new IllegalStateException("field." + this + " doesn't have a set conversion approach"); } } } private String mName; private int mCount; private String mDescription; private FORMAT_TYPE mType; /** * 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