This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error when using NcbiblastnCommandline

Hi! I would like to use the "NcbiblastnCommandline". I tried the following script that I found in the "Biopython Tutorial" :

>>> from Bio.Blast.Applications import NcbiblastnCommandline
>>> blastn_cline = NcbiblastnCommandline(query="myfastaseq.fasta", db="nt", evalue=0.001,
... outfmt=5, out="result.xml")
>>> blast_cline
>>> stdout, stderr = blastn_cline()

Here is the following error message :

Traceback (most recent call last):
  File "blast_biopython.py", line 38, in <module>
    stdout, stderr = blastn_cline()
  File "/usr/local/bioinfo/src/python/current/lib/python2.7/site-packages/Bio/Application/__init__.py", line 444, in __call__
    stdout_str, stderr_str)
Bio.Application.ApplicationError: Command 'blastn -out result.xml -outfmt 5 -query myfastaseq.fasta -db nr -evalue 0.001' returned non-zero exit status 5, 'FATAL:  Argument 1 ("-out") is not recognized or is improperly formed.'

Do you know where the problem could come from ? Thanks Francois

blast biopython

Is blast installed and available in $PATH on your machine?

The command that is giving the error is fine, so test what happens when you run it on your machine outside of python (just copy the "blastn..." part to the terminal) and see if it gives you more information. It is likely that blastn isn't correctly installed.

Thanks genomax2 and Daniel for your answers.

I didn't find blast in the $PATH. When I write in my terminal :

blastn -out blast.xml -outfmt 5 -query sequence_a_blaster.fasta -db nr -evalue 0.001

I get the following error message :

"BLASTN 2.0MP-WashU [04-May-2006] [linux26-x64-I32LPF64 2006-05-10T17:22:28]

Copyright (C) 1996-2006 Washington University, Saint Louis, Missouri USA. All Rights Reserved. ....................................... (help options)..................... For more information, see http://blast.wustl.edu/blast/parameters.html

FATAL: Argument 1 ("-out") is not recognized or is improperly formed.

EXIT CODE 5"

So I suppose that blast is installed but I still don't understand the error message.

You appear to have WU-BLAST installed which is not the same as blast+ package from NCBI. If you want to use WU-BLAST then you would need to modify the code you obtained from Biopython. Otherwise install/use the correct blast+ executables for your OS. They can be found here.

Thanks genomax2. I downloaded the ncbi-blast-2.4.0+-x64-linux.tar.gz version but couldn't find "blastn" inside it ! So what other version could you recommend me ?

You downloaded the source code for blast. Sorry that was not correct (I see that the source file has src in its name). What OS are you using? Depending on that there may be a pre-compiled version available or otherwise you will need to compile using the source you just downloaded.

Did you not find ncbi-blast-2.4.0+/bin/blastn when you did tar -zxvf ncbi-blast-2.4.0+-x64-linux.tar.gz which should have made a folder ncbi-blast-2.4.0+?

In that case your administrators should be able to use rpm (I don't think you can as a normal user). That file is here. They could also compile from source code (if that is preferred). Either would be the best way, so see if you can make this happen.

0 answers

No answers yet.

Log in to answer this question.