Exemple #1
0
 def test_scores(self):
     """ Test the scores function. """
     obio = OboIO()
     terms = obio.get_graph(GOFILE2)
     gsgo = GsesameGO(terms)
     output = 0.8259052924791086
     self.assertEqual(output, gsgo.scores('0043229','0043231'))
Exemple #2
0
 def test_scores_article(self):
     """ Test the scores function. """
     obio = OboIO()
     terms = obio.get_graph(GOFILE)
     gsgo = GsesameGO(terms)
     output = 0.7727272727272726
     self.assertEqual(output, gsgo.scores('0043229','0043231'))
Exemple #3
0
 def test_semantic_value(self):
     """ Test the semantic_value function. """
     obio = OboIO()
     terms = obio.get_graph(GOFILE2)
     gsgo = GsesameGO(terms)
     output = 4.7440000000000015
     self.assertEqual(output, gsgo.semantic_value('0043229'))
     output = 5.5952
     self.assertEqual(output, gsgo.semantic_value('0043231'))
Exemple #4
0
 def test_semantic_value_article(self):
     """ Test the semantic_value function. """
     obio = OboIO()
     terms = obio.get_graph(GOFILE)
     gsgo = GsesameGO(terms)
     output = 3.4000000000000004
     self.assertEqual(output, gsgo.semantic_value('0043229'))
     output = 4.520000000000001
     self.assertEqual(output, gsgo.semantic_value('0043231'))
Exemple #5
0
 def test_scores(self):
     """ Test the scores function. """
     obio = OboIO()
     terms = obio.get_graph(GOFILE2)
     sesamegene = GsesameGene(terms)
     gene1 = ['0043229', '0044424']
     gene2 = ['0043231', '0043227']
     output = 0.6743128041470686
     self.assertEqual(output, sesamegene.scores(gene1, gene2))
Exemple #6
0
 def test_scores(self):
     """ Test the scores function. """
     obio = OboIO()
     terms = obio.get_graph(GOFILE)
     gdc = GoDistanceCounter(terms)
     self.assertEqual((5, 5), gdc.scores('11', '0'))
     self.assertEqual((4, 4), gdc.scores('11', '1'))
     self.assertEqual((6, 0), gdc.scores('9', '5'))
     self.assertEqual((5, 1), gdc.scores('7', '5'))
     self.assertEqual((6, 0), gdc.scores('8', '5'))
Exemple #7
0
 def test_scores(self):
     """ Test the scores function. """
     obio = OboIO()
     terms = obio.get_graph(GOFILE)
     gdc = GoDistanceCounter(terms)
     self.assertEqual((5, 5), gdc.scores('11', '0'))
     self.assertEqual((4, 4), gdc.scores('11', '1'))
     self.assertEqual((6, 0), gdc.scores('9', '5'))
     self.assertEqual((5, 1), gdc.scores('7', '5'))
     self.assertEqual((6, 0), gdc.scores('8', '5'))
Exemple #8
0
 def test_alt_id(self):
     """ Test that a GO term with an alt_id is added to the list. """
     obio = OboIO()
     terms = obio.get_graph(GOFILE)
     gdc = GoDistanceCounter(terms)
     term = terms['12']
     self.assertEqual('7', term['id'])
     term = terms['13']
     self.assertEqual('8', term['id'])
     gdc = GoDistanceCounter(terms)
     self.assertEqual((5, 1), gdc.scores('12', '5'))
     self.assertEqual((6, 0), gdc.scores('13', '5'))
Exemple #9
0
 def test_alt_id(self):
     """ Test that a GO term with an alt_id is added to the list. """
     obio = OboIO()
     terms = obio.get_graph(GOFILE)
     gdc = GoDistanceCounter(terms)
     term = terms['12']
     self.assertEqual('7', term['id'])
     term = terms['13']
     self.assertEqual('8', term['id'])
     gdc = GoDistanceCounter(terms)
     self.assertEqual((5, 1), gdc.scores('12', '5'))
     self.assertEqual((6, 0), gdc.scores('13', '5'))
Exemple #10
0
 def test_get_path(self):
     """ Test the get_path function. """
     obio = OboIO()
     terms = obio.get_graph(GOFILE)
     golib = PyGoLib(terms)
     term = terms['4']
     print term['id']
     output = ['4,2,1,0']
     self.assertEqual(output, 
         golib.get_path(term, pred=term['id'], paths=[], verbose=True))
     self.assertEqual(output, 
         golib.get_path(term, pred=term['id'], paths=[]))
     output = ['2,1,0']
     self.assertEqual(output, 
             golib.get_path(term, paths=[]))
Exemple #11
0
 def test_get_path(self):
     """ Test the get_path function. """
     obio = OboIO()
     terms = obio.get_graph(GOFILE)
     golib = PyGoLib(terms)
     term = terms['4']
     print term['id']
     output = ['4,2,1,0']
     self.assertEqual(
         output,
         golib.get_path(term, pred=term['id'], paths=[], verbose=True))
     self.assertEqual(output, golib.get_path(term,
                                             pred=term['id'],
                                             paths=[]))
     output = ['2,1,0']
     self.assertEqual(output, golib.get_path(term, paths=[]))
Exemple #12
0
 def test_get_go_terms(self):
     """ Test the get_go_terms function. """
     obio = OboIO()
     terms = obio.get_graph(GOFILE)
Exemple #13
0
 def test_get_go_terms(self):
     """ Test the get_go_terms function. """
     obio = OboIO()
     terms = obio.get_graph(GOFILE)