[BangPypers] biopython

Kenneth Gonsalves lawgon at au-kbc.org
Tue Jun 15 03:31:00 CEST 2010


On Monday 14 June 2010 19:32:33 madhuri vio wrote:
> i have tried this still unable to get an output
> 
> from Bio import Seq
> from Bio import SeqIO
> from Bio import SeqRecord
> 
> for seq_record in SeqIO.read("ls_MTbH37Rv.fasta", "fasta"):
>     print seq_record.id
>     print repr(seq_record.seq)
>     print len(seq_record)
> 
> python bio.py
> Traceback (most recent call last):
>   File "bio.py", line 10, in <module>
>     for seq_record in SeqIO.read("ls_MTbH37Rv.fasta", "fasta"):
>   File "/var/lib/python-support/python2.6/Bio/SeqIO/__init__.py", line 433,
> in read
>     iterator = parse(handle, format, alphabet)
>   File "/var/lib/python-support/python2.6/Bio/SeqIO/__init__.py", line 342,
> in parse
>     raise TypeError("Need a file handle, not a string (i.e. not a
> filename)")
> TypeError: Need a file handle, not a string (i.e. not a filename)
> 

this is a file name: 'ls_MTbH37Rv.fasta' - you have to open the file first before 
doing anything with it
-- 
Regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC


More information about the BangPypers mailing list