Beispiel #1
0
def launch_raxml(alignment,
                 model,
                 output_dir,
                 seed,
                 starting_trees=1,
                 parsimony=False,
                 bs_trees=0,
                 cores=16,
                 debug=False,
                 parse=False):
    util.expect_file_exists(alignment)
    util.make_path(output_dir)

    prefix = os.path.join(output_dir, "raxml")
    prefix += "_" + model.replace("+", "")
    cmd = []
    cmd.append("mpiexec")
    cmd.append("-np")
    cmd.append(str(cores))
    cmd.append(common.raxml)
    cmd.append("--msa")
    cmd.append(alignment)
    cmd.append("--model")
    cmd.append(model)
    cmd.append("--seed")
    cmd.append(str(seed))
    cmd.append("--blmin")
    cmd.append(common.raxml_min_bl)
    if (parse):
        cmd.append("--parse")
    cmd.append("--tree")
    if (starting_trees > 0):
        if (not parsimony):
            cmd.append("rand{" + str(starting_trees) + "}")
            prefix += "_rand" + str(starting_trees)
        else:
            cmd.append("pars{" + str(starting_trees) + "}")
            prefix += "_pars" + str(starting_trees)
    if (bs_trees > 0):
        cmd.append("--boostrap")
        cmd.append("--bs-trees")
        cmd.append(str(bs_trees))
        prefix += "_bs" + str(bs_trees)

    prefix += "_seed" + str(seed)
    cmd.append("--prefix")
    cmd.append(prefix)
    cmd.append('--force')
    cmd.append('perf_threads')
    launcher.submit(prefix, cmd, cores, debug)
def launch_modeltest(alignment, output_dir, seed, cores=16, debug=False):
    try:
        os.mkdir(output_dir)
    except:
        pass
    cmd = []
    prefix = os.path.join(output_dir, "modeltest")
    prefix += "_seed" + str(seed)
    cmd.append("mpiexec")
    cmd.append("-np")
    cmd.append(str(cores))
    cmd.append(common.modeltest)
    cmd.append("-i")
    cmd.append(alignment)
    cmd.append("-t")
    cmd.append("mp")
    cmd.append("-o")
    cmd.append(prefix)
    cmd.append("--force")
    cmd.append("-h")
    cmd.append("uigfr")
    launcher.submit(prefix, cmd, cores, debug)
def launch_pargenes(alignment, model, output_dir, seed, rand_trees, pars_trees,
                    bs_trees, cores):
    util.make_path_clean(output_dir)
    debug = False
    alignment_dir = os.path.join(output_dir, "alignments")
    util.mkdirp(alignment_dir)
    alignment_symlink = os.path.join(alignment_dir, common.pargenes_ali_name)
    raxml_options_file = os.path.join(output_dir, "raxml_options.txt")
    with open(raxml_options_file, "w") as writer:
        writer.write("--model " + model + " ")
        writer.write("--blmin " + common.raxml_min_bl + " ")
        writer.write("--precision " + str(common.raxml_precision) + " ")

    relative_symlink(alignment, alignment_symlink)
    prefix = os.path.join(output_dir, "pargenes")
    cmd = []
    cmd.append("python")
    cmd.append(common.pargenes)
    cmd.append("-a")
    cmd.append(alignment_dir)
    cmd.append("-o")
    cmd.append(os.path.join(output_dir, "pargenes_output"))
    cmd.append("-r")
    cmd.append(raxml_options_file)
    cmd.append("--seed")
    cmd.append(str(seed))
    cmd.append("-s")
    cmd.append(str(rand_trees))
    cmd.append("-p")
    cmd.append(str(pars_trees))
    cmd.append("-b")
    cmd.append(str(bs_trees))
    cmd.append("-c")
    cmd.append(str(cores))
    cmd.append("--core-assignment")
    cmd.append("low")

    print(" ".join(cmd))
    launcher.submit(prefix, cmd, cores, debug)