コード例 #1
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__add_support__multiple_trees__two_cladees():
    main_tree = Newick.from_string("((A,B),(C,(D,E)));")
    bootstraps = [Newick.from_string("((((C,E),D),A),B);"),
                  Newick.from_string("(((A,(C,D)),B),E);")]
    expected = Newick.from_string("((A,B)1,(C,(D,E)0)1);")
    result = main_tree.add_support(bootstraps)
    assert_equal(expected, result)
コード例 #2
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__add_support__multiple_trees__partially_different_topologies():
    main_tree = Newick.from_string("(((A,B),C),D);")
    bootstraps = [Newick.from_string("(((C,D),A),B);"),
                  Newick.from_string("(((A,D),B),C);")]
    expected = Newick.from_string("(((A,B)1,C)2,D);")
    result = main_tree.add_support(bootstraps)
    assert_equal(expected, result)
コード例 #3
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
 def _do_test_formatting(fmt, expected):
     main_tree = Newick.from_string("(((A,B),C),D);")
     bootstraps = [Newick.from_string("(((C,D),A),B);"),
                   Newick.from_string("(((C,B),A),D);"),
                   Newick.from_string("(((A,D),B),C);")]
     expected = Newick.from_string(expected)
     result = main_tree.add_support(bootstraps, fmt)
     assert_equal(expected, result)
コード例 #4
0
ファイル: newick_test.py プロジェクト: tmancill/paleomix
def test_newick__add_support__multiple_trees__different_topologies():
    main_tree = Newick.from_string("(((A,B),C),D);")
    bootstraps = [
        Newick.from_string("(((C,B),D),A);"),
        Newick.from_string("(((A,D),B),C);"),
    ]
    expected = Newick.from_string("(((A,B)0,C)2,D);")
    result = main_tree.add_support(bootstraps)
    assert expected == result
コード例 #5
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__add_support__multiple_trees__partially_different_topologies():
    main_tree = Newick.from_string("(((A,B),C),D);")
    bootstraps = [
        Newick.from_string("(((C,D),A),B);"),
        Newick.from_string("(((A,D),B),C);")
    ]
    expected = Newick.from_string("(((A,B)1,C)2,D);")
    result = main_tree.add_support(bootstraps)
    assert_equal(expected, result)
コード例 #6
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__add_support__multiple_trees__two_cladees():
    main_tree = Newick.from_string("((A,B),(C,(D,E)));")
    bootstraps = [
        Newick.from_string("((((C,E),D),A),B);"),
        Newick.from_string("(((A,(C,D)),B),E);")
    ]
    expected = Newick.from_string("((A,B)1,(C,(D,E)0)1);")
    result = main_tree.add_support(bootstraps)
    assert_equal(expected, result)
コード例 #7
0
ファイル: newick_test.py プロジェクト: tmancill/paleomix
def test_newick__add_support__formatting(fmt, expected):
    main_tree = Newick.from_string("(((A,B),C),D);")
    bootstraps = [
        Newick.from_string("(((C,D),A),B);"),
        Newick.from_string("(((C,B),A),D);"),
        Newick.from_string("(((A,D),B),C);"),
    ]
    expected = Newick.from_string(expected)
    result = main_tree.add_support(bootstraps, fmt)
    assert expected == result
コード例 #8
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
 def _do_test_formatting(fmt, expected):
     main_tree = Newick.from_string("(((A,B),C),D);")
     bootstraps = [
         Newick.from_string("(((C,D),A),B);"),
         Newick.from_string("(((C,B),A),D);"),
         Newick.from_string("(((A,D),B),C);")
     ]
     expected = Newick.from_string(expected)
     result = main_tree.add_support(bootstraps, fmt)
     assert_equal(expected, result)
コード例 #9
0
ファイル: newick_test.py プロジェクト: tmancill/paleomix
def test_newick__malformed__missing_length():
    with pytest.raises(NewickParseError):
        Newick.from_string("(A:,(B,C));")
    with pytest.raises(NewickParseError):
        Newick.from_string("(A,(B:,C));")
    with pytest.raises(NewickParseError):
        Newick.from_string("(A,(B,C:));")
    with pytest.raises(NewickParseError):
        Newick.from_string("(A,(B,C):);")
    with pytest.raises(NewickParseError):
        Newick.from_string("(A,(B,C)):;")
