def estimate_size(accns, bed, order, conservative=True):
    accns = [order[x] for x in accns]
    ii, bb = zip(*accns)
    mini, maxi = min(ii), max(ii)
    if not conservative: # extend one gene
        mini -= 1
        maxi += 1
    minb = bed[mini]
    maxb = bed[maxi]
    assert minb.seqid == maxb.seqid
    distmode = "ss" if conservative else "ee"
    ra = (minb.seqid, minb.start, minb.end, "+")
    rb = (maxb.seqid, maxb.start, maxb.end, "+")

    dist, orientation = range_distance(ra, rb, distmode=distmode)
    assert dist != -1
    return dist
Estimate the bp length for the deletion tracks, indicated by the gene accns.
dataset/ETHPy150Open tanghaibao/jcvi/compara/fractionation.py/estimate_size