def phylogeneticTreeFromFile(self, treefile, file_format): dataset = Dataset() dataset.read(open(treefile, 'rU'), schema=file_format) dendropy_tree = dataset.tree_lists[0][0] tree = PhylogeneticTree(dendropy_tree) tree.calc_splits() delete_outdegree_one(tree._tree) return tree
def read_tree_from_file(self, treefile, file_format): dataset = Dataset() dataset.read(open(treefile, 'rU'), schema=file_format) dendropy_tree = dataset.trees_blocks[0][0] self._tree = dendropy_tree self.n_leaves = self.count_leaves()