コード例 #10
0
    def _setup(self, config, temp):
        with open(self._bootstraps) as handle:
            bootstraps = [Newick.from_string(line.strip()) for line in handle]

        with open(self._treefile) as handle:
            tree = Newick.from_string(handle.read().strip())

        tree = tree.reroot_on_midpoint()
        tree = tree.add_support(bootstraps, "{Percentage:.0f}")
        with open(os.path.join(temp, "rerooted.newick"), "w") as handle:
            handle.write("{}\n".format(tree))

        CommandNode._setup(self, config, temp)
コード例 #11
0
ファイル: mitochondria.py プロジェクト: muslih14/paleomix
    def _setup(self, config, temp):
        with open(self._bootstraps) as handle:
            bootstraps = [Newick.from_string(line.strip())
                          for line in handle]

        with open(self._treefile) as handle:
            tree = Newick.from_string(handle.read().strip())

        tree = tree.reroot_on_midpoint()
        tree = tree.add_support(bootstraps, "{Percentage:.0f}")
        with open(os.path.join(temp, "rerooted.newick"), "w") as handle:
            handle.write("{}\n".format(tree))

        CommandNode._setup(self, config, temp)
コード例 #12
0
ファイル: newick.py プロジェクト: MikkelSchubert/paleomix
def _read_tree_files(filenames):
    trees = []
    for filename in filenames:
        with open(filename) as handle:
            for line in handle:
                trees.append(Newick.from_string(line))
    return trees
コード例 #13
0
def _read_tree_files(filenames):
    trees = []
    for filename in filenames:
        with open(filename) as handle:
            for line in handle:
                trees.append(Newick.from_string(line))
    return trees
コード例 #14
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__parse__subnode__two_taxa():
    child_node_1 = Newick(name="A")
    child_node_2a = Newick(name="B")
    child_node_2b = Newick(name="C")
    child_node_2 = Newick(children=[child_node_2a, child_node_2b])
    top_node = Newick(children=[child_node_1, child_node_2])
    assert_equal(Newick.from_string("(A,(B,C));"), top_node)
コード例 #15
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__parse__subnode__two_taxa():
    child_node_1 = Newick(name="A")
    child_node_2a = Newick(name="B")
    child_node_2b = Newick(name="C")
    child_node_2 = Newick(children=[child_node_2a, child_node_2b])
    top_node = Newick(children=[child_node_1, child_node_2])
    assert_equal(Newick.from_string("(A,(B,C));"), top_node)
コード例 #16
0
ファイル: newick_test.py プロジェクト: tmancill/paleomix
def test_newick__wikipedia_example_5():
    # all have a distance to parent
    taxa_d = Newick(length="0.4")
    taxa_c = Newick(length="0.3")
    taxa_sub = Newick(children=[taxa_c, taxa_d], length="0.5")
    taxa_b = Newick(length="0.2")
    taxa_a = Newick(length="0.1")
    top_node = Newick(children=[taxa_a, taxa_b, taxa_sub], length="0.0")
    assert Newick.from_string("(:0.1,:0.2,(:0.3,:0.4):0.5):0.0;") == top_node
コード例 #17
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__wikipedia_example_4():
    # all but root node have a distance to parent
    taxa_d = Newick(length="0.4")
    taxa_c = Newick(length="0.3")
    taxa_sub = Newick(children=[taxa_c, taxa_d], length="0.5")
    taxa_b = Newick(length="0.2")
    taxa_a = Newick(length="0.1")
    top_node = Newick(children=[taxa_a, taxa_b, taxa_sub])
    assert_equal(Newick.from_string("(:0.1,:0.2,(:0.3,:0.4):0.5);"), top_node)
コード例 #18
0
ファイル: newick_test.py プロジェクト: tmancill/paleomix
def test_newick__wikipedia_example_8():
    # a tree rooted on a leaf node (rare)
    taxa_b = Newick(length="0.2", name="B")
    taxa_c = Newick(length="0.3", name="C")
    taxa_d = Newick(length="0.4", name="D")
    node_e = Newick(length="0.5", name="E", children=[taxa_c, taxa_d])
    node_f = Newick(length="0.1", name="F", children=[taxa_b, node_e])
    node_a = Newick(name="A", children=[node_f])
    assert Newick.from_string("((B:0.2,(C:0.3,D:0.4)E:0.5)F:0.1)A;") == node_a
コード例 #19
0
ファイル: newick_test.py プロジェクト: tmancill/paleomix
def test_newick__wikipedia_example_6():
    # distances and leaf names (popular)
    taxa_d = Newick(length="0.4", name="D")
    taxa_c = Newick(length="0.3", name="C")
    taxa_sub = Newick(children=[taxa_c, taxa_d], length="0.5")
    taxa_b = Newick(length="0.2", name="B")
    taxa_a = Newick(length="0.1", name="A")
    top_node = Newick(children=[taxa_a, taxa_b, taxa_sub])
    assert Newick.from_string("(A:0.1,B:0.2,(C:0.3,D:0.4):0.5);") == top_node
