Project: s41467-024-46614-z | Function: breakpoint_shift_analysis (python)

system: You are an expert Python programmer implementing algorithms from scientific papers.
Complete the masked function based on the algorithm description.
Follow Python best practices and maintain consistent code style.
Return **only** the complete Python function code.

user: Complete this Python function:

**DESCRIPTION:** Analyzes breakpoint shift distribution in structural variant calls by calculating maximum reference location differences between true positive SVs and benchmark SVs

**KEY TERMS:** {
  "MatchId": "Truvari unique identifier linking tp-call and tp-base entries",
  "StartDistBP": "start position distance between calls",
  "EndDistBP": "end position distance between calls",
  "breakpoint_shift": "maximum positional difference",
  "SVTYPE": "structural variant type (DEL/INS)",
  "tp_call_vcf": "true positive calls from SV caller"
}

**CONTEXT CODE:**     matplotlib.rcParams['pdf.fonttype'] = 42
    matplotlib.rcParams['ps.fonttype'] = 42
    fig, axes = plt.subplots(2,1,figsize=(8,16))
    #del_max = abs(max(breakpoint_shift['DEL'], key=abs))
    axes[0].hist(breakpoint_shift['DEL'], bins=200, range=None, histtype='bar',log=False, color='blue',label='DEL')
    #axes[0].set_xlim(xmin=-500, xmax=500)
    axes[1].hist(breakpoint_shift['INS'], bins=200, range=None, histtype='bar',log=False, color='red',label='INS')
    #center at zero
    for i in range(2):
        # xabs_max = abs(max(axes[i].get_xlim(), key=abs))
        # axes[i].set_xlim(xmin=-xabs_max, xmax=xabs_max)
        axes[i].set_xlim(xmin=-210, xmax=210)
        
    axes[0].legend()
    axes[1].legend()
    plt.savefig(save_dir+'/breakpoint_shift_distribution.pdf',bbox_inches='tight')
    plt.close(fig)

def group_by_matchid(vcf):

    brkpt_dict = dict()

    with open(vcf,'r') as vf:
        for line in vf:
            if line[0]!='#':
                matchid = re.findall("MatchId=(\d+)",line)[0]
                fields = line.rstrip('\n').split('\t')

                try:
                    svtype = re.findall("SVTYPE=(\w+)",line)[0]
                    svlen = float(re.findall("SVLEN=-?(\d+)",line)[0])
                except:
                    if len(fields[3])-len(fields[4]) > 0:
                        svtype = 'DEL'
                    elif len(fields[3])-len(fields[4]) < 0:
                        svtype = 'INS'
                    svlen = abs(len(fields[3])-len(fields[4]))
                    svlen = float(svlen)

                start = float(fields[1])
                if svtype == 'DEL':
                    end = start+svlen
                elif svtype == 'INS':
                    end = start

                brkpt_dict[matchid] = [svtype, start, end]

    return brkpt_dict


def breakpoint_shift_analysis(truv_rslt_dir):
    # MASKED: Analyzes breakpoint shift distribution in structural variant calls by calculating maximum reference location differences between true positive SVs and benchmark SVs
    raise NotImplementedError("This function is masked for testing purposes.")


if __name__ == "__main__":
    from argparse import ArgumentParser

    parser = ArgumentParser()

    parser.add_argument('--truv_rslt_dir','-trd',)

    args = parser.parse_args()

    truv_rslt_dir = args.truv_rslt_dir

    breakpoint_shift_analysis(truv_rslt_dir)


Complete the function implementation replacing "raise NotImplementedError".