예제 #1
0
 def test_read_file(self):
     to = {
         'FBgn0026615':
         GeneAnnotation(
             'FBgn0026615', [
                 TermAssociation(
                     'GO:0005737', {
                         GAF20FIELDS[3]: [],
                         GAF20FIELDS[5]: ['FB:FBrf0106275'],
                         GAF20FIELDS[6]: 'IDA',
                         GAF20FIELDS[7]: [],
                         GAF20FIELDS[8]: 'C',
                         GAF20FIELDS[13]: '20060803',
                         GAF20FIELDS[14]: 'FlyBase'
                     }),
                 TermAssociation(
                     'GO:0045177', {
                         GAF20FIELDS[3]: [],
                         GAF20FIELDS[5]: ['FB:FBrf0106275'],
                         GAF20FIELDS[6]: 'IDA',
                         GAF20FIELDS[7]: [],
                         GAF20FIELDS[8]: 'C',
                         GAF20FIELDS[13]: '20060803',
                         GAF20FIELDS[14]: 'FlyBase'
                     })
             ], {
                 GAF20FIELDS[0]: 'FB',
                 GAF20FIELDS[2]: '10-4',
                 GAF20FIELDS[9]: '10-4',
                 GAF20FIELDS[10]: [],
                 GAF20FIELDS[11]: 'gene_product',
                 GAF20FIELDS[12]: ['taxon:7227'],
                 GAF20FIELDS[15]: [],
                 GAF20FIELDS[16]: ''
             }),
         'FBgn0043467':
         GeneAnnotation(
             'FBgn0043467', [
                 TermAssociation(
                     'GO:0048149', {
                         GAF20FIELDS[3]: [],
                         GAF20FIELDS[5]:
                         ['FB:FBrf0131396', 'PMID:11086999'],
                         GAF20FIELDS[6]: 'IMP',
                         GAF20FIELDS[7]: [],
                         GAF20FIELDS[8]: 'P',
                         GAF20FIELDS[13]: '20060803',
                         GAF20FIELDS[14]: 'FlyBase'
                     })
             ], {
                 GAF20FIELDS[0]: 'FB',
                 GAF20FIELDS[2]: '064Ya',
                 GAF20FIELDS[9]: '064Ya',
                 GAF20FIELDS[10]: [],
                 GAF20FIELDS[11]: 'gene_product',
                 GAF20FIELDS[12]: ['taxon:7227'],
                 GAF20FIELDS[15]: [],
                 GAF20FIELDS[16]: ''
             })
     }
     with open('Ontology/GoaIO/correct20.fb', 'r') as f:
         objs = GafReader(f).read()
         self.assertEqual(to, objs)
예제 #2
0
 def test_incorrect_line_len(self):
     with open('Ontology/GoaIO/bad_line.fb', 'r') as f:
         it = GafReader(f)
         with self.assertRaises(ValueError):
             it.read()
예제 #3
0
 def test_incorrect_line_len(self):
     with open("Ontology/GoaIO/bad_line.fb", "r") as f:
         it = GafReader(f)
         with self.assertRaises(ValueError):
             it.read()
예제 #4
0
 def test_no_version(self):
     with open('Ontology/GoaIO/no_ver.fb', 'r') as f:
         it = GafReader(f, assoc_format="in_mem_sql")
         with self.assertRaises(ValueError):
             it.read()
예제 #5
0
 def test_no_version(self):
     with open("Ontology/GoaIO/no_ver.fb", "r") as f:
         it = GafReader(f, assoc_format="in_mem_sql")
         with self.assertRaises(ValueError):
             it.read()