Ejemplo n.º 1
0
def test_beast_vector_annotated_nexus_output_cat():
    lines = fileinput.input("tests/treefiles/beast_output_geo_annotations.nex")
    trees = ComplexNewickParser().consume(lines)
    trees = Cat().consume(trees)
    for t in trees:
        for n in t.traverse():
            assert hasattr(n, "location")
Ejemplo n.º 2
0
def test_init():
    # Test defaults
    cat = Cat.init_from_args("")
    assert cat.burnin == 0
    assert cat.subsample == 1
    assert cat.annotations == True

    # Test burnin
    cat = Cat.init_from_args("--burnin 10")
    assert cat.burnin == 10

    # Test subsample
    cat = Cat.init_from_args("--subsample 10")
    assert cat.subsample == 10

    # Test no annotations
    cat = Cat.init_from_args("--no-annotations")
    assert cat.annotations == False
Ejemplo n.º 3
0
def test_beast_annotated_nexus_output_cat():
    lines = fileinput.input(
        "tests/treefiles/beast_output_rate_annotations.nex")
    trees = ComplexNewickParser().consume(lines)
    trees = Cat().consume(trees)
    for t in trees:
        for n in t.traverse():
            assert hasattr(n, "rate")
        assert len(t.get_leaves()) == 26
Ejemplo n.º 4
0
def test_beast_nexus_output_cat(treefilenewick):
    trees = Cat().consume(treefilenewick('beast_output.nex'))
    for t in trees:
        assert len(t.get_leaves()) == 26
Ejemplo n.º 5
0
def test_basic_cat(basictrees):
    trees = Cat().consume(basictrees)
    assert sum((1 for _ in trees)) == 6
Ejemplo n.º 6
0
def test_mr_bayes_nexus_output_cat(treefilenewick):
    trees = Cat().consume(treefilenewick('mr_bayes_output.nex'))
    for t in trees:
        assert len(t.get_leaves()) == 12
Ejemplo n.º 7
0
def test_beast_vector_annotated_nexus_output_cat(treefilenewick):
    trees = Cat().consume(treefilenewick('beast_output_geo_annotations.nex'))
    for t in trees:
        for n in t.traverse():
            assert hasattr(n, "location")
Ejemplo n.º 8
0
def test_beast_annotated_nexus_output_cat(treefilenewick):
    trees = Cat().consume(treefilenewick('beast_output_rate_annotations.nex'))
    for t in trees:
        for n in t.traverse():
            assert hasattr(n, "rate")
        assert len(t.get_leaves()) == 26
Ejemplo n.º 9
0
def test_command_bad_args():
    with pytest.raises(SystemExit):
        run_command('sibling')
    with pytest.raises(SystemExit):
        _ = Cat.init_from_args("cat --foobar")
Ejemplo n.º 10
0
def test_command_bad_args():
    cat = Cat.init_from_args("cat --foobar")
Ejemplo n.º 11
0
def test_mr_bayes_nexus_output_cat():
    lines = fileinput.input("tests/treefiles/mr_bayes_output.nex")
    trees = ComplexNewickParser().consume(lines)
    trees = Cat().consume(trees)
    for t in trees:
        assert len(t.get_leaves()) == 12
Ejemplo n.º 12
0
def test_burnin():
    lines = fileinput.input("tests/treefiles/basic.trees")
    trees = NewickParser().consume(lines)
    burntin = Cat(burnin=50).consume(trees)
    assert sum((1 for t in burntin)) == 3
Ejemplo n.º 13
0
def test_basic_cat():
    lines = fileinput.input("tests/treefiles/basic.trees")
    trees = NewickParser().consume(lines)
    subsampled = Cat(subsample=2).consume(trees)
    assert sum((1 for t in subsampled)) == 3