[BioPython] os.system problem with clustalw

Peter biopython at maubp.freeserve.co.uk
Tue Jul 24 21:13:17 UTC 2007


Emanuel Hey wrote:
> If I have clustalw.exe in the current directory then I
> should be able to execute just using
> 
>>>> os.sytem('clustalw ' + 'data.faa')
> 
> Indeed this works fine

Yes, and if you try this at the windows command prompt it also works:

clustalw data.faa

or:

clustalw.exe data.faa

> However if I give it the full path
>>>> os.system('clustalw ' +
> 'C:\temp\pythonplay\hcgplay\data.faa')

That should fail due to the way python uses slashes as escape 
characters, so \t means a tab for example.

> or
>>>> os.system('clustalw ' +
> 'C:\\temp\\pythonplay\\hcgplay\\data.faa')
> 
> then the clustalw run crashes and returns 
 > Error: unknown option
 > /-INFILE=C:\temp\pythonplay\hcgplay\data.faa

Its not crashing, its just returning with an error message.

You are not dealing with a Biopython or even a python problem here - you 
are simply (but understandably) having trouble with the clustalw command 
line options.

Notice that clustalw.exe will tolerate this:

clustalw.exe data.faa

as shorthand for:

clustalw.exe /infile=data.faa

However, for some reason it does not seem to work with full paths like this:

clustalw.exe C:\temp\pythonplay\hcgplay\data.faa

You have to be very explicit:

clustalw.exe /infile=C:\temp\pythonplay\hcgplay\data.faa

This may be a (windows only?) bug in clustalw. Its certainly not 
intuitive as is.

Peter

P.S. Did you not like using Bio.Clustalw to build the command line 
string for you?




More information about the Biopython mailing list