code: def gaps(args):
      
      from jcvi.formats.bed import uniq
      from jcvi.utils.iter import pairwise
  
      p = OptionParser(gaps.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) != 2:
          sys.exit(not p.print_help())
  
      ombed, fastafile = args
      ombed = uniq([ombed])
      bed = Bed(ombed)
  
      for a, b in pairwise(bed):
          om_a = (a.seqid, a.start, a.end, "+")
          om_b = (b.seqid, b.start, b.end, "+")
          ch_a = range_parse(a.accn)
          ch_b = range_parse(b.accn)
          ch_a = (ch_a.seqid, ch_a.start, ch_a.end, "+")
          ch_b = (ch_b.seqid, ch_b.start, ch_b.end, "+")
  
          om_dist, x = range_distance(om_a, om_b, distmode="ee")
          ch_dist, x = range_distance(ch_a, ch_b, distmode="ee")
  
          if om_dist <= 0 and ch_dist <= 0:
              continue
  
          print(a)
          print(b)
          print(om_dist, ch_dist)
docs: %prog gaps OM.bed fastafile
  
      Create patches around OM gaps.