当前位置: 首页>>代码示例>>Python>>正文


Python PhyloBuddy类代码示例

本文整理汇总了Python中PhyloBuddy的典型用法代码示例。如果您正苦于以下问题:Python PhyloBuddy类的具体用法?Python PhyloBuddy怎么用?Python PhyloBuddy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PhyloBuddy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_screw_formats_inplace_ui

def test_screw_formats_inplace_ui(capsys):
    temp_file = MyFuncs.TempFile()
    with open(resource("compare_trees.newick"), "r") as ifile:
        temp_file.write(ifile.read())

    test_in_args = deepcopy(in_args)
    test_in_args.screw_formats = "nexus"
    test_in_args.in_place = True
    test_in_args.trees[0] = temp_file.path

    tester = Pb.PhyloBuddy(temp_file.path)
    Pb.command_line_ui(test_in_args, tester, skip_exit=True)
    out, err = capsys.readouterr()
    assert "File over-written at:" in err
    check_file = os.path.isfile("%s.nex" % temp_file.path)
    assert check_file

    test_in_args.trees[0] = "%s.nex" % temp_file.path
    test_in_args.screw_formats = "newick"

    tester = Pb.PhyloBuddy("%s.nex" % temp_file.path)
    Pb.command_line_ui(test_in_args, tester, skip_exit=True)
    out, err = capsys.readouterr()
    assert "File over-written at:" in err
    check_file = os.path.isfile("%s.nwk" % temp_file.path)
    assert check_file
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:26,代码来源:phylobuddy_test.py

示例2: test_unroot_ui

def test_unroot_ui(capsys):
    test_in_args = deepcopy(in_args)
    test_in_args.unroot = True

    Pb.command_line_ui(test_in_args, Pb.PhyloBuddy(resource("figtree.nexus")), skip_exit=True)
    out, err = capsys.readouterr()
    assert string2hash(out) == "10e9024301b3178cdaed0b57ba33f615"
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:7,代码来源:phylobuddy_test.py

示例3: test_show_unique

def test_show_unique():
    tester = Pb.PhyloBuddy(resource("compare_trees.newick"))
    Pb.show_unique(tester)
    assert phylo_to_hash(tester) == "ea5b0d1fcd7f39cb556c0f5df96281cf"

    with pytest.raises(AssertionError):  # If only a single tree is present
        tester = Pb.PhyloBuddy(Pb.make_copy(pb_objects[0]))
        Pb.show_unique(tester)
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:8,代码来源:phylobuddy_test.py

示例4: test_split_polytomies

def test_split_polytomies():
    tester = Pb.PhyloBuddy('(A,(B,C,D));')
    Pb.split_polytomies(tester)
    assert str(tester) in ['(A:1.0,(B:1.0,(C:1.0,D:1.0):1e-06):1.0):1.0;\n',
                           '(A:1.0,(B:1.0,(D:1.0,C:1.0):1e-06):1.0):1.0;\n',
                           '(A:1.0,(C:1.0,(B:1.0,D:1.0):1e-06):1.0):1.0;\n',
                           '(A:1.0,(C:1.0,(D:1.0,B:1.0):1e-06):1.0):1.0;\n',
                           '(A:1.0,(D:1.0,(B:1.0,C:1.0):1e-06):1.0):1.0;\n',
                           '(A:1.0,(D:1.0,(C:1.0,B:1.0):1e-06):1.0):1.0;\n']
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:9,代码来源:phylobuddy_test.py

示例5: test_screw_formats_ui

def test_screw_formats_ui(capsys):
    test_in_args = deepcopy(in_args)
    test_in_args.screw_formats = "nexus"

    Pb.command_line_ui(test_in_args, Pb.make_copy(pb_objects[0]), skip_exit=True)
    out, err = capsys.readouterr()
    assert string2hash(out) == "543d2fc90ca1f391312d6b8fe896c59c"
开发者ID:xtmgah,项目名称:BuddySuite,代码行数:7,代码来源:phylobuddy_test.py

示例6: test_root_ui_mrca

def test_root_ui_mrca(capsys):
    test_in_args = deepcopy(in_args)
    test_in_args.root = [["firSA25a", "penSH31b"]]

    Pb.command_line_ui(test_in_args, Pb.make_copy(pb_objects[0]), skip_exit=True)
    out, err = capsys.readouterr()
    assert string2hash(out) == "757489907bd5c82882d084ffcb22cfba"
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:7,代码来源:phylobuddy_test.py

