Exemplo n.º 1
0
    #simulating brownian motion along entire tree
    t = treegenerator.simulate_brownian(t, sigma, dimension)

    #calculating max coordinate to give the bounds of habitat for phyrex

    max_coordinate = 0
    for node in t.preorder_node_iter():
        max_coordinate = max(max_coordinate, abs(node.X))
        if dimension == 2:
            max_coordinate = max(max_coordinate, abs(node.Y))

    #line of code for writing xml file for full sampling (this is not needed necessary)
    beastxmlwriter.write_BEAST_xml(
        t,
        i,
        dimension,
        mcmc,
        log_every,
        beast_input_string="output/beast/no_sampling/beast_input/beast",
        beast_output_string="output/beast/no_sampling/beast_output/beast")

    if generate_sample_files:

        for output_index in range(1, num_sampling + 1):
            if output_index == 1:
                sampled_t = sampling.sample_unbiased(t,
                                                     dimension,
                                                     sample_ratio=sample_ratio)
            elif output_index == 2:
                sampled_t = sampling.sample_biased_most_central(
                    t, dimension, sample_ratio=sample_ratio)
            elif output_index == 3:
Exemplo n.º 2
0
            if leaf_index < 10:
                leaf_label = "s000" + str(leaf_index)
            elif leaf_index < 100:
                leaf_label = "s00" + str(leaf_index)
            elif leaf_index < 1000:
                leaf_label = "s0" + str(leaf_index)
            node = tree.find_node_with_taxon_label(leaf_label)
            node.X = a[leaf_index][0]
            node.Y = a[leaf_index][1]
            node.annotations.add_bound_attribute("X")
            node.annotations.add_bound_attribute("Y")
            node.annotations.add_bound_attribute("time")
        beastxmlwriter.write_BEAST_xml(
            tree,
            index,
            dimension=2,
            mcmc=10000,
            log_every=10,
            beast_input_string="output/beast/LV/beast_input/beast",
            beast_output_string="output/beast/LV/beast_output/beast")
        discs_phyrexxmlwriter.write_phyrex_input(
            tree,
            index,
            input_string="output/phyrex/LV/phyrex_input/",
            output_string="output/phyrex/LV/phyrex_output/",
            bound=L)

        os.system(
            'ulimit -c unlimited; beast -overwrite -seed 123456795 "output/beast/LV/beast_input/beast'
            + str(index) + '.xml"')

    #line to run BEAST
Exemplo n.º 3
0
    beastxmlwriter.write_BEAST_xml_corrected(
        tree,
        sampled_t,
        d,
        i=i,
        mcmc=10000000,
        log_every=1000,
        beast_input_string="output/c_beast/beast_input/beast",
        beast_output_string="output/c_beast/beast_output/beast",
        other_sample_size=other_sample_size,
        seq_len=seq_len)

    beastxmlwriter.write_BEAST_xml(
        sampled_t,
        i=i,
        dimension=2,
        mcmc=10000,
        log_every=10,
        beast_input_string="output/c_beast/beast_input/nbeast",
        beast_output_string="output/c_beast/beast_output/nbeast")

    os.system(
        'beast -overwrite -seed 123456795 "output/c_beast/beast_input/beast' +
        str(i) + '.xml"')
    os.system(
        'beast -overwrite -seed 123456795 "output/c_beast/beast_input/nbeast' +
        str(i) + '.xml"')

    file = open("output/root_data/actual_root" + str(i) + ".txt", "w")
    file.write(str(sampled_t.seed_node.X) + '\n')
    file.write(str(sampled_t.seed_node.Y) + '\n')
    file.close()