def trimOverlap(exons, lo, hi):
    loChange = 0
    hiChange = 0
    for x in exons:
        if lo >= x[0] and lo <= x[1]:
            loChange = x[1] - lo
            lo = x[1]
        if hi >= x[0] and hi <= x[1]:
            hiChange  = hi - x[0]
            hi = x[0]
    return {"lo": lo, "hi": hi, "loChange": loChange, "hiChange": hiChange}
dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/dxpy/scripts/dx_gtf_to_genes.py/trimOverlap/original