Permalink
Browse files

Cope with multipli-line KW entries in EMBL files

  • Loading branch information...
1 parent 680354c commit c36293fe27e02351691772566ad396c59defc496 @peterjc peterjc committed Mar 12, 2013
Showing with 11 additions and 3 deletions.
  1. +6 −1 Bio/GenBank/__init__.py
  2. +2 −1 Tests/EMBL/DD231055_edited.embl
  3. +3 −1 Tests/test_SeqIO_Insdc.py
View
@@ -769,7 +769,12 @@ def gi(self, content):
self.data.annotations['gi'] = content
def keywords(self, content):
- self.data.annotations['keywords'] = self._split_keywords(content)
+ if 'keywords' in self.data.annotations:
+ #Multi-line keywords, append to list
+ #Note EMBL states "A keyword is never split between lines."
+ self.data.annotations['keywords'].extend(self._split_keywords(content))
+ else:
+ self.data.annotations['keywords'] = self._split_keywords(content)
def segment(self, content):
self.data.annotations['segment'] = content
@@ -7,7 +7,8 @@ DT 31-AUG-2006 (Rel. 89, Last updated, Version 2)
XX
DE RSV PROTEINS, ANTIBODIES, COMPOSITIONS, METHODS AND USES.
XX
-KW JP 2005522996-A/12; test-data.
+KW JP 2005522996-A/12; test-data; lot and lots of keywords for this example;
+KW multi-line keywords.
XX
OS Homo sapiens (human)
OC Eukaryota; Metazoa; Chordata; Craniata; Vertebrata; Euteleostomi; Mammalia;
@@ -21,7 +21,9 @@ def test_annotation2(self):
self.assertEqual(len(record), 315)
#Multiple keywords:
self.assertEqual(record.annotations["keywords"],
- ['JP 2005522996-A/12', 'test-data'])
+ ['JP 2005522996-A/12', 'test-data',
+ 'lot and lots of keywords for this example',
+ 'multi-line keywords'])
if __name__ == "__main__":

0 comments on commit c36293f

Please sign in to comment.