コード例 #20
0
ファイル: newick_test.py プロジェクト: tmancill/paleomix
def test_newick__wikipedia_example_7():
    # distances and all names
    taxa_d = Newick(length="0.4", name="D")
    taxa_c = Newick(length="0.3", name="C")
    taxa_sub = Newick(children=[taxa_c, taxa_d], length="0.5", name="E")
    taxa_b = Newick(length="0.2", name="B")
    taxa_a = Newick(length="0.1", name="A")
    top_node = Newick(children=[taxa_a, taxa_b, taxa_sub], name="F")
    assert Newick.from_string("(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5)F;") == top_node
コード例 #21
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__wikipedia_example_2():
    # leaf nodes are named
    taxa_d = Newick(name="D")
    taxa_c = Newick(name="C")
    taxa_sub = Newick(children=[taxa_c, taxa_d])
    taxa_b = Newick(name="B")
    taxa_a = Newick(name="A")
    top_node = Newick(children=[taxa_a, taxa_b, taxa_sub])
    assert_equal(Newick.from_string("(A,B,(C,D));"), top_node)
コード例 #22
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__wikipedia_example_8():
    # a tree rooted on a leaf node (rare)
    taxa_b = Newick(length="0.2", name="B")
    taxa_c = Newick(length="0.3", name="C")
    taxa_d = Newick(length="0.4", name="D")
    node_e = Newick(length="0.5", name="E", children=[taxa_c, taxa_d])
    node_f = Newick(length="0.1", name="F", children=[taxa_b, node_e])
    node_a = Newick(name="A", children=[node_f])
    assert_equal(Newick.from_string("((B:0.2,(C:0.3,D:0.4)E:0.5)F:0.1)A;"), node_a)
コード例 #23
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__wikipedia_example_3():
    # all nodes are named
    taxa_d = Newick(name="D")
    taxa_c = Newick(name="C")
    taxa_sub = Newick(children=[taxa_c, taxa_d], name="E")
    taxa_b = Newick(name="B")
    taxa_a = Newick(name="A")
    top_node = Newick(children=[taxa_a, taxa_b, taxa_sub], name="F")
    assert_equal(Newick.from_string("(A,B,(C,D)E)F;"), top_node)
コード例 #24
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__wikipedia_example_7():
    # distances and all names
    taxa_d = Newick(length="0.4", name="D")
    taxa_c = Newick(length="0.3", name="C")
    taxa_sub = Newick(children=[taxa_c, taxa_d], length="0.5", name="E")
    taxa_b = Newick(length="0.2", name="B")
    taxa_a = Newick(length="0.1", name="A")
    top_node = Newick(children=[taxa_a, taxa_b, taxa_sub], name="F")
    assert_equal(Newick.from_string("(A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5)F;"), top_node)
コード例 #25
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__wikipedia_example_6():
    # distances and leaf names (popular)
    taxa_d = Newick(length="0.4", name="D")
    taxa_c = Newick(length="0.3", name="C")
    taxa_sub = Newick(children=[taxa_c, taxa_d], length="0.5")
    taxa_b = Newick(length="0.2", name="B")
    taxa_a = Newick(length="0.1", name="A")
    top_node = Newick(children=[taxa_a, taxa_b, taxa_sub])
    assert_equal(Newick.from_string("(A:0.1,B:0.2,(C:0.3,D:0.4):0.5);"), top_node)
コード例 #26
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__wikipedia_example_5():
    # all have a distance to parent
    taxa_d = Newick(length="0.4")
    taxa_c = Newick(length="0.3")
    taxa_sub = Newick(children=[taxa_c, taxa_d], length="0.5")
    taxa_b = Newick(length="0.2")
    taxa_a = Newick(length="0.1")
    top_node = Newick(children=[taxa_a, taxa_b, taxa_sub], length="0.0")
    assert_equal(Newick.from_string("(:0.1,:0.2,(:0.3,:0.4):0.5):0.0;"), top_node)
コード例 #27
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__wikipedia_example_3():
    # all nodes are named
    taxa_d = Newick(name="D")
    taxa_c = Newick(name="C")
    taxa_sub = Newick(children=[taxa_c, taxa_d], name="E")
    taxa_b = Newick(name="B")
    taxa_a = Newick(name="A")
    top_node = Newick(children=[taxa_a, taxa_b, taxa_sub], name="F")
    assert_equal(Newick.from_string("(A,B,(C,D)E)F;"), top_node)
