예제 #1
0
 def testCountCladesEmptyTree(self):
     """
     In a tree with no children, there are no clades.
     """
     njtree = NJTree()
     njtree.tree = TreeNode()
     self.assertEqual(Counter(), njtree.countClades())
예제 #2
0
 def testCountCladesOneChild(self):
     """
     In a tree with one child, there is one clade.
     """
     njtree = NJTree()
     njtree.tree = TreeNode(children=[
         TreeNode(name='a'),
     ])
     self.assertEqual(
         {
             frozenset(['a']): 1,
         },
         njtree.countClades()
     )
예제 #3
0
 def testCountCladesTwoChildren(self):
     """
     In a tree with two children, one of which has two children, there are
     two clades.
     """
     njtree = NJTree()
     njtree.tree = TreeNode(children=[
         TreeNode(children=[
             TreeNode(name='a'),
             TreeNode(name='b'),
         ]),
         TreeNode(name='c'),
     ])
     self.assertEqual(
         {
             frozenset(['a', 'b']): 1,
             frozenset(['a', 'b', 'c']): 1,
         },
         njtree.countClades()
     )