def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) tree = parse_newick(open(opts.master_tree, 'U')) support_file = open(opts.support) bootstraps = parse_bootstrap_support(support_file) support_file.close() write_pdf_bootstrap_tree(tree, opts.output_file, bootstraps)
def test_write_pdf_bootstrap_tree(self): """ write_pdf_bootstrap_tree should throw no errors""" tree = parse_newick("((tax7:0.1,tax3:0.2)node0:.98,tax8:.3, tax4:.3)node1:.4", PhyloNode) bootstraps = {"node0": 0.7, "node1": 0.4} fd, f = mkstemp(prefix="make_bootstrapped_tree_test", suffix=".pdf") close(fd) self._paths_to_clean_up.append(f) write_pdf_bootstrap_tree(tree, f, bootstraps) assert os.path.exists(f)
def test_write_pdf_bootstrap_tree(self): """ write_pdf_bootstrap_tree should throw no errors""" tree = parse_newick( "((tax7:0.1,tax3:0.2)node0:.98,tax8:.3, tax4:.3)node1:.4", PhyloNode) bootstraps = {'node0': .7, 'node1': .4} fd, f = mkstemp(prefix='make_bootstrapped_tree_test', suffix='.pdf') close(fd) self._paths_to_clean_up.append(f) write_pdf_bootstrap_tree(tree, f, bootstraps) assert (os.path.exists(f))
def test_write_pdf_bootstrap_tree(self): """ write_pdf_bootstrap_tree should throw no errors""" tree = parse_newick( "((tax7:0.1,tax3:0.2)node0:.98,tax8:.3, tax4:.3)node1:.4", PhyloNode) bootstraps = {'node0': .7, 'node1': .4} _, f = mkstemp(prefix='make_bootstrapped_tree_test', suffix='.pdf') close(_) self._paths_to_clean_up.append(f) write_pdf_bootstrap_tree(tree, f, bootstraps) assert(os.path.exists(f))
def test_write_pdf_bootstrap_tree(self): """ write_pdf_bootstrap_tree should throw no errors""" tree = parse_newick( "((tax7:0.1,tax3:0.2)node0:.98,tax8:.3, tax4:.3)node1:.4", PhyloNode) bootstraps = {'node0':.7,'node1':.4} f = get_tmp_filename(\ prefix='make_bootstrapped_tree_test',\ suffix='.pdf',\ result_constructor=str) self._paths_to_clean_up.append(f) write_pdf_bootstrap_tree(tree, f, bootstraps) assert(os.path.exists(f))
def test_write_pdf_bootstrap_tree(self): """ write_pdf_bootstrap_tree should throw no errors""" tree = parse_newick( "((tax7:0.1,tax3:0.2)node0:.98,tax8:.3, tax4:.3)node1:.4", PhyloNode) bootstraps = {'node0': .7, 'node1': .4} f = get_tmp_filename(\ prefix='make_bootstrapped_tree_test',\ suffix='.pdf',\ result_constructor=str) self._paths_to_clean_up.append(f) write_pdf_bootstrap_tree(tree, f, bootstraps) assert (os.path.exists(f))
def test_write_pdf_bootstrap_tree_escaped_names(self): """ write_pdf_bootstrap_tree functions when newick names are escaped This test essentially is only checking that no failures arise from having escaped strings as nodes in the newick file. Visual inspection of the resulting PDFs shows that the coloring is occuring as expected but unfortunately there is not a great way to test for this. """ tree = parse_newick("((tax7:0.1,'tax3':0.2)'no__``!!:o de0':.98,'ta___x8':.3, tax4:.3)node1:.4", PhyloNode) bootstraps = {"no__``!!:o de0": 0.7, "node1": 0.4} fd, f = mkstemp(prefix="make_bootstrapped_tree_test", suffix=".pdf") close(fd) self._paths_to_clean_up.append(f) write_pdf_bootstrap_tree(tree, f, bootstraps) assert os.path.exists(f)
def test_write_pdf_bootstrap_tree_escaped_names(self): """ write_pdf_bootstrap_tree functions when newick names are escaped This test essentially is only checking that no failures arise from having escaped strings as nodes in the newick file. Visual inspection of the resulting PDFs shows that the coloring is occuring as expected but unfortunately there is not a great way to test for this. """ tree = parse_newick( "((tax7:0.1,'tax3':0.2)'no__``!!:o de0':.98,'ta___x8':.3, tax4:.3)node1:.4", PhyloNode) bootstraps = {"no__``!!:o de0": .7, 'node1': .4} fd, f = mkstemp(prefix='make_bootstrapped_tree_test', suffix='.pdf') close(fd) self._paths_to_clean_up.append(f) write_pdf_bootstrap_tree(tree, f, bootstraps) assert (os.path.exists(f))