code: def omg(args):
      
      p = OptionParser(omg.__doc__)
  
      opts, args = p.parse_args(args)
  
      if len(args) < 1:
          sys.exit(not p.print_help())
  
      weightsfiles = args
      groupfile = group(weightsfiles + ["--outfile=groups"])
  
      weights = get_weights(weightsfiles)
      info = get_info()
  
      fp = open(groupfile)
  
      work = "work"
      mkdir(work)
      for i, row in enumerate(fp):
          gf = op.join(work, "gf{0:05d}".format(i))
          genes = row.rstrip().split(",")
  
          fw = open(gf, "w")
          contents = ""
          npairs = 0
          for gene in genes:
              gene_pairs = weights[gene]
              for a, b, c in gene_pairs:
                  if b not in genes:
                      continue
  
                  contents += "weight {0}".format(c) + '\n'
                  contents += info[a] + '\n'
                  contents += info[b] + '\n\n'
                  npairs += 1
  
          header = "a group of genes  :length ={0}".format(npairs)
          print(header, file=fw)
          print(contents, file=fw)
  
          fw.close()
docs: %prog omg weightsfile
  
      Run Sankoff's OMG algorithm to get orthologs. Download OMG code at:
      <http://137.122.149.195/IsbraSoftware/OMGMec.html>
  
      This script only writes the partitions, but not launch OMGMec. You may need to:
  
      $ parallel "java -cp ~/code/OMGMec TestOMGMec {} 4 > {}.out" ::: work/gf?????
  
      Then followed by omgparse() to get the gene lists.