def condense(args):
    from itertools import groupby
    from jcvi.assembly.patch import merge_ranges

    p = OptionParser(condense.__doc__)
    opts, args = p.parse_args(args)

    if len(args) != 1:
        sys.exit(not p.print_help())

    bedfile, = args
    bed = Bed(bedfile, sorted=False)
    key = lambda x: (x.seqid, x.start, x.end)
    for k, sb in groupby(bed, key=key):
        sb = list(sb)
        b = sb[0]
        chr, start, end, strand = merge_ranges(sb)

        id = "{0}:{1}-{2}".format(chr, start, end)
        b.accn = id
        print b
Performs subs, checking for conditions that may result in `nan` or
dataset/ETHPy150Open tanghaibao/jcvi/assembly/opticalmap.py/condense--crossover with--dataset/ETHPy150Open sympy/sympy/sympy/physics/mechanics/functions.py/_smart_subs