[Biopython] Problem running blastp
John Connolly
j.connolly at sheffield.ac.uk
Wed Jan 29 16:26:53 UTC 2014
Hi Peter,
Thank you for your reply.
I realised that the line you mentioned was unnecessary after I'd sent the
message, but I didn't know how to update the mailing list. Sorry about that.
Here's the program after I've modified it a little:
"from Bio.Blast.Applications import NcbiblastpCommandline
cline = NcbiblastpCommandline(query="seqs.txt", db="NADB", outfmt=5)
cline
NcbiblastpCommandline(cmd='blastp', query='seqs.txt', db='NADB', outfmt=5)
print(cline)
#blastp -query seqs.txt -db NADB -outfmt 5 -remote
stdout, stderr = cline()"
It runs fine, but I thought I knew how to assign the results of the blast
to a file_handle, which I could then parse. I thought that the results
would be in cline(). I know how to get the results to a file, but I would
like to parse them in the same program (I have a parsing program that does
exactly what I need).
On 29 January 2014 15:16, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> 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