[Biopython-dev] Updates to the tutorial for parsing GenBank files

Colosimo, Marc E. mcolosimo at mitre.org
Wed Dec 14 14:01:22 EST 2005




On 12/14/05 1:33 PM, "Peter" <biopython-dev at maubp.freeserve.co.uk> wrote:

> Marc Colosimo wrote:
> 
>> It seems odd that the Fasta stuff is buried within Chapter 2 (2.4.3
>> Making it easier - plus it is missing "import string").
> 
> Yes, but I think it would be better to avoid using the string module
> completely, and use the split method of the string object instead:
> 

I totally agree with you on this. I was just following the coding style used
in the cookbook and not my own.

> from Bio import Fasta
> 
> def parseTitle2Ids(title):
>       return title.split("|")[:3]
> 
> parser = Fasta.SequenceParser(title2ids = parseTitle2Ids)
> file = open("ls_orchid.fasta")
> iterator = Fasta.Iterator(file, parser)
> ...
> 
Marc 



More information about the Biopython-dev mailing list