def bootstrap_worker(params): """Worker function to compute boostrap replicates of datasets and indiv. loci""" bootstrap_trees = [] rep, fullpth, oneliners = params pth, exe = os.path.split(fullpth) # first, resample w/ replacement/bootstrap across loci multilocus_bstrap = get_bootstraps(oneliners) # Resample w/ replacement/boostrap bases within loci bootstraps = get_bootstrap_replicates(multilocus_bstrap) for oneliner in bootstraps: args_dict, locus = split_oneliner(oneliner, default_model=True) phylip = oneliner_to_phylip(locus) phyml = Phyml(phylip, pth=pth, exe=exe) # run phyml. if no model, defaults to GTR # TOOD: Why do we need LnL? args_dict['lnL'], tree = phyml.run(args_dict['model']) #bootstrap_trees.append("tree '%s' = [&U] %s" % (make_tree_name(args_dict), tree)) bootstrap_trees.append('''%s\t"%s"''' % (rep, tree)) sys.stdout.write("[Info] {0} {1} bootstrap completed\n".format( strftime("%a, %d %b %Y %H:%M:%S", localtime()), args_dict['chrm'] ) ) sys.stdout.flush() return bootstrap_trees
def genetree_worker(params): """Worker function to compute genetrees for individual loci""" locus, fullpth = params name, phylip = locus pth, exe = os.path.split(fullpth) args_dict = {} phyml = Phyml(phylip, pth=pth, exe=exe) model, tree = phyml.best_aicc_model_and_tree() args_dict["chrm"] = name args_dict["model"] = model tree = "tree '%s' = [&U] %s" % (make_tree_name(args_dict), tree) sys.stdout.write("[Info] {0} {1} genetree completed\n".format(strftime("%a, %d %b %Y %H:%M:%S", localtime()), name)) sys.stdout.flush() return (name, model, tree)
def genetree_worker(params): """Worker function to compute genetrees for individual loci""" locus, fullpth = params name, phylip = locus pth, exe = os.path.split(fullpth) args_dict = {} phyml = Phyml(phylip, pth=pth, exe=exe) model, tree = phyml.best_aicc_model_and_tree() args_dict['chrm'] = name args_dict['model'] = model tree = "tree '%s' = [&U] %s" % (make_tree_name(args_dict), tree) sys.stdout.write("[Info] {0} {1} genetree completed\n".format( strftime("%a, %d %b %Y %H:%M:%S", localtime()), name)) sys.stdout.flush() return (name, model, tree)
def bootstrap_worker(params): """Worker function to compute boostrap replicates of datasets and indiv. loci""" bootstrap_trees = [] rep, fullpth, oneliners = params pth, exe = os.path.split(fullpth) # first, resample w/ replacement/bootstrap across loci multilocus_bstrap = get_bootstraps(oneliners) # Resample w/ replacement/boostrap bases within loci bootstraps = get_bootstrap_replicates(multilocus_bstrap) for oneliner in bootstraps: args_dict, locus = split_oneliner(oneliner, default_model=True) phylip = oneliner_to_phylip(locus) phyml = Phyml(phylip, pth=pth, exe=exe) # run phyml. if no model, defaults to GTR # TOOD: Why do we need LnL? args_dict['lnL'], tree = phyml.run(args_dict['model']) #bootstrap_trees.append("tree '%s' = [&U] %s" % (make_tree_name(args_dict), tree)) bootstrap_trees.append('''%s\t"%s"''' % (rep, tree)) sys.stdout.write("[Info] {0} bootstrap completed\n".format( strftime("%a, %d %b %Y %H:%M:%S", localtime()))) sys.stdout.flush() return bootstrap_trees