[Biopython] error with entrez id code

Dilara Ally dilara.ally at gmail.com
Fri Oct 7 17:34:24 UTC 2011


> Is it always the same record that breaks? If so, what is the ID so we 
> can try it out.
>
> If not, then it looks like a random network error, maybe you can stick 
> a try/except in to refetch the data?
Hi Peter

Individually the identifier has no problem calling up the record, but 
the problem seems to be in the loop.  As a newbie, what is a try/except?

Thanks.

Dilara

On 10/6/11 12:43 AM, Peter Cock wrote:
>
>
> On Thursday, October 6, 2011, Dilara Ally <dilara.ally at gmail.com 
> <mailto:dilara.ally at gmail.com>> wrote:
> > Hi All
> >
> > I've written a program to identify Entrez gene ids from a blastall 
> that I performed.  The code is as follows:
> >
> > from Bio import SeqIO
> > from Bio import Entrez
> > ...
> >
> > The code seemed to run fine on my first file for the first 1287 
> lines but then I got this error
> >
> >> raceback (most recent call last):
> >>  File "Ally_EntrezID_Search_Final_Script.py", line 38, in <module>
> >>    record=SeqIO.read(handle,"genbank")
> >>  File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/SeqIO/__init__.py", 
> line 604, in read
> >>    first = iterator.next()
> >>  File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/SeqIO/__init__.py", 
> line 532, in parse
> >>    for r in i:
> >>  File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/GenBank/Scanner.py", 
> line 440, in parse_records
> >>    record = self.parse(handle, do_features)
> >>  File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/GenBank/Scanner.py", 
> line 423, in parse
> >>    if self.feed(handle, consumer, do_features):
> >>  File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/GenBank/Scanner.py", 
> line 400, in feed
> >>    misc_lines, sequence_string = self.parse_footer()
> >>  File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/GenBank/Scanner.py", 
> line 921, in parse_footer
> >>    line = self.handle.readline()
> >>  File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", 
> line 447, in readline
> >>    data = self._sock.recv(self._rbufsize)
> >>  File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", 
> line 533, in read
> >>    return self._read_chunked(amt)
> >>  File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", 
> line 586, in _read_chunked
> >>    value.append(self._safe_read(amt))
> >>  File 
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", 
> line 637, in _safe_read
> >>    raise IncompleteRead(''.join(s), amt)
> >> httplib.IncompleteRead: IncompleteRead(707 bytes read, 3147 more 
> expected)
> >
> > I'm new to python and biopython programming.  So any advice would be 
> extremely appreciated.
>
>
> Peter



More information about the Biopython mailing list