View Single Post
Old 04-29-2015, 06:08 AM   #1
Junior Member
Location: TX

Join Date: Mar 2015
Posts: 4
Default automated remote blasting issue

Hi everyone,

I'm trying to remotely blast about 70 200-nt sequences using Biopython.
I've been trying for hours to figure out why the following Python script won't work.
I can get it to work for a read file that contains just one fasta using, but when I try to switch to SeqIO.parse, I don't get anything in the .xml save file that I create.
Any ideas?

As a side note, if anyone knows the option syntax for excluding organisms from the results (as is possible when using the ncbi website, please let me know).

Thanks very much for any help.


from Bio.Blast import NCBIWWW
from Bio import SeqIO
import tkinter.filedialog as tkfd
record = SeqIO.parse(in_file, format="fasta")
out_file = tkfd.asksaveasfilename()
save_file = open(out_file, "w")
for rec in record:
....result_handle = NCBIWWW.qblast("blastn", "nt", rec.format("fasta"))

This is the content of the in_file that I'm using as a test file (the line formatting of my file is set at 80 char, which might have been lost below):

Last edited by queueing; 04-29-2015 at 06:12 AM. Reason: fixed indentation
queueing is offline   Reply With Quote