[Biopython-dev] Consumer of "KW" in embl format

Peter Cock p.j.a.cock at googlemail.com
Tue Mar 12 15:13:23 UTC 2013


On Tue, Mar 12, 2013 at 2:40 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> On Tue, Mar 12, 2013 at 11:35 AM, Xabier Bello <xbello at gmail.com> wrote:
>> Lets try it:
>>
>> Line 997:
>> def _write_keywords(self, record):
>>     #Put the keywords right after DE line.
>>     self._write_multi_line("KW", "%s." % "; ".join(
>>         record.annotations["keywords"]))
>>     self.handle.write("XX\n")
>
> Looks good - although there is a potential problem here with long keywords
> where this does not avoid splitting a single keyword over multiple KW lines
> (as specified in the EMBL specification). This is a corner case though...

OK, not such a rare case:

$ python test_SeqIO_features.py
...
======================================================================
ERROR: test_cor6 (__main__.TestWriteRead)
Write and read back cor6_6.gb
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_SeqIO_features.py", line 1105, in test_cor6
    write_read(os.path.join("GenBank", "cor6_6.gb"), "gb")
  File "test_SeqIO_features.py", line 35, in write_read
    compare_records(gb_records, gb_records2)
  File "test_SeqIO_features.py", line 110, in compare_records
    if not compare_record(old,new,expect_minor_diffs):
  File "test_SeqIO_features.py", line 101, in compare_record
    % (key, old.annotations[key], new.annotations[key]))
ValueError: Annotation mis-match for keywords:
['antifreeze protein homology', 'cold-regulated gene', 'cor6.6 gene',
'KIN1 homology']
['antifreeze protein homology', 'cold-regulated gene', 'cor6.6 gene',
'KIN1', 'homology']

----------------------------------------------------------------------

I'll fix this later today...

Peter



More information about the Biopython-dev mailing list