def test_collapse_dogma_1(self): graph = BELGraph() graph.add_simple_node(*p1) graph.add_simple_node(*r1) graph.add_edge(r1, p1, key=unqualified_edge_code[TRANSLATED_TO], **{RELATION: TRANSLATED_TO}) self.assertEqual(2, graph.number_of_nodes()) self.assertEqual(1, graph.number_of_edges()) collapse_by_central_dogma(graph) self.assertEqual(1, graph.number_of_nodes()) self.assertEqual(0, graph.number_of_edges())
def test_infer_1(self): graph = BELGraph() graph.add_simple_node(*p1) graph.add_simple_node(*g1) graph.add_simple_node(*p2) graph.add_simple_node(*g3) graph.add_simple_node(*m4) graph.add_edge(p1, p2, **{RELATION: INCREASES}) graph.add_edge(g1, g3, **{RELATION: POSITIVE_CORRELATION}) self.assertEqual(5, graph.number_of_nodes()) self.assertEqual(2, graph.number_of_edges()) infer_central_dogmatic_translations(graph) self.assertEqual(7, graph.number_of_nodes()) self.assertEqual(4, graph.number_of_edges()) self.assertIn(r1, graph) self.assertIn(r2, graph) infer_central_dogmatic_transcriptions(graph) self.assertEqual(9, graph.number_of_nodes()) self.assertEqual(7, graph.number_of_edges()) self.assertIn(g1, graph) self.assertIn(g2, graph) self.assertIn(g3, graph) self.assertIn(g4, graph) collapse_by_central_dogma(graph) self.assertEqual(4, graph.number_of_nodes()) self.assertEqual(2, graph.number_of_edges()) self.assertTrue(graph.has_edge(p1, g3)) self.assertTrue(graph.has_edge(p1, p2))