targets = [[t] for t in targets] print targets results_dict = convergence.convCheck(infilename, results_dict, node_key, targets, prob_thresh, gid, tree_dict, pairwise) return results_dict ############################################ #Main Block ############################################ starttime = gc.getLogTime() indir, orig_targets, pairwise, prob_thresh, num_threads, output = optParse() if platform.system() == "Windows" and num_threads != 1: print "\n** Warning! Multi-processing not currently supported on Windows. Switching to serial version (1 process).\n" num_threads = 1 outdir = gc.defaultOut(output, indir, "-gwct") print gc.getTime() + " | + Creating main output directory:\t" + outdir os.system("mkdir " + outdir) ancdir = os.path.join(indir, "anc-seqs-fa") if not os.path.isdir(ancdir): ancdir = os.path.join(indir, "anc_seqs_fa") if not os.path.isdir(ancdir): sys.exit(
##### #def core.logCheck(lopt, lfilename, outline): # if lopt == 1: # core.printWrite(lfilename, outline); # else: # print outline; ############################################ #Main Block ############################################ ins, ppath, treefile, prune, seqtype, bsopt, aopt, v, l, outdir_suffix = optParse(0); starttime = gwctcore.getLogTime(); if not os.path.isdir(ppath): gwctcore.errorOut(10, "-c must be a valid directory path"); optParse(1); if os.path.isfile(ins): fileflag = 1; indir = os.path.dirname(os.path.realpath(ins)); indir, script_outdir = gwctcore.getOutdir(indir, "run_codeml", starttime, outdir_suffix); outdir = os.path.join(script_outdir, "codeml_out"); if aopt == 1: ancdir = os.path.join(script_outdir, "anc_seqs_fa"); filelist = [ins]; else:
if args.target_specs == None: gwctcore.errorOut(2, "-t must be defined"); optParse(1); return args.input, args.target_specs, args.output_suffix; elif errorflag == 1: parser.print_help(); sys.exit(); ############################################ #Main Block ############################################ starttime = gwctcore.getLogTime(); indir, targets, suffix = optParse(0); targets = targets.split(","); indir, script_outdir = gwctcore.getOutdir(indir, "gwct", starttime, suffix); print "# " + gwctcore.getTime() + " | Creating main output directory:\t" + script_outdir; os.system("mkdir " + script_outdir); logfilename = os.path.join(script_outdir, "gwct.log"); logfile = open(logfilename, "w"); logfile.write(""); logfile.close(); uniq_header = "#\tChromosome\tGeneID\tAlignLen\tPosition\tBackgroundAlleles\tTargetAlleles\n"; l = 1; sp = 65;
if n == targets[0]: node_key = node_key + "-"; if node_key not in results_dict: results_dict[node_key] = [[],[],[]]; results_dict = convergence.convCheck(infilename, results_dict, node_key, targets, prob_thresh, chromosome, gene, tree_dict, u); return results_dict; ############################################ #Main Block ############################################ starttime = gwctcore.getLogTime(); indir, orig_targets, unique, pairwise, prob_thresh, num_threads, suffix = optParse(0); if suffix != "": suffix = "-" + suffix; if sys.platform.find("win") != -1 and sys.platform != "darwin": rm_cmd = "del "; else: rm_cmd = "rm "; indir, script_outdir = gwctcore.getOutdir(indir, "gwct", starttime, suffix); print indir; inslist = os.listdir(indir); if unique != 1: for each in inslist: if each.find("run_codeml") != -1 or each.find("codeml_combined") != -1:
try: td, tree, r = gt.treeParse(open(args.tree_file, "r").read().replace("\n","")); except: sys.exit(gc.errorOut(4, "-t does not contain a valid Newick string!")); if args.verbosity not in [0,1]: sys.exit(gc.errorOut(6, "-v must take values of either 1 or 0")); return args.input, args.paml_path, args.tree_file, args.prune_opt, args.verbosity, args.output; ############################################ # Main Block ############################################ starttime = gc.getLogTime(); indir, path, treefile, prune, v, output = optParse(); # Get input options. file_flag = 0; outdir = gc.defaultOut(output, indir, "-gwct-codeml"); print "+ Creating main output directory:\t" + outdir; os.system("mkdir " + outdir); codemldir = os.path.join(outdir, "codeml-out"); ancdir = os.path.join(outdir, "anc-seqs-fa"); logfilename = os.path.join(outdir, "gwct-codeml.log"); # Set output file and directory info. gc.printWrite(logfilename, "Program call: " + " ".join(sys.argv)); pad = 50;
if args.target_specs == None: gwctcore.errorOut(2, "-t must be defined") optParse(1) return args.input, args.target_specs, args.output_suffix elif errorflag == 1: parser.print_help() sys.exit() ############################################ #Main Block ############################################ starttime = gwctcore.getLogTime() indir, targets, suffix = optParse(0) targets = targets.split(",") indir, script_outdir = gwctcore.getOutdir(indir, "gwct", starttime, suffix) print "# " + gwctcore.getTime( ) + " | Creating main output directory:\t" + script_outdir os.system("mkdir " + script_outdir) logfilename = os.path.join(script_outdir, "gwct.log") logfile = open(logfilename, "w") logfile.write("") logfile.close() uniq_header = "#\tChromosome\tGeneID\tAlignLen\tPosition\tBackgroundAlleles\tTargetAlleles\n" l = 1
if node_key not in results_dict: results_dict[node_key] = [[], [], []] results_dict = convergence.convCheck(infilename, results_dict, node_key, targets, prob_thresh, chromosome, gene, tree_dict, u) return results_dict ############################################ #Main Block ############################################ starttime = gwctcore.getLogTime() indir, orig_targets, unique, pairwise, prob_thresh, num_threads, suffix = optParse( 0) if suffix != "": suffix = "-" + suffix if sys.platform.find("win") != -1 and sys.platform != "darwin": rm_cmd = "del " else: rm_cmd = "rm " indir, script_outdir = gwctcore.getOutdir(indir, "gwct", starttime, suffix) print indir inslist = os.listdir(indir) if unique != 1: for each in inslist: