Question: Clustalw Alignment Error In Biopython
2
gravatar for Mkl
7.6 years ago by
Mkl100
Mkl100 wrote:

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 • 5.1k views
ADD COMMENTlink modified 7.5 years ago by Thaman3.2k • written 7.6 years ago by Mkl100
3

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 REPLYlink written 7.6 years ago by Brad Chapman9.4k
1

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

ADD REPLYlink written 7.6 years ago by Michael Dondrup46k

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 REPLYlink written 7.6 years ago by Harpalss310

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 REPLYlink written 7.5 years ago by Niek De Klein2.5k

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

ADD REPLYlink written 7.5 years ago by Mkl100
3
gravatar for Kashyap Chhatbar
7.6 years ago by
Edinburgh, UK
Kashyap Chhatbar70 wrote:

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 COMMENTlink written 7.6 years ago by Kashyap Chhatbar70
1

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

ADD REPLYlink written 7.5 years ago by Mkl100

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 REPLYlink written 7.5 years ago by Kashyap Chhatbar70
0
gravatar for Thaman
7.5 years ago by
Thaman3.2k
Finland
Thaman3.2k wrote:

I have already clearly answered; please try to search specific tag >>> http://biostar.stackexchange.com/questions/4349/how-to-run-clustalw-using-commands-from-an-input-file/4362#4362

ADD COMMENTlink written 7.5 years ago by Thaman3.2k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 616 users visited in the last hour