[Biopython-dev] 12/10 biopython Questions - BioStar

Feed My Inbox updates at feedmyinbox.com
Fri Dec 10 09:05:40 UTC 2010


// Biopython 1.56 - Strange behaviour of SeqIO.parse and SeqIO.write
// December 9, 2010 at 5:53 AM

http://biostar.stackexchange.com/questions/4160/biopython-1-56-strange-behaviour-of-seqio-parse-and-seqio-write
Hello everybody,

I'm using Biopython 1.56 compiled from source on Ubuntu 10.10 64-bit. It's a great 
piece of software and I love to work with it. But there is a very strange behavior
of the "Bio.SeqIO.parse()" sequence parser, which cost me several hours to find out: 

If I uncomment the for-statement with the print commands, "Bio.SeqIO.write()" refuses
to write the sequences to the file. 

Is this the desired behavior? Is the for-loop iterating the parser object to its end
and leaves it there? Could anyone help me out? What am I getting wrong?

Thanks in advance!

Markus

Example:


handle = open("ls_orchid.fasta", "fasta")
parsedfasta = Bio.SeqIO.parse(handle, "fasta")

# If you uncomment the following part, 0 Sequences 
# (instead of many more) are written to the file!

#for seq_record in parsedfasta:   
    #print "Description:\t%s..." % seq_record.description
    #print "Length:\t\t%d" % len(seq_record)
    #print "Sequence:\t%s\n" % seq_record.seq[:40], seq_record.seq[44:50])

output_handle = open("example.fasta", "w")   
count = Bio.SeqIO.write(parsedfasta, output_handle, "fasta")
output_handle.close()
print "%d Sequences written to file" % count


--
Website: http://biostar.stackexchange.com/questions/tagged/biopython

Account Login: 
https://www.feedmyinbox.com/members/login/?utm_source=fmi&utm_medium=email&utm_campaign=feed-email

Unsubscribe here: 
http://www.feedmyinbox.com/feeds/unsubscribe/520215/805c958547f61946466c46fa25ad261e71d15c34/?utm_source=fmi&utm_medium=email&utm_campaign=feed-email

--
This email was carefully delivered by FeedMyInbox.com. 
PO Box 682532 Franklin, TN 37068




More information about the Biopython-dev mailing list