code: def layout(args):
      
      from jcvi.algorithms.ec import GA_setup, GA_run
  
      p = OptionParser(layout.__doc__)
      p.set_beds()
      p.set_cpus(cpus=32)
      opts, args = p.parse_args(args)
  
      if len(args) != 3:
          sys.exit(not p.print_help())
  
      simplefile, qseqids, sseqids = args
      qbed, sbed, qorder, sorder, is_self = check_beds(simplefile, p, opts)
  
      qseqids = qseqids.strip().split(",")
      sseqids = sseqids.strip().split(",")
      qseqids_ii = dict((s, i) for i, s in enumerate(qseqids))
      sseqids_ii = dict((s, i) for i, s in enumerate(sseqids))
  
      blocks = SimpleFile(simplefile).blocks
      scores = defaultdict(int)
      for a, b, c, d, score, orientation, hl in blocks:
          qi, q = qorder[a]
          si, s = sorder[c]
          qseqid, sseqid = q.seqid, s.seqid
          if sseqid not in sseqids:
              continue
          scores[sseqids_ii[sseqid], qseqid] += score
  
      data = []
      for (a, b), score in sorted(scores.items()):
          if b not in qseqids_ii:
              continue
          data.append((qseqids_ii[b], score))
  
      tour = range(len(qseqids))
      toolbox = GA_setup(tour)
      toolbox.register("evaluate", colinear_evaluate_weights, data=data)
      tour, fitness = GA_run(toolbox, ngen=100, npop=100, cpus=opts.cpus)
      tour = [qseqids[x] for x in tour]
  
      print(",".join(tour))
docs: %prog layout query.subject.simple query.seqids subject.seqids
  
      Compute optimal seqids order in a second genome, based on seqids on one
      genome, given the pairwise blocks in .simple format.