[Biopython] [BioPython] Clustalw Problems

Peter biopython at maubp.freeserve.co.uk
Thu Apr 23 15:59:23 UTC 2009


Bradley Hintze wrote:
>
> Peter,
>
> Sorry that it has taken so long to reply..school.
> I am still having issues with the alignments. I have BioPython 1.50

OK, it is good that you are on the latest release already :)
By the way it is "Biopython", not "BioPython" ;)

> I tried to do what you suggested and got the following:
>
>>>> from Bio.Clustalw import MultipleAlignCL
>>>> from Bio.Clustalw import do_alignment
>>>> cline=MultipleAlignCL(r'C:\Bradley_BioPython\mtr4.fasta',r'C:\Bradley_BioPyt
> hon\clustalw1.83.XP\clustalw.exe')
>>>> cline.set_output(r'C:\Bradley_BioPython\test.aln')
>>>> print cline
> C:\Bradley_BioPython\clustalw1.83.XP\clustalw.exe -INFILE=C:\Bradley_BioPython\m
> tr4.fasta -OUTFILE=C:\Bradley_BioPython\test.aln

Did you try running this "by hand" at the windows command prompt?
>From the Windows start menu, pick "run", then enter "cmd.exe".  Then
paste in this command (from memory I think you need to right click on
the icon in the top left of this window to get the paste menu option).

I am expecting it to say "Bad command line option in the command ..."

>>>> al=do_alignment('C:\Bradley_BioPython\clustalw1.83.XP\clustalw.exe -INFILE=C
> :\Bradley_BioPython\mtr4.fasta -OUTFILE=C:\Bradley_BioPython\test.aln')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "C:\Python25\Lib\site-packages\Bio\Clustalw\__init__.py", line 120, in do
> _alignment
>     % str(command_line))
> ValueError: Bad command line option in the command: C:\Bradley_BioPython\clustal
> w1.83.XP\clustalw.exe -INFILE=C:\Bradley_BioPython\mtr4.fasta -OUTFILE=C:\Bradle
> y_BioPython     est.aln

You have used '\t' in this string which means it was treated as a tab.
 Instead use \\t, or raw mode as you did earlier for the filenames:

al=do_alignment(r'C:\Bradley_BioPython\clustalw1.83.XP\clustalw.exe
-INFILE=C:\Bradley_BioPython\mtr4.fasta
-OUTFILE=C:\Bradley_BioPython\test.aln')

The text "Bad command line option in the command" tells me ClustalW
returned error code 1, but this makes sense due to the tab.

> When i try running 'cline' i get this
>
>>>> 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:\Bradley_BioPython\mtr4.fasta

This means ClustalW returned error code 2 (which should mean it can't
find your input file).  Are you sure the path is correct?  Try:

import os
print os.path.isfile(r'C:\Bradley_BioPython\mtr4.fasta')

Peter




More information about the Biopython mailing list