[BioPython] GenBank parser X automate retrival from gi list

Jeffrey Chang jeffrey_chang at stanfordalumni.org
Fri Feb 13 19:24:54 EST 2004


It looks like you are passing a string to GenBank.Iterator when it was  
expecting a file handle.  Try:
     import StringIO
     iterator = GenBank.Iterator(StringIO.StringIO(gb_record), parser)

Jeff


On Feb 13, 2004, at 4:19 PM, Alexandre dos Santos Cristino wrote:

>
>  Hello everybody,
>
>  The BioPython project seems to be a very useful tool to bioinformatic
> tasks, so congratulations for this initiative!
>
>  I've used GenBank parser as described in the tutorials (with opened
> files), but I've failed to use it to process each gi list element.
> I'm afraid the parser can't work this way. Is there another solution  
> to do
> it? (traceback below)
>
>  thank you!
>  alex
>
> ps: I hope help you in this wonderful project, but I need to learn much
> more about Python.
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "searchGeneNCBI.py", line 46, in ?
>     resume_seq = gb_parser(gb_record)
>   File "/home/alex/anotacao/rot.py", line 5, in gb_parser
>     iterator = GenBank.Iterator(gb_record,parser)
>   File
> "/usr/local/biopython-1.23/build/lib.linux-i686-2.3/Bio/GenBank/ 
> __init__.py",
> line 126, in __init__
>     while _handle.peekline() and _handle.peekline().find("LOCUS") < 0:
>   File  
> "/usr/local/biopython-1.23/build/lib.linux-i686-2.3/Bio/File.py",
> line 72, in peekline
>     line = self._handle.readline()
> AttributeError: 'str' object has no attribute 'readline'
>
>
> --
> Alexandre dos Santos Cristino|-   _   -|Depto. Genetica - FMRP-USP
>    alexsc at rge.fmrp.usp.br    |_ = _ - _|  http://rge.fmrp.usp.br
> -. .-. .-. .-. .-. .-. .-. .-|_ _ _ = _|-. .-. .-. .-. .-. .-. .-
>   X   X   X   X   X   X   X  |- - _ - -|  X   X   X   X   X   X
> -' '-' '-' '-' '-' '-' '-' '-|=_=___=_=|-' '-' '-' '-' '-' '-' '-
>
>
> _______________________________________________
> BioPython mailing list  -  BioPython at biopython.org
> http://biopython.org/mailman/listinfo/biopython



More information about the BioPython mailing list