[BioPython] Different parse error in ace.py

Frank Kauff fkauff at duke.edu
Mon Apr 19 09:05:47 EDT 2004


Hi Leighton,

On Mon, 2004-04-19 at 08:34, Leighton Pritchard wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi all,
> 
> The Ace.py parser assumes that the DS tag will always be present in
> Phrap output.  Unfortunately, it isn't always present in my output, and
> so the parser gave me this traceback:
> 

Thanks for pointing this out. Ace parsing is learning by doing -
unfortunately there's no proper description of which tags appear when
and where... I indeed assumed that there's always a DS. I'll update the
code, so far your workaround seems to the right thing to do.

Frank

> uncaught: (<class exceptions.SyntaxError at 0xbf51b74c>,
> <exceptions.SyntaxError instance at 0xbf03f4cc>)
> Traceback (most recent call last):
> ~  File
> "/usr/local/lib/python2.3/site-packages/ScriptFramework/script.py", line
> 241, in main
> ~    self.run()
> ~  File "/home/lpritc/Data/scripts/draw_ace.py", line 71, in run
> ~    self.ace_file_record = self.load_record()       # Load ACE file
> ~  File "/home/lpritc/Data/scripts/draw_ace.py", line 97, in load_record
> ~    ace_file_record = parser.parse(self.input)
> ~  File "/usr/local/lib/python2.3/site-packages/Bio/Sequencing/Ace.py",
> line 295, in parse
> ~    rec=iter.next()
> ~  File "/usr/local/lib/python2.3/site-packages/Bio/Sequencing/Ace.py",
> line 218, in next
> ~    return self._parser.parse(File.StringHandle(data))
> ~  File "/usr/local/lib/python2.3/site-packages/Bio/Sequencing/Ace.py",
> line 234, in parse
> ~    self._scanner.feed(uhandle, self._consumer)
> ~  File "/usr/local/lib/python2.3/site-packages/Bio/Sequencing/Ace.py",
> line 331, in feed
> ~    self._scan_record(handle, consumer)
> ~  File "/usr/local/lib/python2.3/site-packages/Bio/Sequencing/Ace.py",
> line 352, in _scan_record
> ~    read_and_call(uhandle,consumer.ds,start='DS ')
> ~  File "/usr/local/lib/python2.3/site-packages/Bio/ParserSupport.py",
> line 300, in read_and_call
> ~    raise SyntaxError, errmsg
> SyntaxError: Line does not start with 'DS ':
> RT{
> 
> I've fixed it locally by changing line 352 in Ace.py to
> 
> ###
> 
> if attempt_read_and_call(uhandle,consumer.ds,start='DS '):
> ~                read_and_call(uhandle,consumer.ds,start='DS ')
> 
> ###
> 
> so as to take the possible absence of a DS tag into account, though you
> may want to do something more elegant with the real code ;)
> 
> - --
> Dr Leighton Pritchard AMRSC
> D104, PPI, Scottish Crop Research Institute
> Invergowrie, Dundee, DD2 5DA, Scotland, UK
> E: lpritc at scri.sari.ac.uk	W: http://bioinf.scri.sari.ac.uk/index.shtml
> T: +44 (0)1382 568579		F: +44 (0)1382 568578
> PGP key FEFC205C: GPG key E58BA41B: http://www.keyserver.net
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
> 
> iD8DBQFAg8dvL1gZ+OWLpBsRAllhAJ4kgHrygUcTVozoyKH2XlLTBE+07ACfRWZ1
> 5T0Ztu63f1flGaxHJSs0QZA=
> =zTh4
> -----END PGP SIGNATURE-----
> 
> _______________________________________________
> BioPython mailing list  -  BioPython at biopython.org
> http://biopython.org/mailman/listinfo/biopython
-- 
Frank Kauff
Dept. of Biology
Duke University
Box 90338
Durham, NC 27708
USA

Phone 919-660-7382
Fax 919-660-7293



More information about the BioPython mailing list