[BioPython] NCBIWWW.qblast

alper soyler alpersoyler at yahoo.com
Wed May 31 11:40:48 UTC 2006


Dear All,

I have a fasta file (called fasta) containing 20 proteins. I want to blast them in an order. How can I write the results of these 20 proteins in different output files. I tried to write the below script but the 'my_blast2.out' file turned empty. Can you help me please?

regards,
Alper

#!usr/local/bin/python

from Bio import Fasta
file_for_blast = open('fasta', 'r')
f_iterator = Fasta.Iterator(file_for_blast)
f_record = f_iterator.next()

from Bio.Blast import NCBIWWW
result_handle = NCBIWWW.qblast('blastp', 'nr', f_record)

seqnum = 0

for f_record  in f_iterator:
    save_file = open('my_blast.out', 'w')
    blast_results = result_handle.read()
    save_file.write(blast_results)
    save_file.close()
    seqnum += 1
    save_file2 = open('my_blast2.out', 'w')
    blast_results = result_handle.read()
    save_file2.write(blast_results)
    save_file2.close()
		
---------------------------------
Be a chatter box. Enjoy free PC-to-PC calls  with Yahoo! Messenger with Voice.



More information about the Biopython mailing list