[Biopython] NcbiblastxCommandline error

Peter Cock p.j.a.cock at googlemail.com
Thu Feb 10 05:21:27 EST 2011


On Thu, Feb 10, 2011 at 2:02 AM, Eric Talevich <eric.talevich at gmail.com> wrote:
> On Wed, Feb 9, 2011 at 5:07 PM, Gregorio Manuel Iraola Bentancor <
> goyo1987 at gmail.com> wrote:
>
>> Hello, my name is Gregorio from Uruguay. I am trying to perform some local
>> blast in my machine, but I got this error:
>>
>> Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
>> [GCC 4.4.3] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> from Bio.Blast.Applications import NcbiblastxCommandline
>> >>> blastx_cline = NcbiblastxCommandline(cmd='blastx',db='K10909.fasta',
>> query='query.fasta',out='salida.xml')
>> >>> blastx_cline()
>> Traceback (most recent call last):
>>  File "<stdin>", line 1, in <module>
>> TypeError: 'NcbiblastxCommandline' object is not callable
>>
>> I do not know what is happening, because the same code runs well in other
>> computers. I would really appreciate any advice or solution.
>>
>
> Hi Gregorio,
>
> If the same code has worked on other machines, then you probably have
> different versions of Biopython installed on these machines. The
> "Commandline" objects became callable in Biopython version 1.55, but in
> earlier versions we would first serialize the command line as a string, then
> launch it as a subprocess.

I agree with Eric, that is the most likely explanation. You can check the
version of Biopython installed with:

import Bio
print Bio.__version__

> Can you update the Biopython installation on your local computer? If not,
> I'd recommend converting the NcbiblastxCommandline to a string --
> str(blastx_cline) -- then using os.system() or subprocess.call() to execute
> the command (the string).
>
> Most of the subprocess examples have been dropped from the current tutorial,
> but you can draw some inspiration for the Muscle section (look at the second
> example, which uses subprocess.Popen):
> http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc77

Alternatively look at the tutorial shipped with Biopython 1.54, which will be in
the zip or tar balls for the release under the Doc folder:

http://biopython.org/DIST/biopython-1.54.tar.gz
http://biopython.org/DIST/biopython-1.54.zip

Peter



More information about the Biopython mailing list