def _convert_variant_file_to_dict(varfile):
        """
        Converts tsv to dicts with this structure
        {
            'patient_1': {
                'variant-id': {
                    'build': 'hg19'
                    'chromosome': 'chr7',
                    'reference_allele': 'A',
                    'variant_allele': 'G',
                    'position': '1234',
                    'rs_id' : 'RS1234',
                    'type': 'SNV',
                    'genes_of_interest' : [SHH, BRCA1]
                }
            }
        }
        TODO the above structure can be simplified as it results
             in duplicated variant dicts, the join-by-id approach
             below would be an improvement:
        {
            'patient_1': {
                'variants': [variant-id1,variant-id2, 3, 4]
            }
            'variants : [
               'variant-id1': {
                    'build': hg19
                    'chromosome': 'chr7',
                    'reference_allele': 'A',
                    'variant_allele': 'G',
                    'position': '1234'
                    'rs_id' : 'RS1234',
                    'type': 'SNV",
                    'genes_of_interest' : [SHH, BRCA1]
                }
            ]
        }

        If any part of the core variant information is missing
        (build, chr, bp change(s), the line number will be used
        to make the variant unique

        Variant id will be used downstream to form blank nodes (checksumed)

        See docstring for _add_variant_gene_relationship for explanation
        on why there is a one to many mapping between variants and genes

        Values are normalized with these rules:
        1. Basepairs are upper case
        2. HG19 -> hg19
        3. X -> chrX
        :return: dict
        """
        patient_variant_map = {}
        # line_num = 0   note this is builtin to the reader as reader.line_num
        reader = csv.reader(varfile, delimiter="\t")
        col = [
            'patient', 'family', 'chromosome', 'build', 'position', 'reference_allele',
            'variant_allele', 'parent_of_origin', 'allele_type', 'mutation_type',
            'gene_symbol', 'transcript', 'reference_aa', 'variant_aa, aa_change',
            'segregates_with', 'locus', 'exon', 'inheritance_model', 'zygosity',
            'dbsnp_id', 'frequency', 'num_of_alleles'
        ]
        # row = next(reader)   # there is no header
        # if len(row) != len(col):
        #    LOG.error('Got:\n\t%s\nExpected:\n\t%s\n', row, col)
        #    raise TypeError('header does not match expected format')
        for row in reader:

            patient = row[col.index('patient')]
            # family,
            chromosome = row[col.index('chromosome')]
            build = row[col.index('build')]
            position = row[col.index('position')]
            reference_allele = row[col.index('reference_allele')]
            variant_allele = row[col.index('variant_allele')]
            # parent_of_origin,
            # allele_type,
            mutation_type = row[col.index('mutation_type')]
            gene_symbol = row[col.index('gene_symbol')]
            # transcript,
            # reference_aa,
            # variant_aa,
            # aa_change,
            # segregates_with,
            # locus,
            # exon,
            # inheritance_model,
            # zygosity,
            dbsnp_id = row[col.index('dbsnp_id')]
            # frequency,
            # num_of_alleles

            if patient not in patient_variant_map:
                patient_variant_map[patient] = {}

            formatted_chr = re.sub(r'^CHR', 'chr', chromosome, flags=re.I)

            if re.fullmatch(r'[XY]|[0-9]{1,2}', chromosome, flags=re.I):
                formatted_chr = "chr{0}".format(chromosome.upper())

            formatted_build = re.sub(r'^HG', 'hg', build, flags=re.I)
            ref_base = reference_allele.upper()
            var_base = variant_allele.upper()
            rs_id = ''

            # Catch misformatted data
            if re.search(r'LEFT FLANK|NM_|EXON', ref_base):
                ref_base = ''

            if re.search(r'LEFT FLANK|NM_|EXON', var_base):
                var_base = ''

            if dbsnp_id != '':
                match = re.fullmatch(r'^(rs\d+).*', dbsnp_id)
                if match:
                    rs_id = match.group(1)

            # Format variant object
            variant_info = [formatted_chr, formatted_build, position,
                            ref_base, var_base]

            if '' in variant_info:
                filt_list = [info for info in variant_info if info != '']
                variant_id = str(reader.line_num) + '-' + '-'.join(filt_list)
            else:
                variant_id = '-'.join(variant_info)

            if variant_id in patient_variant_map[patient]:
                patient_variant_map[patient][variant_id]['genes_of_interest'].append(
                    gene_symbol)
            else:
                patient_variant_map[patient][variant_id] = {
                    'build': formatted_build,
                    'position': position,
                    'chromosome': formatted_chr,
                    'reference_allele': ref_base,
                    'variant_allele': var_base,
                    'type': mutation_type,
                    'rs_id': ''
                }
                if rs_id:
                    patient_variant_map[patient][variant_id]['rs_id'] = rs_id

                patient_variant_map[patient][variant_id]['genes_of_interest']\
                    = [gene_symbol]

        return patient_variant_map