[BioPython] Clustalw Problems

Peter biopython at maubp.freeserve.co.uk
Wed Apr 8 17:50:24 EDT 2009


On 4/8/09, Bradley Hintze <bradley.h at aggiemail.usu.edu> wrote:
> Hi,
>
>  I am having a hard time running an alignment. I am running in windows and
>  here is my code and the error message that I get after running do_alignment.
>
>  >>> import os
>  >>> from Bio.Clustalw import MultipleAlignCL
>  >>> from Bio.Clustalw import do_alignment
>  >>> cline=MultipleAlignCL(r"C:\Documents and
>  Settings\student\Desktop\Foo\mtr4.fasta", r"C:\Program
>  Files\clustalw1.83.XP\clustalw.exe")
>  >>> cline.set_output(r"C:\Documents and
>  Settings\students\Desktop\Foo\test.aln")
>  >>> al=do_alignment(cline)
>  Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "C:\Python25\Lib\site-packages\Bio\Clustalw\__init__.py", line 124,
>  in do_alignment
>    % command_line.sequence_file)
>  IOError: Cannot open sequence file C:\Documents and
>  Settings\student\Desktop\Foo\mtr4.fasta
>
>  when I open the file using o=open('C:\Documents and
>  Settings\student\Desktop\Foo\mtr4.fasta') it woks fine.
>
>  any ideas?

As a general tip, try this to see what the command Biopython is trying
to run is:

>>> print cline

Then try running the same command by hand at the command prompt (DOS
prompt), and make sure it works.

I can tell from the error message you have Python 2.5, but what
version of Biopython do you have?

I'm not at a Windows machine to check, but it is generally a good idea
to avoid file names and paths with spaces where you can.  In this
case, I'm sure relative names would be fine:

>>> import os
>>> from Bio.Clustalw import MultipleAlignCL
>>> from Bio.Clustalw import do_alignment
>>> cline=MultipleAlignCL("mtr4.fasta", r"C:\Program Files\clustalw1.83.XP\clustalw.exe")
>>> cline.set_output("test.aln")

Peter


More information about the Biopython mailing list