Search in sources :

Example 1 with VCF3Codec

use of htsjdk.variant.vcf.VCF3Codec in project jvarkit by lindenb.

the class VCFUtils method findCodecFromLines.

/**
 * find a codec from the lines header. if not found, return default codec
 */
public static AbstractVCFCodec findCodecFromLines(final List<String> list) {
    for (final String line : list) {
        String formatString = line;
        if (formatString.startsWith("##")) {
            formatString = formatString.substring(2);
        }
        int eq = formatString.indexOf('=');
        if (eq == -1)
            continue;
        if (!VCFHeaderVersion.isFormatString(formatString.substring(0, eq)))
            continue;
        VCFHeaderVersion version = VCFHeaderVersion.getHeaderVersion(line);
        if (version == null)
            continue;
        switch(version) {
            case VCF3_2:
            case VCF3_3:
                return new VCF3Codec();
            case VCF4_0:
            case VCF4_1:
            case VCF4_2:
                return new VCFCodec();
        }
    }
    return createDefaultVCFCodec();
}
Also used : AbstractVCFCodec(htsjdk.variant.vcf.AbstractVCFCodec) VCFCodec(htsjdk.variant.vcf.VCFCodec) VCF3Codec(htsjdk.variant.vcf.VCF3Codec) VCFHeaderVersion(htsjdk.variant.vcf.VCFHeaderVersion)

Aggregations

AbstractVCFCodec (htsjdk.variant.vcf.AbstractVCFCodec)1 VCF3Codec (htsjdk.variant.vcf.VCF3Codec)1 VCFCodec (htsjdk.variant.vcf.VCFCodec)1 VCFHeaderVersion (htsjdk.variant.vcf.VCFHeaderVersion)1