コード例 #28
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__wikipedia_example_2():
    # leaf nodes are named
    taxa_d = Newick(name="D")
    taxa_c = Newick(name="C")
    taxa_sub = Newick(children=[taxa_c, taxa_d])
    taxa_b = Newick(name="B")
    taxa_a = Newick(name="A")
    top_node = Newick(children=[taxa_a, taxa_b, taxa_sub])
    assert_equal(Newick.from_string("(A,B,(C,D));"), top_node)
コード例 #29
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__parse__ignore_whitespace():
    assert_equal(Newick.from_string("(A,B);"), Newick.from_string("(A, B);"))
コード例 #30
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__parse__three_taxa():
    child_node_1 = Newick(name="A")
    child_node_2 = Newick(name="Bc")
    child_node_3 = Newick(name="DeF")
    top_node = Newick(children=[child_node_1, child_node_2, child_node_3])
    assert_equal(Newick.from_string("(A,Bc,DeF);"), top_node)
コード例 #31
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__parse__single_taxa():
    child_node = Newick(name="Ab")
    top_node = Newick(children=[child_node])
    assert_equal(Newick.from_string("(Ab);"), top_node)
コード例 #32
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__add_support__unique_names_required():
    main_tree = Newick.from_string("(((A,B),C),A);")
    bootstraps = [Newick.from_string("(((A,B),C),A);")]
    assert_raises(NewickError, main_tree.add_support, bootstraps)
コード例 #33
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__add_support__differing_leaf_names():
    main_tree = Newick.from_string("(((A,B),C),D);")
    bootstraps = [Newick.from_string("(((C,E),B),A);")]
    assert_raises(NewickError, main_tree.add_support, bootstraps)
コード例 #34
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__reroot_on_taxa__no_non_root_taxa():
    source = Newick.from_string("((B,C),((D,E),A));")
    assert_raises(ValueError, source.reroot_on_taxa, ("A", "B", "C", "D", "E"))
コード例 #35
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__add_support__no_trees():
    main_tree = Newick.from_string("(((A,B),C),D);")
    expected = Newick.from_string("(((A,B)0,C)0,D);")
    result = main_tree.add_support([])
    assert_equal(expected, result)
コード例 #36
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__reroot_on_midpoint__reroot_on_internal_node():
    source = Newick.from_string("((A:5.0,B:1.0)C:2.0,D:3.0);")
    rerooted = source.reroot_on_midpoint()
    expected = Newick.from_string("(A:5.0,B:1.0,D:5.0)C;")
    assert_equal(expected, rerooted)
コード例 #37
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__parse__two_taxa():
    child_node_1 = Newick(name="A")
    child_node_2 = Newick(name="Bc")
    top_node = Newick(children=[child_node_1, child_node_2])
    assert_equal(Newick.from_string("(A,Bc);"), top_node)
コード例 #38
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__reroot_on_midpoint__nested_clades():
    source = Newick.from_string("((A:2,(B:2,C:3):4):1,(D:1,E:0.5):2);")
    rerooted = source.reroot_on_midpoint()
    expected = Newick.from_string("(((D:1,E:0.5):3.0,A:2):1.5,(B:2,C:3):2.5);")
    assert_equal(expected, rerooted)
コード例 #39
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__reroot_on_midpoint__nested_clades():
    source = Newick.from_string("((A:2,(B:2,C:3):4):1,(D:1,E:0.5):2);")
    rerooted = source.reroot_on_midpoint()
    expected = Newick.from_string("(((D:1,E:0.5):3.0,A:2):1.5,(B:2,C:3):2.5);")
    assert_equal(expected, rerooted)
コード例 #40
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__add_support__differing_leaf_names():
    main_tree = Newick.from_string("(((A,B),C),D);")
    bootstraps = [Newick.from_string("(((C,E),B),A);")]
    assert_raises(NewickError, main_tree.add_support, bootstraps)
コード例 #41
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
 def _test_invalid_branch_lengths(newick):
     source = Newick.from_string(newick)
     assert_raises(GraphError, source.reroot_on_midpoint)
コード例 #42
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__reroot_on_midpoint__two_clades():
    source = Newick.from_string("((A:7,B:2):1,(C:1,D:0.5):2);")
    rerooted = source.reroot_on_midpoint()
    expected = Newick.from_string("(((C:1,D:0.5):3.0,B:2):1.5,A:5.5);")
    assert_equal(expected, rerooted)
