[Biopython-dev] need help with Genbank
Jeffrey Chang
jchang at smi.stanford.edu
Thu Jul 18 12:19:01 EDT 2002
The GenBank parser has gone through a few revisions to handle format
changes since 1.00a4 was released. Try getting the latest version out
of CVS (cvs.open-bio.org) and see if that fixes the problem.
Otherwise, please send in a sample GenBank record that causes the
parser to break.
Jeff
On Thu, Jul 18, 2002 at 11:02:41AM -0500, Dinakar Desai wrote:
> Hello:
>
> I have install biopython1.004a and python 2.2.1 on linux box. I am going
> through tutorial written by Brad et al. (very good work).
> With following code I get trace back which I have pasted at the end.
> Can someone help me with. I must be dong something wrong here.
>
> Thanks
>
> Dinakar
> <code>
> 30 from Bio import GenBank
> 31 record_file = open('record_file.seq', 'w+')
> 32 record_parser = GenBank.FeatureParser()
> 33 ncbi_dict = GenBank.NCBIDictionary()
> 34 for id in titles:
> 35 gb_seqrecord = ncbi_dict[id]
> 36 record_file.write( gb_seqrecord)
> 37
> 38
> 39 record_file.close()
> 40 record_file = open('record_file.seq', 'r')
> 41 gb_iter = GenBank.Iterator(record_file, record_parser)
> 42 while 1:
> 43 current_record = gb_iter.next()
> 44 if current_record is None:
> 45 break
> 46 print current_record.seq
> 47 print current_record.source
> 48 print current_record.author
> 49 record_file.close()
>
> </code>
> <traceback>
> Traceback (most recent call last):
> File "./test_as.py", line 43, in ?
> current_record = gb_iter.next()
> File
> "/home/desas2/lib/python2.2/site-packages/Bio/GenBank/__init__.py", linet
> return self._parser.parse(File.StringHandle(data))
> File
> "/home/desas2/lib/python2.2/site-packages/Bio/GenBank/__init__.py", linee
> self._scanner.feed(handle, self._consumer)
> File
> "/home/desas2/lib/python2.2/site-packages/Bio/GenBank/__init__.py", lined
> self._parser.parseFile(handle)
> File "/home/desas2/lib/python2.2/site-packages/Martel/Parser.py",
> line 230, ie
> self.parseString(fileobj.read())
> File "/home/desas2/lib/python2.2/site-packages/Martel/Parser.py",
> line 258, ig
> self._err_handler.fatalError(result)
> File "/home/desas2/lib/python2.2/xml/sax/handler.py", line 38, in
> fatalError
> raise exception
> Martel.Parser.ParserPositionException: error parsing at or beyond
> character 55
>
> </traceback>
> --
>
>
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at biopython.org
> http://biopython.org/mailman/listinfo/biopython-dev
More information about the Biopython-dev
mailing list