[Biopython] Running a specific version of NCBI BLAST from within Biopython

Peter Cock p.j.a.cock at googlemail.com
Mon Oct 20 21:48:46 UTC 2014


On Mon, Oct 20, 2014 at 8:08 PM, Ivan Gregoretti <ivangreg at gmail.com> wrote:
> Hello Biopythoneers,
>
> I have multiple versions of NCBI BLAST installed in my Linux box. I
> need them all.
>
> How do I tell Biopython which version of local BLAST I want to run each time?
>
> Is it possible to specify the path to the desired executable?
>
> Thank you,
>
> Ivan

Yes - assuming you are using the command line wrappers to build
the command string (and run it), they default to calling blastp or
blastx (etc) meaning the first binary of that name on the $PATH.
However, you can provide the explicit path to the binary you want.

i.e.

from Bio.Blast.Applications import NcbiblastxCommandline
blastx_cline = NcbiblastxCommandline(query="opuntia.fasta", db="nr",
evalue=0.001, outfmt=5, out="opuntia.xml")

is equivalent to giving the first argument (cmd) explicitly:

from Bio.Blast.Applications import NcbiblastxCommandline
blastx_cline = NcbiblastxCommandline("blastx", query="opuntia.fasta",
db="nr", evalue=0.001, outfmt=5, out="opuntia.xml")

which you can change to something like:

from Bio.Blast.Applications import NcbiblastxCommandline
blastx_cline = NcbiblastxCommandline("/mnt/shared/ncbi-blast-2.2.29+/blastx",
query="opuntia.fasta", db="nr", evalue=0.001, outfmt=5,
out="opuntia.xml")

In all our command line wrappers using this style API, the first
argument is the binary name.

Peter

P.S. On Windows the $PATH is often not set, so you are forced to
give the full path of the BLAST+ binaries like this.


More information about the Biopython mailing list