def testHeightTable(self): """Make sure the height-table is calculated correctly.""" og = GreedyOutgroup() og.importTree(self.borMcTree) htable = og.heightTable() self.assertEquals(htable[self.borMcTree.getNodeId('HUMAN')], 0) self.assertEquals(htable[self.borMcTree.getNodeId('PIG')], 0) self.assertEquals(htable[self.borMcTree.getNodeId('RAT')], 0) self.assertEquals(htable[self.borMcTree.getNodeId('Anc7')], 1) self.assertEquals(htable[self.borMcTree.getNodeId('Anc1')], 2) self.assertEquals(htable[self.borMcTree.getNodeId('Anc0')], 4)
def testHeightTable(self): """Make sure the height-table is calculated correctly.""" og = GreedyOutgroup() og.importTree(self.borMcTree) htable = og.heightTable() self.assertEquals(htable[self.borMcTree.getNodeId('HUMAN')], 0) self.assertEquals(htable[self.borMcTree.getNodeId('PIG')], 0) self.assertEquals(htable[self.borMcTree.getNodeId('RAT')], 0) self.assertEquals(htable[self.borMcTree.getNodeId('Anc7')], 1) self.assertEquals(htable[self.borMcTree.getNodeId('Anc1')], 2) self.assertEquals(htable[self.borMcTree.getNodeId('Anc0')], 4)
def testZeroThreshold(self): """A threshold of 0 should produce outgroup sets that cause no additional depth in the resulting schedule.""" tree = self.backboneTree og = GreedyOutgroup() og.importTree(tree) og.greedy(candidateSet=set(['Homo_sapiens', 'Mus_musculus']),threshold=0, maxNumOutgroups=3, candidateChildFrac=0.75) og.greedy(threshold=0, maxNumOutgroups=3, candidateChildFrac=0.75) htable = og.heightTable() for node, outgroups in og.ogMap.items(): for outgroup, _ in outgroups: # For the outgroup assignment to create no # additional dependencies, each outgroup must have # a height lower than the node it's outgroup to # (or be a leaf) self.assertTrue(htable[tree.getNodeId(outgroup)] < htable[tree.getNodeId(node)] \ or htable[tree.getNodeId(outgroup)] == 0)
def testZeroThreshold(self): """A threshold of 0 should produce outgroup sets that cause no additional depth in the resulting schedule.""" tree = self.backboneTree og = GreedyOutgroup() og.importTree(tree) og.greedy(candidateSet=set(['Homo_sapiens', 'Mus_musculus']), threshold=0, maxNumOutgroups=3, candidateChildFrac=0.75) og.greedy(threshold=0, maxNumOutgroups=3, candidateChildFrac=0.75) htable = og.heightTable() for node, outgroups in og.ogMap.items(): for outgroup, _ in outgroups: # For the outgroup assignment to create no # additional dependencies, each outgroup must have # a height lower than the node it's outgroup to # (or be a leaf) self.assertTrue(htable[tree.getNodeId(outgroup)] < htable[tree.getNodeId(node)] \ or htable[tree.getNodeId(outgroup)] == 0)