def gt_aware_merge(self, other, reference_seq):
        '''Tries to merge this VcfRecord with other VcfRecord always using called allele as alt.
        Simple example (working in 0-based coords):
        ref = ACGT
        var1 = SNP at position 1, C->G called alt
        var2 = SNP at position 3, T->A called ref
        then this returns new variant, position=1, REF=CGT, ALT=GGT.

        If there is any kind of conflict, eg two SNPs in same position, then
        returns None.
        Also assumes there is only one ALT, otherwise returns None.'''
        if self.CHROM != other.CHROM or self.intersects(other) or len(self.ALT) != 1 or len(other.ALT) != 1:
            return None

        ref_start = min(self.POS, other.POS)
        ref_end = max(self.ref_end_pos(), other.ref_end_pos())
        ref_seq_for_vcf = reference_seq[ref_start:ref_end + 1]
        sorted_records = sorted([self, other], key=operator.attrgetter('POS'))
        alt_seq = []
        all_alt_seq = []
        gt_confs = []
        current_ref_pos = ref_start

        for record in sorted_records:
            assert record.REF != '.' and record.ALT[0] != '.'
            alt_seq.append(reference_seq[current_ref_pos:record.POS])
            all_alt_seq.append(reference_seq[current_ref_pos:record.POS])
            if record.FORMAT is None or 'GT' not in record.FORMAT:
                return None

            called_alleles = list(set(record.FORMAT['GT'].split('/')))
            if len(called_alleles) != 1 or '.' in called_alleles:
                return None
            gt = int(called_alleles[0])
            if gt > 0:
                alt_seq.append(record.ALT[gt-1])
            else:
                alt_seq.append(record.REF)
            all_alt_seq.append(record.ALT[0])
            current_ref_pos += len(record.REF)
            if record.FORMAT is not None and 'GT_CONF' in record.FORMAT:
                gt_confs.append(record.FORMAT['GT_CONF'])

        alt_seq_for_vcf = ''.join(alt_seq)
        format = "GT"
        gt_0 = '0/0'
        gt_1 = '1/1'
        if len(gt_confs) > 0:
            gt_conf = min(gt_confs)
            format = 'GT:GT_CONF'
            gt_0 = '0/0:' + str(gt_conf)
            gt_1 = '1/1:' + str(gt_conf)

        if ref_seq_for_vcf == alt_seq_for_vcf:
            return VcfRecord('\t'.join([
                self.CHROM,
                str(ref_start + 1),
                '.',
                ref_seq_for_vcf,
                ''.join(all_alt_seq),
                '.', '.', 'SVTYPE=MERGED',
                format, gt_0,
            ]))
        else:
            return VcfRecord('\t'.join([
                self.CHROM,
                str(ref_start + 1),
                '.',
                ref_seq_for_vcf,
                alt_seq_for_vcf,
                '.', '.', 'SVTYPE=MERGED',
                format, gt_1,
            ]))
Tries to merge this VcfRecord with other VcfRecord always using called allele as alt.
        Simple example (working in 0-based coords):
        ref = ACGT
        var1 = SNP at position 1, C->G called alt
        var2 = SNP at position 3, T->A called ref
        then this returns new variant, position=1, REF=CGT, ALT=GGT.

        If there is any kind of conflict, eg two SNPs in same position, then
        returns None.
        Also assumes there is only one ALT, otherwise returns None.