[BioPython] Fasta Iterator

Iddo Friedberg idoerg at burnham.org
Mon Jun 14 13:51:41 EDT 2004


Two problems with this:

1) You need to create a parser. Somthing like:

 >>> parser = Fasta.RecordParser()
 >>> file_for_blast = open('m-cold.fasta','r')
Then:

 >>> f_iterator = Fasta.Iterator(file_for_blast,parser)


Sylvain Schüpp wrote:
> Yes, you're right.
> I'm develloping under Windows XP using Python 2.3.4 and BioPython 1.30 
> for Windows.
> 
> And here is my problem :
>  >>> from Bio import Fasta
>  >>> file_for_blast = open('m-cold.fasta','r')


>  >>> f_iterator = Fasta.iterator(file_for_blast)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^




> But in the directory Lib/Bio/Fasta there is a file (something like 
> __init__.py) which contain a class Iterator.
>  

Exactly! But Python is case sensitive, and you wrote Fasta.iterator 
where it should be Fasta.Iterator

Anyhow, you should instantiate RecordParser, and pass it to Fasta.Iterator.

See section 2.4.3 from the tutorial/cookbook. Also, please let me know 
which prt of the T/C you read to do this. I'll check that part for errors.


HTH,

Iddo




-- 
Iddo Friedberg, Ph.D.
The Burnham Institute
10901 N. Torrey Pines Rd.
La Jolla, CA 92037
USA
Tel: +1 (858) 646 3100 x3516
Fax: +1 (858) 713 9930
http://ffas.ljcrf.edu/~iddo


More information about the BioPython mailing list