Skip to content

Commit

Permalink
fixes phlyotree failing due to randomly picking node names
Browse files Browse the repository at this point in the history
  • Loading branch information
jhcepas committed Apr 24, 2017
1 parent 22d5905 commit 406906a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ete3/test/test_phylotree.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,13 @@ def test_miscelaneus(self):
self.assertEqual(set([sp for sp in t.iter_species()]), set(sp2age.keys()))

def test_colappse(self):
t = PhyloTree('((Dme_001:1,Dme_002:1)1:1,(((Cfa_001:1,Mms_001:1)1:1,((((Hsa_001:1,Hsa_003:1)1:1,Ptr_001:1)1:1,Mmu_001:1)1:1,((Hsa_004:1,Ptr_004:1)1:1,Mmu_004:1)1:1)1:1)1:1,(Ptr_002:1,(Hsa_002:1,Mmu_002:1)1:1)1:1)1:1);')
collapsed_hsa = '((Dme_001:1,Dme_002:1)1:1,(((Cfa_001:1,Mms_001:1)1:1,(((Ptr_001:1,Hsa_003:1)1:1,Mmu_001:1)1:1,((Hsa_004:1,Ptr_004:1)1:1,Mmu_004:1)1:1)1:1)1:1,(Ptr_002:1,(Hsa_002:1,Mmu_002:1)1:1)1:1)1:1);'
t = PhyloTree('((Dme_001,Dme_002),(((Cfa_001,Mms_001),((((Hsa_001,Hsa_001),Ptr_001),Mmu_001),((Hsa_004,Ptr_004),Mmu_004))),(Ptr_002,(Hsa_002,Mmu_002))));')
collapsed_hsa = '((Dme_001:1,Dme_002:1)1:1,(((Cfa_001:1,Mms_001:1)1:1,(((Ptr_001:1,Hsa_001:1)1:1,Mmu_001:1)1:1,((Hsa_004:1,Ptr_004:1)1:1,Mmu_004:1)1:1)1:1)1:1,(Ptr_002:1,(Hsa_002:1,Mmu_002:1)1:1)1:1)1:1);'
t2 = t.collapse_lineage_specific_expansions(['Hsa'])
self.assertEqual(collapsed_hsa, t2.write())
self.assertEqual(str(collapsed_hsa), str(t2.write()))
with self.assertRaises(TypeError):
print(t.collapse_lineage_specific_expansions('Hsa'))


if __name__ == '__main__':
unittest.main()

0 comments on commit 406906a

Please sign in to comment.