code: 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)
docs: %prog condense OM.bed
  
      Merge split alignments in OM bed.