Clustalw Alignment Error In Biopython
2
2
Entering edit mode
13.1 years ago
Mkl ▴ 100

Hi ,

I tried the following code to run clustalw . But I am getting error.

>>> from Bio.Align.Applications import ClustalwCommandline
>>> cline = ClustalwCommandline("clustalw2", infile="seqs.fasta")
>>> print cline
clustalw2 -infile=seqs.fasta
>>> from Bio import AlignIO
>>> align = AlignIO.read("seqs.aln", "clustal")

IOError: [Errno 2] No such file or directory: 'seqs.aln'

I am using winndows OS, Biopython 1.57.

I modified the previous code as shown below

>>> from Bio.Align.Applications import ClustalwCommandline
>>> clustalw_exe = r"C:\Program Files\clustalw2\clustalw2.exe"
>>> clustalw_cline = ClustalwCommandline(clustalw_exe, infile="C:\Users\ss          \Desktop\seqs.fasta")
>>> assert os.path.isfile(clustalw_exe), "Clustal W executable missing"
>>> stdout, stderr = clustalw_cline()
>>> from Bio import AlignIO
>>> align = AlignIO.read("seqs.aln", "clustal")

But I got the error like this

  File "<pyshell#53>", line 1, in <module>
    align = AlignIO.read("seqs.aln", "clustal")
File "C:\Python27\lib\site-packages\Bio\AlignIO\__init__.py", line 427, in read
first = iterator.next()
File "C:\Python27\lib\site-packages\Bio\AlignIO\__init__.py", line 333, in parse
handle = open(handle, "rU")
IOError: [Errno 2] No such file or directory: 'seqs.aln'

How to solve this error? Any suggestions please.

clustalw biopython multiple • 10k views
ADD COMMENT
3
Entering edit mode

Your code does not actually run clustalw; you've only printed out the commandline. Try "cline()" and check out the Tutorial for more details: http://biopython.org/DIST/docs/tutorial/Tutorial.html#htoc75

ADD REPLY
1
Entering edit mode

No such file or directory: 'seqs.aln'!!!

ADD REPLY
0
Entering edit mode

Strange I'm getting the same problem too. I'm also on windows and it does not make the alignment file or the dnd file.

ADD REPLY
0
Entering edit mode

you have spaces in your path here: s"C:Usersss Desktopseqs.fasta", does your folder also have those spaces? And is seqs.aln in the same folder clustalw2.exe?

ADD REPLY
0
Entering edit mode

When I gave the path for seqs.aln file I got the output.

ADD REPLY
3
Entering edit mode
13.1 years ago

Dear MKL,

The code you have tried there is almost correct. Just a Brad Chapman mentioned that you have to try this

cline()

instead of

print cline

cline() executes ClustaW with the given parameters. I'm using Linux and I was successful using this code

from Bio.Align.Applications import ClustalwCommandline

#clustalw instead of clustalw2
cline = ClustalwCommandline("clustalw", infile="seq.fasta")
cline()

from Bio import AlignIO
align = AlignIO.read("seq.aln", "clustal")
ADD COMMENT
1
Entering edit mode

Thank you for your answer.I tried cline() instead of print cline().But I am getting error.

ADD REPLY
0
Entering edit mode

I suppose there is some misconfiguration of Biopython with your Python... Have you tried reinstalling Python and Biopython? Use the latest version of Python 2.7 from this page:http://python.org/download/ and Biopython for Python 2.7 from this page: http://biopython.org/wiki/Download.. I am pretty sure it should work.

ADD REPLY
0
Entering edit mode
13.1 years ago
Thaman ★ 3.3k

I have already clearly answered; please try to search specific tag >>> A: How To Run Clustalw Using Commands From An Input File

ADD COMMENT

Login before adding your answer.

Traffic: 1669 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6