code: def diff(args):
      
      from jcvi.utils.cbook import SummaryStats
  
      p = OptionParser(diff.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      simplefile, = args
      fp = open(simplefile)
      data = [x.split() for x in fp]
      spans = []
      for block_id, ab in groupby(data[1:], key=lambda x: x[0]):
          a, b = list(ab)
          aspan, bspan = a[4], b[4]
          aspan, bspan = int(aspan), int(bspan)
          spans.append((aspan, bspan))
      aspans, bspans = zip(*spans)
      dspans = [b - a for a, b, in spans]
      s = SummaryStats(dspans)
      print("For a total of {0} blocks:".format(len(dspans)), file=sys.stderr)
      print("Sum of A: {0}".format(sum(aspans)), file=sys.stderr)
      print("Sum of B: {0}".format(sum(bspans)), file=sys.stderr)
      print("Sum of Delta: {0} ({1})".format(sum(dspans), s), file=sys.stderr)
docs: %prog diff simplefile
  
      Calculate difference of pairwise syntenic regions.