code: def gmap(args):
      
      p = OptionParser(gmap.__doc__)
      p.add_option("--cross", default=False, action="store_true",
                   help="Cross-species alignment")
      p.add_option("--npaths", default=0, type="int",
                   help="Maximum number of paths to show."
                   " If set to 0, prints two paths if chimera"
                   " detected, else one.")
      p.set_cpus()
      opts, args = p.parse_args(args)
  
      if len(args) != 2:
          sys.exit(not p.print_help())
  
      dbfile, fastafile = args
      assert op.exists(dbfile) and op.exists(fastafile)
      prefix = get_prefix(fastafile, dbfile)
      logfile = prefix + ".log"
      gmapfile = prefix + ".gmap.gff3"
  
      if not need_update((dbfile, fastafile), gmapfile):
          logging.error("`{0}` exists. `gmap` already run.".format(gmapfile))
      else:
          dbdir, dbname = check_index(dbfile)
          cmd = "gmap -D {0} -d {1}".format(dbdir, dbname)
          cmd += " -f 2 --intronlength=100000"  # Output format 2
          cmd += " -t {0}".format(opts.cpus)
          cmd += " --npaths {0}".format(opts.npaths)
          if opts.cross:
              cmd += " --cross-species"
          cmd += " " + fastafile
  
          sh(cmd, outfile=gmapfile, errfile=logfile)
  
      return gmapfile, logfile
docs: %prog gmap database.fasta fastafile
  
      Wrapper for `gmap`.