def makeBayestreeouts(tree, treehome):
    if not os.path.exists(treehome + "\\" + tree + "_bayes_treeout.txt"):
        os.chdir(treehome)
        tree_extract = BayesExtract(tree, treehome + "\\" + tree + ".nex", treehome, 1000)
        tree_extract.treeMatch()
        trees_file_name = treehome  + tree + "_bayes_treeout.txt"
        shutil.copyfile(tree + "treeout.txt", trees_file_name)
    # Add the base tree in at line one:
        infile1 = open(trees_file_name,'r')
        infile2 = open(tree + ".txt",'r')
        outfile = open(treehome + "temptrees.txt",'w')
        outfile.write(infile2.readline()+"\n")
        infile2.close()
        for line in infile1:
            outfile.write(line)
        infile1.close()
        outfile.close()
        shutil.copyfile("temptrees.txt",trees_file_name)    
    
    else:
        print("Skipping Mr Bayes treeout extraction - already done for " + tree)
Beispiel #2
0
        print("Skipping Mr Bayes Driver generation - already done")
    
    # Run Mr. Bayes MCMC
    '''
    if not os.path.exists(seq_dir + tree + "\\" + tree + ".nex" + ".mcmc"):
        os.chdir(seq_tree_dir)
        command = bayes_exe + " " + tree + "-command.nex"
        call(command.split())
    else:
        print("Skipping Mr Bayes MCMC - already done")
    '''
       
    # Create Bayes treeout
    if not os.path.exists(seq_dir + tree + "\\" + tree + "treeout.txt"):
        os.chdir(seq_tree_dir)
        tree_extract = BayesExtract(tree,seq_tree_dir + tree + ".nex", seq_tree_dir,1000)
        tree_extract.treeMatch()
    '''
    
        
    # Run Raxml if needed with default GTR parameters
    rax_path = "c:/raxml"
    rax_ver = "raxmlHPC"
    raxml_dir = "/raxml"
    data_name = tree
    rax_treeout = tree + "treeout.txt"
    if not os.path.exists(raxml_dir):
        os.mkdir(raxml_dir)
        os.system('./' + rax_ver + ' -s ' + seq_dir + '/' + data_name + '/' + data_name + '.nex' + ' -n ' + data_name + ' -m GTRGAMMA -e 0.001 -f a -k -x 27362 -p 96618 -N 1000 -w ' + os.getcwd() + '/' + raxml_dir )
    '''