[BioPython] Error generated by Clustalw example in Tutorial

Peter biopython at maubp.freeserve.co.uk
Fri Oct 5 18:35:05 UTC 2007


Y Tu wrote:
> I tested both commands under window prompt, initially both generated 
> error because window don't know clustalw.

This is expected.  You must either supply the full path of the clustalw 
executable, or have it on the system path.  Otherwise Windows doesn't 
know how to find the clustalw program.

> Once I give the correct path of the clustalw, both generated 
> alignment results without any error. BTW, I used the one inside 
> BioEdit, I did not find clustalw coming with Biopython. It looks like
> python use online program at
> ftp://ftp-igbmc.u-strasbg.fr/pub/ClustalW/. Am I right?

Clustalw is a standalone program (completely separate from Biopython)
which you must install separately if you want to use it.  It is 
available from several servers - the one you chose looks fine.

> Then I replace the old _ini_with the new one, but there is a new 
> error message similar to the old one:
> 
>>>> alignment = Clustalw.do_alignment(cline)
> Traceback (most recent call last): File "<interactive input>", line 
> 1, in <module> File 
> "C:\Python25\Lib\site-packages\Bio\Clustalw\__init__.py", line 117, 
> in do_alignment # check if the outfile exists before parsing IOError:
>  Output .aln file result1.aln not produced, commandline: clustalw 
> opuntia.fasta -OUTFILE=result1.aln
> 
> Also I tested the example on OS X, the same error was generated:
> 
>>>> alignment = Clustalw.do_alignment(cline)
> sh: line 1: clustalw: command not found Traceback (most recent call 
> last): File "<stdin>", line 1, in <module> File 
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/Bio/Clustalw/__init__.py",
>  line 117, in do_alignment % (out_file, command_line)) IOError: 
> Output .aln file result1.aln not produced, commandline: clustalw 
> ./opuntia.fasta -OUTFILE=result1.aln
> 
> It seems like the problem is not linked to OS. What other things 
> could be wrong? Thanks.

In both cases, you are not explicitly providing the path to clustalw - 
so for this to work the clustalw executable must be on the system path.

The other obvious thing to check is the location of the files versus the 
working directory. Is your python script in the same folder as the 
opuntia.fasta file?

What happens if you try those exact command lines (which Biopython says 
it is trying to run) at the command prompt in directory where your 
python script is located? i.e.

Windows:
clustalw opuntia.fasta -OUTFILE=result1.aln

Mac:
clustalw ./opuntia.fasta -OUTFILE=result1.aln

Peter




More information about the Biopython mailing list