コード例 #43
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__add_support__single_identical_tree__different_rooting():
    main_tree = Newick.from_string("(((A,B),C),D);")
    bootstraps = [Newick.from_string("(((C,D),B),A);")]
    expected = Newick.from_string("(((A,B)1,C)1,D);")
    result = main_tree.add_support(bootstraps)
    assert_equal(expected, result)
コード例 #44
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__reroot_on_midpoint__two_nodes():
    source = Newick.from_string("(A:3.0,B:8.0);")
    rerooted = source.reroot_on_midpoint()
    expected = Newick.from_string("(A:5.5,B:5.5);")
    assert_equal(expected, rerooted)
コード例 #45
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__reroot_on_taxa__unknown_taxa():
    source = Newick.from_string("((B,C),((D,E),A));")
    assert_raises(ValueError, source.reroot_on_taxa, ("A", "Z"))
コード例 #46
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__reroot_on_midpoint__single_node():
    source = Newick.from_string("(A:3.0);")
    expected = Newick.from_string("(A:3.0);")
    assert_equal(expected, source.reroot_on_midpoint())
コード例 #47
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__reroot_on_midpoint__reroot_on_internal_node():
    source = Newick.from_string("((A:5.0,B:1.0)C:2.0,D:3.0);")
    rerooted = source.reroot_on_midpoint()
    expected = Newick.from_string("(A:5.0,B:1.0,D:5.0)C;")
    assert_equal(expected, rerooted)
コード例 #48
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
 def _newick_str_input_equals_output(nwk_str):
     nodes = Newick.from_string(nwk_str)
     result = str(nodes)
     assert_equal(result, nwk_str)
コード例 #49
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__parse__minimal_newick__name_only():
    top_node = Newick(name="A")
    assert_equal(Newick.from_string("A;"), top_node)
コード例 #50
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__add_support__single_identical_tree__different_rooting():
    main_tree = Newick.from_string("(((A,B),C),D);")
    bootstraps = [Newick.from_string("(((C,D),B),A);")]
    expected = Newick.from_string("(((A,B)1,C)1,D);")
    result = main_tree.add_support(bootstraps)
    assert_equal(expected, result)
コード例 #51
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__parse__two_taxa():
    child_node_1 = Newick(name="A")
    child_node_2 = Newick(name="Bc")
    top_node = Newick(children=[child_node_1, child_node_2])
    assert_equal(Newick.from_string("(A,Bc);"), top_node)
コード例 #52
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
 def _test_invalid_branch_lengths(newick):
     source = Newick.from_string(newick)
     assert_raises(GraphError, source.reroot_on_midpoint)
コード例 #53
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__parse__ignore_whitespace():
    assert_equal(Newick.from_string("(A,B);"), Newick.from_string("(A, B);"))
コード例 #54
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__parse__three_taxa():
    child_node_1 = Newick(name="A")
    child_node_2 = Newick(name="Bc")
    child_node_3 = Newick(name="DeF")
    top_node = Newick(children=[child_node_1, child_node_2, child_node_3])
    assert_equal(Newick.from_string("(A,Bc,DeF);"), top_node)
コード例 #55
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__parse__minimal_newick__name_only():
    top_node = Newick(name="A")
    assert_equal(Newick.from_string("A;"), top_node)
コード例 #56
0
ファイル: newick_tests.py プロジェクト: jelber2/paleomix
def test_newick__reroot_on_midpoint__two_clades():
    source = Newick.from_string("((A:7,B:2):1,(C:1,D:0.5):2);")
    rerooted = source.reroot_on_midpoint()
    expected = Newick.from_string("(((C:1,D:0.5):3.0,B:2):1.5,A:5.5);")
    assert_equal(expected, rerooted)
コード例 #57
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__add_support__unique_names_required():
    main_tree = Newick.from_string("(((A,B),C),A);")
    bootstraps = [Newick.from_string("(((A,B),C),A);")]
    assert_raises(NewickError, main_tree.add_support, bootstraps)
コード例 #58
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__parse__single_taxa():
    child_node = Newick(name="Ab")
    top_node = Newick(children=[child_node])
    assert_equal(Newick.from_string("(Ab);"), top_node)
コード例 #59
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
 def _newick_str_input_equals_output(nwk_str):
     nodes = Newick.from_string(nwk_str)
     result = str(nodes)
     assert_equal(result, nwk_str)
コード例 #60
0
ファイル: newick_tests.py プロジェクト: muslih14/paleomix
def test_newick__add_support__no_trees():
    main_tree = Newick.from_string("(((A,B),C),D);")
    expected = Newick.from_string("(((A,B)0,C)0,D);")
    result = main_tree.add_support([])
    assert_equal(expected, result)