Permalink
Browse files

More EMBL testing, identified some more issues to look at...

  • Loading branch information...
1 parent 41470ea commit 07639dde32083f4f024616292a5c736e85770a4e @peterjc peterjc committed Mar 12, 2013
Showing with 31 additions and 0 deletions.
  1. +31 −0 Tests/test_SeqIO_Insdc.py
View
@@ -4,9 +4,12 @@
# as part of this package.
import unittest
+from StringIO import StringIO
from Bio import SeqIO
+from seq_tests_common import compare_record
+
class TestEmbl(unittest.TestCase):
def test_annotation1(self):
"""Check parsing of annotation from EMBL files (1)."""
@@ -25,6 +28,34 @@ def test_annotation2(self):
'lot and lots of keywords for this example',
'multi-line keywords'])
+class TestEmblRewrite(unittest.TestCase):
+ def check_rewrite(self, filename):
+ old = SeqIO.read(filename, "embl")
+
+ #TODO - Check these properties:
+ old.dbxrefs = []
+ old.annotations['accessions'] = old.annotations['accessions'][:1]
+ del old.annotations['references']
+
+ buffer = StringIO()
+ self.assertEqual(1, SeqIO.write(old, buffer, "embl"))
+ buffer.seek(0)
+ new = SeqIO.read(buffer, "embl")
+
+ self.assertTrue(compare_record(old, new))
+
+ def test_annotation1(self):
+ """Check writing-and-parsing EMBL file (1)."""
+ self.check_rewrite("EMBL/TRBG361.embl")
+
+ def test_annotation2(self):
+ """Check writing-and-parsing EMBL file (2)."""
+ self.check_rewrite("EMBL/DD231055_edited.embl")
+
+ def test_annotation3(self):
+ """Check writing-and-parsing EMBL file (3)."""
+ self.check_rewrite("EMBL/AE017046.embl")
+
if __name__ == "__main__":
runner = unittest.TextTestRunner(verbosity=2)

0 comments on commit 07639dd

Please sign in to comment.