[Biopython] SeqIO parser error

Michael S. Koeris michael.koeris at gmail.com
Fri Sep 25 15:25:00 UTC 2009


Hi,

I'm just getting acquainted with Sequence Objects and records and so  
forth. I tried some very basic code from the tutorial and I get an  
error when I run this:

from Bio import Entrez, SeqIO

gi_list = ['224589821', '224514694', '164698032', '157812089',  
'157734174']
gi_str = ",".join(gi_list)
handle = Entrez.efetch(db="nuccore", id=gi_str, rettype="gb")

records = SeqIO.parse(handle, "gb")

for record in records:
     print "%s, length %i, with %i features" \
           %(record.name, len(record), len(record.features))

Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/Bio/GenBank/Scanner.py", line 420, in  
parse_records
     record = self.parse(handle, do_features)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/Bio/GenBank/Scanner.py", line 403, in parse
     if self.feed(handle, consumer, do_features) :
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/Bio/GenBank/Scanner.py", line 381, in feed
     self._feed_misc_lines(consumer, misc_lines)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/Bio/GenBank/Scanner.py", line 1142, in  
_feed_misc_lines
     consumer.contig_location(contig_location)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/Bio/GenBank/__init__.py", line 987, in  
contig_location
     self.location(content)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/Bio/GenBank/__init__.py", line 689, in location
     self._set_location_info(parse_info, self._cur_feature)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/Bio/GenBank/__init__.py", line 797, in  
_set_location_info
     self._set_function(parse_info, cur_feature)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/Bio/GenBank/__init__.py", line 720, in  
_set_function
     self._set_ordering_info(function, cur_feature)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/Bio/GenBank/__init__.py", line 764, in  
_set_ordering_info
     feature_start = cur_feature.sub_features[0].location.start
AttributeError: 'PositionGap' object has no attribute 'start'

Any help is most appreciated.

Mike

--
Michael S. Koeris
michael.koeris at gmail.com




More information about the Biopython mailing list