originalTrees.append(file)

for files in os.listdir(njTreesPath):
    njTrees.append(files)

scores = 0
for i in range(0, len(conditions)):
    matching_files = [f for f in njTrees if conditions[i] in f]
    tree1_path = originalTreesPath + "/" + conditions[i] + ".tt"
    tree1 = dendropy.Tree.get(file=open(tree1_path),
                              schema="newick",
                              rooting='force-unrooted',
                              taxon_namespace=taxa)
    tree1.encode_bipartitions()

    for tree in matching_files:
        tree2_path = njTreesPath + "/" + tree
        tree2 = dendropy.Tree.get(file=open(tree2_path),
                                  schema="newick",
                                  rooting='force-unrooted',
                                  taxon_namespace=taxa)
        tree2.encode_bipartitions()
        results = compare_trees.compare_trees(tree1, tree2)
        f.write(tree1_path + "," + tree2_path + "," + conditions[i] + "," +
                str(results[5]) + "\n")
        scores += results[5]

    print(scores)
    f.write("avr: " + str(scores / 20) + "\n")
    scores = 0
def test_compare_trees_true_same():
    tree1 = BST([2, 1, 1, 1])
    tree2 = BST([2, 1, 1, 1])
    assert compare_trees(tree1, tree2) is True
def test_compare_trees_false():
    tree1 = BST([2, 1, 1, 1])
    tree2 = BST([2, 1, 2, 1])
    assert compare_trees(tree1, tree2) is False
def test_compare_trees_long():
    tree1 = BST([1, 2, 1, 2, 2, 1, 2, 1, 2, 1])
    tree2 = BST([2, 1, 2, 1, 1, 1, 2, 1, 2])
    assert compare_trees(tree1, tree2) is True
def test_compare_trees_none():
    tree1 = BST([])
    tree2 = BST([2, 1, 2])
    assert compare_trees(tree1, tree2) is False