Thank you for your answer.I tried cline() instead of print cline().But I am getting error.
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.
2 answers
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")
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.
I have already clearly answered; please try to search specific tag >>> A: How To Run Clustalw Using Commands From An Input File
Log in to answer this question.
No such file or directory: 'seqs.aln'!!!
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.
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
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?
When I gave the path for seqs.aln file I got the output.