Prepare tabix file with priority filters based on vcfanno annotations.

def _prep_priority_filter_vcfanno(in_vcf, data):
    """Prepare tabix file with priority filters based on vcfanno annotations.
    """
    pops = ['af_adj_exac_afr', 'af_adj_exac_amr', 'af_adj_exac_eas',
            'af_adj_exac_fin', 'af_adj_exac_nfe', 'af_adj_exac_oth', 'af_adj_exac_sas',
            'af_exac_all', 'max_aaf_all',
            "af_esp_ea", "af_esp_aa", "af_esp_all", "af_1kg_amr", "af_1kg_eas",
            "af_1kg_sas", "af_1kg_afr", "af_1kg_eur", "af_1kg_all"]
    known = ["cosmic_ids", "cosmic_id", "clinvar_sig"]
    out_file = "%s-priority.tsv" % utils.splitext_plus(in_vcf)[0]
    if not utils.file_exists(out_file) and not utils.file_exists(out_file + ".gz"):
        with file_transaction(data, out_file) as tx_out_file:
            with open(tx_out_file, "w") as out_handle:
                writer = csv.writer(out_handle, dialect="excel-tab")
                header = ["#chrom", "start", "end", "ref", "alt", "filter"]
                writer.writerow(header)
                vcf_reader = cyvcf2.VCF(in_vcf)
                impact_info = _get_impact_info(vcf_reader)
                for rec in vcf_reader:
                    row = _prepare_vcf_rec(rec, pops, known, impact_info)
                    cur_filter = _calc_priority_filter(row, pops)
                    writer.writerow([rec.CHROM, rec.start, rec.end, rec.REF, ",".join(rec.ALT), cur_filter])
    return vcfutils.bgzip_and_index(out_file, data["config"],
                                    tabix_args="-0 -c '#' -s 1 -b 2 -e 3")