[BioPython] Biopython GenBank

JINLING HUANG jinling@cs.uga.edu
Wed, 20 Nov 2002 09:41:43 -0500 (EST)


Hi, Jeff,

Thank you for your suggestions.  I just checked the GenBank Records which
encountered problems. It has an '/isolation_source' under the 'FEATURES'
part.  I just went to the biopython source code and added
'isolation_source' into the genbank_format.py.  It is working fine now.

Thanks again for your help and best wishes,

Jinling



On Tue, 19 Nov 2002, Jeffrey Chang wrote:

> This means that there is something in the GenBank record you are
> trying to parse that the parser does not handle.  Are you using
> Biopython 1.00a4 or the files from CVS?  The formats change faster
> than we make biopython distributions, so you should try getting the
> appropriate GenBank files from CVS and see if that fixes your problem.
>
> Jeff
>
>
>
>
> On Tue, Nov 19, 2002 at 09:25:25AM -0500, JINLING HUANG wrote:
> > Hello,
> >
> > I am writing a script to parse GenBank records using biopython.
> > Essentially I just copied the script from the biopython tutorial as
> > follows:
> >
> > from Bio import GenBank
> >
> > gb_file = 'ncbiSamples'
> >
> > gb_handle = open(gb_file, 'r')
> > fp1 = open('ncbiSeq', 'w+')
> >
> > feature_parser = GenBank.FeatureParser()
> >
> > gb_iterator = GenBank.Iterator(gb_handle, feature_parser)
> >
> > while 1:
> >     cur_record = gb_iterator.next()
> >     if cur_record is None:
> >        break
> >     print cur_record.id
> >     sequence=cur_record.seq.data
> >     print sequence
> >     fp1.write('>'+cur_record.id[:-2]+'\n'+sequence+'\n')
> >
> >
> > The script worked well for some records. The I got error messages:
> >
> > Traceback (most recent call last):
> >   File "getSeq.py", line 13, in ?
> >     cur_record = gb_iterator.next()
> >   File "/bio/python2.2/lib/python2.2/site-packages/Bio/GenBank/__init__.py", line
> >     183, in next return self._parser.parse(File.StringHandle(data))
> >   File "/bio/python2.2/lib/python2.2/site-packages/Bio/GenBank/__init__.py", line
> >     268, in parse self._scanner.feed(handle, self._consumer)
> >   File "/bio/python2.2/lib/python2.2/site-packages/Bio/GenBank/__init__.py", line
> >     1252, in feed self._parser.parseFile(handle)
> >   File "/bio/python2.2/lib/python2.2/site-packages/Martel/Parser.py", line
> >     338, in parseFile self.parseString(fileobj.read())
> >   File "/bio/python2.2/lib/python2.2/site-packages/Martel/Parser.py", line
> >     366, in parseString self._err_handler.fatalError(result)
> >   File "/bio/python2.2/lib/python2.2/xml/sax/handler.py", line 38, in
> >     fatalError raise exception
> > Martel.Parser.ParserPositionException: error parsing at or beyond
> > character 1525
> >
> >
> > Has everyone encountered the same problem? How do we get rid of this
> > problem?
> >
> > Best wishes,
> >
> > Jinling Huang
> >
> >
> > _______________________________________________
> > BioPython mailing list  -  BioPython@biopython.org
> > http://biopython.org/mailman/listinfo/biopython
>