[Biopython] Problem running blastp

Peter Cock p.j.a.cock at googlemail.com
Wed Jan 29 15:16:16 UTC 2014


On Wed, Jan 29, 2014 at 2:43 PM, John Connolly
<j.connolly at sheffield.ac.uk> wrote:
> Hi,
>
> I am very new to Biopython and python, so please excuse me if this is a
> very basic question.
>
> I have installed Blast+, which runs fine from the command line. I have also
> used Biopython to produce a program that parses xml output, which works
> fine.
>
> My problem is that I would like to run a local blast from within a python
> program, tacked on to the start of my parsing program.
>
> I have used the program in the tutorial:
>
> from Bio.Blast.Applications import NcbiblastpCommandline
>
> cline = NcbiblastpCommandline(query="seqs.txt", db="NADB", outfmt=5,
> remote=True)
>
> cline
> NcbiblastpCommandline(cmd='blastp', query='seqs.txt', db='NADB', outfmt=5,
> remote=True)
> print(cline)
> blastp -query seqs.txt -db NADB -outfmt 5 -remote
> stdout, stderr = cline()
>
> I don't expect any output, but I get the following:
>
>   File "test.py", line 8
>     blastp -query seqs.txt -db NADB -outfmt 5 -remote
>                      ^
> SyntaxError: invalid syntax
>
>
> I appreciate any help you could give.

This is not a Python command:

blastp -query seqs.txt -db NADB -outfmt 5 -remote

I think you've got a line of sample output inside your Python script,
try reducing it to just these four lines:

from Bio.Blast.Applications import NcbiblastpCommandline
cline = NcbiblastpCommandline(query="seqs.txt", db="NADB", outfmt=5,
remote=True)
print(cline) # optionally print out what it will run...
stdout, stderr = cline() # run the BLAST

Regards,

Peter



More information about the Biopython mailing list