Пример #1
0
 def test_to_networkx(self):
     g = terms_to_graph(self.terms_diam)
     na = g.to_networkx({"GO:0050896" : ["X1", "X2"]})
     self.assertEqual(["GO:0030534", "GO:0045471"], na.successors("GO:0048149"))
     self.assertEqual(["GO:0050896"], na.successors("GO:0030534"))
     self.assertEqual(["GO:0050896"], na.successors("GO:0045471"))
     self.assertEqual(["X1", "X2"], na.node["GO:0050896"]["annotated_genes"])
Пример #2
0
 def test_get_parents_cycle(self):
     g = terms_to_graph(self.terms_cycle)
     self.assertEqual(set(['GO:0030534', 'GO:0050896', 'GO:0005374',
                           'GO:0048149', 'GO:0045471']),
                      g.get_ancestors("GO:0048149"))
     
     self.assertEqual([['GO:0048149', 'GO:0005374']], g.cycles)
Пример #3
0
 def test_get_parents_cycle(self):
     g = terms_to_graph(self.terms_cycle)
     self.assertEqual(set(['GO:0030534', 'GO:0050896', 'GO:0005374',
                           'GO:0048149', 'GO:0045471']),
                      g.get_ancestors("GO:0048149"))
     
     self.assertEqual([['GO:0048149', 'GO:0005374']], g.cycles)
Пример #4
0
 def test_to_networkx(self):
     g = terms_to_graph(self.terms_diam)
     na = g.to_networkx({"GO:0050896": ["X1", "X2"]})
     self.assertEqual(["GO:0030534", "GO:0045471"],
                      na.successors("GO:0048149"))
     self.assertEqual(["GO:0050896"], na.successors("GO:0030534"))
     self.assertEqual(["GO:0050896"], na.successors("GO:0045471"))
     self.assertEqual(["X1", "X2"],
                      na.node["GO:0050896"]["annotated_genes"])
Пример #5
0
 def test_to_networkx(self):
     try:
         import networkx as nx
     except ImportError:
         print("Skipping test. To use this functionality you need to have networkx installed.", file=sys.stderr)
     else:
         g = terms_to_graph(self.terms_diam)
         na = g.to_networkx({"GO:0050896" : ["X1", "X2"]})
         self.assertEqual(["GO:0030534", "GO:0045471"], na.successors("GO:0048149"))
         self.assertEqual(["GO:0050896"], na.successors("GO:0030534"))
         self.assertEqual(["GO:0050896"], na.successors("GO:0045471"))
         self.assertEqual(["X1", "X2"], na.node["GO:0050896"]["annotated_genes"])
Пример #6
0
 def test_no_typedef(self):
     with self.assertRaises(ValueError):
         terms_to_graph(self.terms_cycle_no)
Пример #7
0
 def test_bad_rel(self):
     with self.assertRaises(ValueError):
         terms_to_graph(self.terms_bad_rel)
Пример #8
0
 def test_get_ancestors(self):
     g = terms_to_graph(self.terms_diam)
     self.assertEqual(set(["GO:0030534", "GO:0045471", "GO:0050896"]),
                      g.get_ancestors("GO:0048149"))
     
     self.assertEqual(set(["GO:0050896"]), g.get_ancestors("GO:0030534"))
Пример #9
0
 def test_get_term(self):
     g = terms_to_graph(self.terms_diam)
     self.assertEqual("GO:0045471", g.get_term("GO:0045471").id)
Пример #10
0
 def test_no_typedef(self):
     with self.assertRaises(ValueError):
         terms_to_graph(self.terms_cycle_no)
Пример #11
0
 def test_bad_rel(self):
     with self.assertRaises(ValueError):
         terms_to_graph(self.terms_bad_rel)
Пример #12
0
 def test_get_ancestors(self):
     g = terms_to_graph(self.terms_diam)
     self.assertEqual(set(["GO:0030534", "GO:0045471", "GO:0050896"]),
                      g.get_ancestors("GO:0048149"))
     
     self.assertEqual(set(["GO:0050896"]), g.get_ancestors("GO:0030534"))
Пример #13
0
 def test_get_term(self):
     g = terms_to_graph(self.terms_diam)
     self.assertEqual("GO:0045471", g.get_term("GO:0045471").id)