Ma_fermar
Ma_fermar

Reputation: 33

Syntax error running BLAST online with Biopython

I am trying to build a script to compare my fasta files from pyrosequencing with the nucleotide GenBank database following the Biopython Tutorial and Cookbook (Chapter 7).

While the process is running, the prompt shows the following message:

result_handle=NCBIWWW.qblast("blastn", "nt", record.seq)
            ^
SyntaxError: invalid syntax

And I do not know what the problem is, or how to fix it. I probably have later errors in my script. But now, I cannot continue woking with it.

Upvotes: 0

Views: 361

Answers (1)

David Cain
David Cain

Reputation: 17333

From the code snippet you gave, you just need to close the parenthesis block of your open command- format is a parameter that's passed to SeqIO.read, not open.

record=SeqIO.read(open("/Users/imac/Desktop/sinchimeras_1.fasta"), # close parens
    format="fasta")
result_handle=NCBIWWW.qblast("blastn", "nt", record.seq)
archivo1=open("/Users/imac/Desktop/bacsoilpia0_otu.xml", "w")
archivo1.write(result_handle.read()) 

Upvotes: 1

Related Questions