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
Esempio n. 2
0
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