code: def collinear(args):
      
      p = OptionParser(collinear.__doc__)
      p.set_beds()
  
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      anchorfile, = args
      qbed, sbed, qorder, sorder, is_self = check_beds(anchorfile, p, opts)
  
      af = AnchorFile(anchorfile)
      newanchorfile = anchorfile.rsplit(".", 1)[0] + ".collinear.anchors"
      fw = open(newanchorfile, "w")
  
      blocks = af.blocks
      for block in blocks:
          print("#" * 3, file=fw)
          iblock = []
          for q, s, score in block:
              qi, q = qorder[q]
              si, s = sorder[s]
              score = int(long(score))
              iblock.append([qi, si, score])
  
          block = get_collinear(iblock)
  
          for q, s, score in block:
              q = qbed[q].accn
              s = sbed[s].accn
              print("\t".join((q, s, str(score))), file=fw)
  
      fw.close()
docs: %prog collinear a.b.anchors
  
      Reduce synteny blocks to strictly collinear, use dynamic programming in a
      procedure similar to DAGchainer.