Ejemplo n.º 1
0
    def test_tree_integrity_ascii(self):
        with open('test_data/tree_example.p', 'rb') as file:
            test_tree = pickle.load(file)


        TaxTree.ranked_lineage_filepath = '../../bin/database/taxonomy/rankedlineage.dmp'

        rootNode = TaxTree.TaxNode("ROOT")
        TaxTree.loadRankedLineage(species_indexes,rootNode)
        rootNode.countChildren()
        ETETree = TaxTree.create_ETE_tree(rootNode)
        ascii = TaxTree.get_ASCII_tree(ETETree)

        self.assertEqual(ascii, test_tree)
Ejemplo n.º 2
0
    def test_ETETree(self):

        with open('test_data/ETETree_example.p', 'rb') as file:
            ETETree_example = pickle.load(file)
        TaxTree.ranked_lineage_filepath = '../../bin/database/taxonomy/rankedlineage.dmp'
        rootNode = TaxTree.TaxNode("ROOT")
        TaxTree.loadRankedLineage(species_indexes, rootNode)
        rootNode.countChildren()
        ETETree = TaxTree.create_ETE_tree(rootNode)

        f = io.StringIO()
        with redirect_stdout(f):
            ETETree.describe()
        ETE_describe = f.getvalue()

        t = io.StringIO()
        with redirect_stdout(t):
            ETETree_example.describe()
        ETE_test_describe = t.getvalue()

        self.assertEqual(ETE_describe,ETE_test_describe)