def test_get_gained(self): vertical_map = MapVertical(self.ham_analysis) map = HOGsMap(self.ham_analysis, self.human, self.vertebrates) self.assertTrue(map.consistent) vertical_map.add_map(map) gain = vertical_map.get_gained() self.assertEqual({"Gene(2)", "Gene(5)"}, set(_str_array(gain)))
def test_get_duplicated(self): vertical_map = MapVertical(self.ham_analysis) map = HOGsMap(self.ham_analysis, self.mouse, self.vertebrates) self.assertTrue(map.consistent) vertical_map.add_map(map) duplicate = vertical_map.get_duplicated() self.assertDictEqual({'<HOG(3)>': {'Gene(33)', 'Gene(34)'}}, _str_dict_array_value(duplicate))
def test_get_single(self): vertical_map = MapVertical(self.ham_analysis) map = HOGsMap(self.ham_analysis, self.human, self.vertebrates) self.assertTrue(map.consistent) vertical_map.add_map(map) single = vertical_map.get_retained() self.assertDictEqual({'<HOG(1)>': 'Gene(1)'}, _str_dict_one_value(single))
def test_create_correctly_vertical_map(self): vertical_map = MapVertical(self.ham_analysis) map = HOGsMap(self.ham_analysis, self.human, self.euarchontoglires) self.assertTrue(map.consistent) vertical_map.add_map(map) self.assertEqual(self.euarchontoglires, vertical_map.ancestor) self.assertEqual(self.human, vertical_map.descendant) self.assertEqual(self.ham_analysis, vertical_map.HAM)
def test_get_lost(self): vertical_map = MapVertical(self.ham_analysis) map = HOGsMap(self.ham_analysis, self.human, self.euarchontoglires) self.assertTrue(map.consistent) vertical_map.add_map(map) loss = vertical_map.get_lost() self.assertEqual(set(["<HOG(3.E.2)>"]), _str_array(loss)) vertical_map2 = MapVertical(self.ham_analysis) map2 = HOGsMap(self.ham_analysis, self.rat, self.euarchontoglires) self.assertTrue(map2.consistent) vertical_map2.add_map(map2) loss2 = vertical_map2.get_lost() self.assertEqual({"<HOG(2.E)>", "<HOG(3.E.2)>", "<HOG(3.E.1)>"}, set(_str_array(loss2)))
def test_can_only_add_HOGMAP_as_map(self): vertical_map = MapVertical(self.ham_analysis) with self.assertRaises(TypeError): vertical_map.add_map("111") with self.assertRaises(TypeError): vertical_map.add_map("")
def test_cannot_add_more_than_one_map(self): vertical_map = MapVertical(self.ham_analysis) map = HOGsMap(self.ham_analysis, self.human, self.euarchontoglires) self.assertTrue(map.consistent) vertical_map.add_map(map) map2 = HOGsMap(self.ham_analysis, self.human, self.vertebrates) self.assertTrue(map2.consistent) with self.assertRaises(TypeError): vertical_map.add_map(map2)
def test_can_only_create_vertical_map_with_ham_object(self): with self.assertRaises(TypeError): MapVertical()