code: def merge(args):
      
      from jcvi.formats.gff import merge as gmerge
  
      p = OptionParser(merge.__doc__)
      p.set_home("maker")
      opts, args = p.parse_args(args)
  
      if len(args) != 2:
          sys.exit(not p.print_help())
  
      outdir, outputgff = args
      fsnames, suffix = get_fsnames(outdir)
      nfs = len(fsnames)
      cmd = op.join(opts.maker_home, "bin/gff3_merge")
  
      outfile = "merge.sh"
      write_file(outfile, mergesh.format(suffix, cmd))
  
      # Generate per split directory
      # Note that gff3_merge write to /tmp, so I limit processes here to avoid
      # filling up disk space
      sh("parallel -j 8 merge.sh {} ::: " + " ".join(fsnames))
  
      # One final output
      gffnames = glob("*.all.gff")
      assert len(gffnames) == nfs
  
      # Again, DO NOT USE gff3_merge to merge with a smallish /tmp/ area
      gfflist = "gfflist"
      fw = open(gfflist, "w")
      print("\n".join(gffnames), file=fw)
      fw.close()
  
      nlines = sum(1 for x in open(gfflist))
      assert nlines == nfs  # Be extra, extra careful to include all results
      gmerge([gfflist, "-o", outputgff])
      logging.debug("Merged GFF file written to `{0}`".format(outputgff))
docs: %prog merge outdir output.gff
  
      Follow-up command after grid jobs are completed after parallel().