示例7: test_num_tips_ui

def test_num_tips_ui(capsys):
    test_in_args = deepcopy(in_args)
    test_in_args.num_tips = True

    Pb.command_line_ui(test_in_args, pb_resources.get_one("m k"), skip_exit=True)
    out, err = capsys.readouterr()
    assert string2hash(out) == "f43920f4df66e76fbacae4af178eeebb"
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:7,代码来源:phylobuddy_test.py

示例8: test_rename_ids_ui

def test_rename_ids_ui(capsys):
    test_in_args = deepcopy(in_args)
    test_in_args.rename_ids = ['Mle', 'Phylo']

    Pb.command_line_ui(test_in_args, Pb.make_copy(pb_objects[0]), skip_exit=True)
    out, err = capsys.readouterr()
    assert string2hash(out) == "6843a620b725a3a0e0940d4352f2036f"
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:7,代码来源:phylobuddy_test.py

示例9: test_root_ui_leaf

def test_root_ui_leaf(capsys):
    test_in_args = deepcopy(in_args)
    test_in_args.root = [["firSA25a"]]

    Pb.command_line_ui(test_in_args, Pb.make_copy(pb_objects[0]), skip_exit=True)
    out, err = capsys.readouterr()
    assert string2hash(out) == "f32bdc34bfe127bb0453a80cf7b01302"
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:7,代码来源:phylobuddy_test.py

示例10: test_root_ui_midpoint

def test_root_ui_midpoint(capsys):
    test_in_args = deepcopy(in_args)
    test_in_args.root = [[]]

    Pb.command_line_ui(test_in_args, Pb.make_copy(pb_objects[0]), skip_exit=True)
    out, err = capsys.readouterr()
    assert string2hash(out) == "25ea14c2e89530a0fb48163c0ef2a102"
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:7,代码来源:phylobuddy_test.py

示例11: test_screw_formats_ui

def test_screw_formats_ui(capsys):
    test_in_args = deepcopy(in_args)
    test_in_args.screw_formats = "nexus"

    Pb.command_line_ui(test_in_args, pb_resources.get_one("m k"), skip_exit=True)
    out, err = capsys.readouterr()
    assert string2hash(out) == "543d2fc90ca1f391312d6b8fe896c59c"
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:7,代码来源:phylobuddy_test.py

示例12: test_print_trees_ui

def test_print_trees_ui(capsys):
    test_in_args = deepcopy(in_args)
    test_in_args.print_trees = True

    Pb.command_line_ui(test_in_args, Pb.make_copy(pb_objects[0]), skip_exit=True)
    out, err = capsys.readouterr()
    assert string2hash(out) == "fe340117cb8f573100c00fc897e6c8ce"
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:7,代码来源:phylobuddy_test.py

示例13: test_generate_tree_ui3

def test_generate_tree_ui3():
    test_in_args = deepcopy(in_args)
    test_in_args.in_format, test_in_args.out_format = "nexus", "newick"
    test_in_args.trees = [resource("Mnemiopsis_cds.nex")]

    test_in_args.generate_tree = [["foo"]]
    with pytest.raises(SystemExit):
        Pb.command_line_ui(test_in_args, [])
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:8,代码来源:phylobuddy_test.py

示例14: test_generate_tree_ui2

def test_generate_tree_ui2():
    test_in_args = deepcopy(in_args)
    test_in_args.in_format, test_in_args.out_format = "nexus", "newick"
    test_in_args.trees = [resource("Mnemiopsis_cds.nex")]

    test_in_args.generate_tree = [["fasttree", "-s 12345"]]  # Command doesn't exist in fasttree
    with pytest.raises(SystemExit):
        Pb.command_line_ui(test_in_args, [])
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:8,代码来源:phylobuddy_test.py

示例15: test_print_trees_internal_ui

def test_print_trees_internal_ui(capsys):
    # Most of this function is covered repeatedly below, so just test the -t flag
    test_in_args = deepcopy(in_args)
    test_in_args.test = True
    test_in_args.unroot = True
    Pb.command_line_ui(test_in_args, Pb.make_copy(pb_objects[0]), skip_exit=True)
    out, err = capsys.readouterr()
    assert err == "*** Test passed ***\n"
开发者ID:JamesL13,项目名称:BuddySuite,代码行数:8,代码来源:phylobuddy_test.py


注:本文中的PhyloBuddy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。