Tuesday, July 19, 2011


Aside from OS threading and OO programming, I came across something of interests to me. While parsing through fasta and genbank files from the Biopython tutorial site, a few of their examples were not able to run in a python script. After looking into the error messages. i've noticed the function SeqIO.parse() takes a file object instead of the filename.

i am currently utilizing python 2.6.5 and BioPython 1.53.  The Codes below work well for me.

#!/usr/bin/env python

from Bio import SeqIO

file = open("./ls_orchid.fasta")

for sequ in SeqIO.parse(file, "fasta"):
    print sequ.id
    print repr(sequ.seq)
    print len(sequ)