code: def genemark(args):
      
      p = OptionParser(genemark.__doc__)
      p.add_option("--junctions", help="Path to `junctions.bed` from Tophat2")
      p.set_home("gmes")
      p.set_cpus(cpus=32)
      opts, args = p.parse_args(args)
  
      if len(args) != 2:
          sys.exit(not p.print_help())
  
      species, fastafile = args
      junctions = opts.junctions
      mhome = opts.gmes_home
  
      license = op.expanduser("~/.gm_key")
      assert op.exists(license), "License key ({0}) not found!".format(license)
      cmd = "{0}/gmes_petap.pl --sequence {1}".format(mhome, fastafile)
      cmd += " --cores {0}".format(opts.cpus)
      if junctions:
          intronsgff = "introns.gff"
          if need_update(junctions, intronsgff):
              jcmd = "{0}/bet_to_gff.pl".format(mhome)
              jcmd += " --bed {0} --gff {1} --label Tophat2".\
                      format(junctions, intronsgff)
              sh(jcmd)
          cmd += " --ET {0} --et_score 10".format(intronsgff)
      else:
          cmd += " --ES"
      sh(cmd)
  
      logging.debug("GENEMARK matrix written to `output/gmhmm.mod")
docs: %prog genemark species fastafile
  
      Train GENEMARK model given fastafile. GENEMARK self-trains so no trainig
      model gff file is needed.