def test_marking_trees(self): TREE_PATH = ETEPATH + '/examples/evol/data/S_example/' tree = EvolTree (TREE_PATH + 'measuring_S_tree.nw') self.assertEqual(tree.write(), '((Hylobates_lar,(Gorilla_gorilla,Pan_troglodytes)),Papio_cynocephalus);') tree.mark_tree ([1, 3, 7] + [2, 6], marks=['#1']*3 + ['#2']*2, verbose=True) self.assertEqual(tree.write().replace(' ', ''), '((Hylobates_lar#2,(Gorilla_gorilla#1,Pan_troglodytes#1)#1)#2,Papio_cynocephalus);') tree.mark_tree (map (lambda x: x.node_id, tree.get_descendants()), marks=[''] * len (tree.get_descendants()), verbose=False) self.assertEqual(tree.write().replace(' ', ''), '((Hylobates_lar,(Gorilla_gorilla,Pan_troglodytes)),Papio_cynocephalus);')
def test_marking_trees(self): TREE_PATH = 'examples/evol/data/S_example/' tree = EvolTree (TREE_PATH + 'measuring_S_tree.nw') self.assertEqual(tree.write(), '((Hylobates_lar,(Gorilla_gorilla,Pan_troglodytes)),Papio_cynocephalus);') tree.mark_tree ([1, 3, 7] + [2, 6], marks=['#1']*3 + ['#2']*2, verbose=True) self.assertEqual(tree.write().replace(' ', ''), '((Hylobates_lar#2,(Gorilla_gorilla#1,Pan_troglodytes#1)#1)#2,Papio_cynocephalus);') tree.mark_tree (map (lambda x: x.node_id, tree.get_descendants()), marks=[''] * len (tree.get_descendants()), verbose=False) self.assertEqual(tree.write().replace(' ', ''), '((Hylobates_lar,(Gorilla_gorilla,Pan_troglodytes)),Papio_cynocephalus);')
def test_run_codeml(self): if which('codeml'): tree = EvolTree('((seq1,seq2),seq3);') tree.link_to_alignment('>seq1\nATGCTG\n>seq2\nATGCTG\n>seq3\nTTGATG\n') tree.run_model('fb') self.assert_('CODONML' in tree.get_evol_model('fb').run) self.assert_('Time used:' in tree.get_evol_model('fb').run) self.assert_('end of tree file' in tree.get_evol_model('fb').run) self.assert_('lnL' in tree.get_evol_model('fb').run) self.assert_(tree.get_descendants()[0].w > 0)