示例#1
0
 def test_parse_dnd(self):
     """parse_dnd returns a dict with dnd indexed by tree name"""
     tree_info = get_tree_info(Nexus_tree)
     header, trans_table, dnd = split_tree_info(tree_info)
     dnd_dict = parse_dnd(dnd)
     self.assertEqual(dnd_dict['tree PAUP_1'],\
      "(1,(2,(((3,4),(5,(((((6,10),9),(11,18)),((((7,15),19),17),(8,(12,(14,16))))),13))),20)),21);")  
示例#2
0
 def test_parse_dnd(self):
     """parse_dnd returns a dict with dnd indexed by tree name"""
     tree_info = get_tree_info(Nexus_tree)
     header, trans_table, dnd = split_tree_info(tree_info)
     dnd_dict = parse_dnd(dnd)
     self.assertEqual(dnd_dict['tree PAUP_1'],\
      "(1,(2,(((3,4),(5,(((((6,10),9),(11,18)),((((7,15),19),17),(8,(12,(14,16))))),13))),20)),21);")  
示例#3
0
 def test_get_tree_info(self):
     """get_tree_info returns the Nexus file section that describes the tree"""
     result = get_tree_info(Nexus_tree)
     self.assertEqual(len(result), 33)
     self.assertEqual(result[0],\
         "Begin trees;  [Treefile saved Wednesday, May 5, 2004  5:02 PM]")
     self.assertEqual(result[31], \
         "tree PAUP_1 = [&R] (1,(2,(((3,4),(5,(((((6,10),9),(11,18)),((((7,15),19),17),(8,(12,(14,16))))),13))),20)),21);")
示例#4
0
 def test_get_tree_info(self):
     """get_tree_info returns the Nexus file section that describes the tree"""
     result = get_tree_info(Nexus_tree)
     self.assertEqual(len(result), 33)
     self.assertEqual(result[0],\
         "Begin trees;  [Treefile saved Wednesday, May 5, 2004  5:02 PM]")
     self.assertEqual(result[31], \
         "tree PAUP_1 = [&R] (1,(2,(((3,4),(5,(((((6,10),9),(11,18)),((((7,15),19),17),(8,(12,(14,16))))),13))),20)),21);")
示例#5
0
    def test_parse_trans_table(self):
        """parse_trans_table returns a dict with the taxa names indexed by number"""
        tree_info = get_tree_info(Nexus_tree)
        header, trans_table, dnd = split_tree_info(tree_info)
        Trans_table = parse_trans_table(trans_table)

        self.assertEqual(len(Trans_table), 21)

        #check that taxa are returned in the Trans_table
        self.assertEqual(Trans_table['1'], 'outgroup25')
        self.assertEqual(Trans_table['2'], 'AF078391l')
        self.assertEqual(Trans_table['3'], 'AF078211af')
        self.assertEqual(Trans_table['4'], 'AF078393l')
        self.assertEqual(Trans_table['5'], 'AF078187af')
        self.assertEqual(Trans_table['6'], 'AF078320l')
        self.assertEqual(Trans_table['21'], 'outgroup258')
        self.assertEqual(Trans_table['20'], 'AF078179af')
        self.assertEqual(Trans_table['19'], 'AF078251af')
示例#6
0
    def test_parse_trans_table(self):
        """parse_trans_table returns a dict with the taxa names indexed by number"""
        tree_info = get_tree_info(Nexus_tree)
        header, trans_table, dnd = split_tree_info(tree_info)
        Trans_table = parse_trans_table(trans_table)

        self.assertEqual(len(Trans_table), 21)

        #check that taxa are returned in the Trans_table
        self.assertEqual(Trans_table['1'], 'outgroup25')
        self.assertEqual(Trans_table['2'], 'AF078391l')
        self.assertEqual(Trans_table['3'], 'AF078211af')
        self.assertEqual(Trans_table['4'], 'AF078393l')
        self.assertEqual(Trans_table['5'], 'AF078187af')
        self.assertEqual(Trans_table['6'], 'AF078320l')
        self.assertEqual(Trans_table['21'], 'outgroup258')
        self.assertEqual(Trans_table['20'], 'AF078179af')
        self.assertEqual(Trans_table['19'], 'AF078251af')
示例#7
0
    def test_split_tree_info(self):
        """split_tree_info splits lines into header, Trans_table, and dnd"""
        tree_info = get_tree_info(Nexus_tree)
        header, trans_table, dnd = split_tree_info(tree_info)

        self.assertEqual(len(header), 9)

        self.assertEqual(len(trans_table), 22)

        self.assertEqual(len(dnd), 2)

        self.assertEqual(header[0],\
            "Begin trees;  [Treefile saved Wednesday, May 5, 2004  5:02 PM]")
        self.assertEqual(header[8], "\tTranslate")

        self.assertEqual(trans_table[0], "\t\t1 outgroup25,")
        self.assertEqual(trans_table[21], "\t\t;")

        self.assertEqual(dnd[0], \
            "tree PAUP_1 = [&R] (1,(2,(((3,4),(5,(((((6,10),9),(11,18)),((((7,15),19),17),(8,(12,(14,16))))),13))),20)),21);")
示例#8
0
    def test_split_tree_info(self):
        """split_tree_info splits lines into header, Trans_table, and dnd"""
        tree_info = get_tree_info(Nexus_tree)
        header, trans_table, dnd = split_tree_info(tree_info)

        self.assertEqual(len(header), 9)

        self.assertEqual(len(trans_table), 22)

        self.assertEqual(len(dnd), 2)

        self.assertEqual(header[0],\
            "Begin trees;  [Treefile saved Wednesday, May 5, 2004  5:02 PM]")
        self.assertEqual(header[8], "\tTranslate")

        self.assertEqual(trans_table[0], "\t\t1 outgroup25,")
        self.assertEqual(trans_table[21], "\t\t;")

        self.assertEqual(dnd[0], \
            "tree PAUP_1 = [&R] (1,(2,(((3,4),(5,(((((6,10),9),(11,18)),((((7,15),19),17),(8,(12,(14,16))))),13))),20)),21);")