'blastp' is not recognized as an internal or external command using Bio.Blast.Applications
1
0
Entering edit mode
3.8 years ago
perstet • 0

Hello!

I'm trying to run a local BLAST with biopython using Bio.Blast.Applications. However, when running the below code:

from Bio.Blast.Applications import NcbiblastpCommandline

result = r"C:\Users\Uzytkownik\Desktop\tests\result.xml" 
q = r"C:\Users\Uzytkownik\Desktop\tests\fastas\my_example2.faa"
database = r"C:\Users\Uzytkownik\Desktop\tests\my_examplemultif.faa"

blastp_cline = NcbiblastpCommandline(query = q, db = database, evalue = 0.001, outfmt=5, out = result)
stdout, stderr = blastp_cline()

I receive an error stating:

ApplicationError: Non-zero return code 1 from 'blastp -out C:\\Users\\Uzytkownik\\Desktop\\tests\\result.xml -outfmt 5 -query C:\\Users\\Uzytkownik\\Desktop\\tests\\fastas\\my_example2.faa -db C:\\Users\\Uzytkownik\\Desktop\\tests\\my_examplemultif.faa -evalue 0.001', message "'blastp' is not recognized as an internal or external command,"

When I run the query through the command line everything works fine (I'm using blast 2.9.0+), so I'm really not sure what the issue is. Would be gratefull for any help!

biopython blast • 1.6k views
ADD COMMENT
0
Entering edit mode

blastp is not available in your PATH. Since this appears to be windows you will need to amend PATH accordingly (or provide full path to the blastp executable).

ADD REPLY
0
Entering edit mode

idk if it can help, when I run blast inside python, I put (example with blastx):

from Bio.Blast.Applications import NcbiblastxCommandline

cline = NcbiblastxCommandline(query = query_file, db = database_file, out = query_file+'.blastx', 
outfmt = 6, word_size = 3, evalue = 0.00001, num_threads = threads)
stdout, stderr = clone()

my blast version: Translated Query-Protein Subject BLAST 2.9.0+

ADD REPLY
0
Entering edit mode
23 months ago
John • 0

Follow this BLAST+ to install BLAST+ on windows and adding it to the path should work.

from Bio.Blast.Applications import NcbiblastnCommandline

blastn = "C:/path_to_blast/blast-BLAST_VERSION+/bin/blastn"

cline = NcbiblastnCommandline(cmd = blastn,query='query.fasta', out='out.tab', outfmt=6, subject='subject.fasta') stdout, stderr = cline()

print("STDOUT: %s" % stdout)

print("STDERR: %s" % stderr)

ADD COMMENT

Login before adding your answer.

Traffic: 1319 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6