<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def runGenomeSGE(bfile, freqFile, nbJob, outPrefix, options):
 """Runs the genome command from plink, on SGE. :param bfile: the prefix of the input file. :param freqFile: the name of the frequency file (from Plink). :param nbJob: the number of jobs to launch. :param outPrefix: the prefix of all the output files. :param options: the options. :type bfile: str :type freqFile: str :type nbJob: int :type outPrefix: str :type options: argparse.Namespace Runs Plink with the ``genome`` options on the cluster (using SGE). """

    # Add the environment variable for DRMAA package
    if "DRMAA_LIBRARY_PATH" not in os.environ:
        msg = "could not load drmaa: set DRMAA_LIBRARY_PATH"
        raise ProgramError(msg)

    # Import the python drmaa library
    try:
        import drmaa
    except ImportError:
        raise ProgramError("drmaa is not install, install drmaa")

    # Initializing a session
    s = drmaa.Session()
    s.initialize()

    # Run for each sub task...
    jobIDs = []
    jobTemplates = []
    for i in xrange(1, nbJob + 1):
        for j in xrange(i, nbJob + 1):
            # The command to run
            plinkCommand = ["plink", "--noweb", "--bfile", bfile,
                            "--read-freq", freqFile, "--genome",
                            "--genome-full", "--genome-lists",
                            "{}_tmp.list{}".format(outPrefix, i),
                            "{}_tmp.list{}".format(outPrefix, j), "--out",
                            "{}_output.sub.{}.{}".format(outPrefix, i, j)]

            # Creating the job template
            jt = s.createJobTemplate()
            jt.remoteCommand = plinkCommand[0]
            jt.workingDirectory = os.getcwd()
            jt.jobEnvironment = os.environ
            jt.args = plinkCommand[1:]
            jt.jobName = "_plink_genome_{}_{}".format(i, j)

            # Cluster specifics
            if options.sge_walltime is not None:
                jt.hardWallclockTimeLimit = options.sge_walltime
            if options.sge_nodes is not None:
                native_spec = "-l nodes={}:ppn={}".format(options.sge_nodes[0],
                                                          options.sge_nodes[1])
                jt.nativeSpecification = native_spec

            jobIDs.append(s.runJob(jt))
            jobTemplates.append(jt)

    # Waiting for the jobs to finish
    hadProblems = []
    for jobID in jobIDs:
        retVal = s.wait(jobID, drmaa.Session.TIMEOUT_WAIT_FOREVER)
        hadProblems.append(retVal.exitStatus == 0)

    # Deleting the jobs
    for jt in jobTemplates:
        s.deleteJobTemplate(jt)

    # Closing the session
    s.exit()

    # Checking for problems
    for hadProblem in hadProblems:
        if not hadProblem:
            msg = "Some SGE jobs had errors..."
            raise ProgramError(msg)