def options(argv): global home, shareware, scr, scr_job, fasta_file, code, results, name, cleanup, task_id, no_homs if len(argv) < 3: usage() sys.exit(2) home = os.getcwd() shareware = paths.join(home, "tools") opts, args = getopt.getopt(argv, "t:p:cn") code = args[0] fasta_file = args[1] results = args[2] for o, a in opts: if o == '-t': id = '%(#)03d' % {"#": int(a)} task_id = id if o == '-p': loadProps(a) if o == '-c': cleanup = False if o == '-n': no_homs = True if task_id == None: try: id = '%(#)03d' % {"#": int(os.environ['PBS_ARRAYID']) - 1} print "ID", id task_id = id except: util.error("NO TASK ID") name = "%s%s" % (code, task_id) print code, " ", task_id, " ", name try: fasta_file = fasta_file.replace("%s", name) except: raise results = paths.join(results, code, name) scr_job = paths.join(scr, "jobs", name) return
def options(argv): global home, shareware,scr, scr_job, fasta_file, code, results, name, cleanup, task_id, no_homs if len(argv) < 3: usage() sys.exit(2) home = os.getcwd() shareware = paths.join(home, "tools") opts, args = getopt.getopt(argv, "t:p:cn") code = args[0] fasta_file = args[1] results = args[2] for o,a in opts: if o == '-t': id ='%(#)03d' % {"#": int(a)} task_id = id if o == '-p': loadProps(a) if o == '-c': cleanup = False if o == '-n': no_homs = True if task_id == None: try: id ='%(#)03d' % {"#": int(os.environ['PBS_ARRAYID'])-1} print "ID",id task_id = id except: util.error("NO TASK ID") name = "%s%s" % (code, task_id) print code," ",task_id," ",name try: fasta_file = fasta_file.replace("%s", name) except: raise results = paths.join(results, code, name) scr_job = paths.join(scr, "jobs", name) return
def existsOrFail(path): if not os.path.exists(path): from hpf.utilities import error error( "Path doesn't exist: %s" % path, path) return path