Question: Trying to run clustalw with biopython on jupyter notebook
0
gravatar for psschlogl
12 months ago by
psschlogl30
psschlogl30 wrote:

I am trying to run a tutorial on notebooks and I am receiving this error:

import os
from Bio.Align.Applications import ClustalwCommandline
clustalw = "bin/clustalw"
clustalw_cline = ClustalwCommandline(clustalw, infile="data/opuntia.fasta")
assert os.path.isfile(clustalw), "ClustalW executable missing"
stdout, stderr = clustalw_cline()

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-115-5a9268f91219> in <module>
      3 clustalw = "bin/./clustalw"
      4 clustalw_cline = ClustalwCommandline(clustalw, infile="data/opuntia.fasta")
----> 5 assert os.path.isfile(clustalw), "ClustalW executable missing"
      6 stdout, stderr = clustalw_cline()

AssertionError: ClustalW executable missing

But I installed my clustalw with sudo apt-get and it is in usr/bin/clustalw and i can run the program on most of the places in my cli shell, but not in te notebook.

Any of the guys here have some solution?
CLUSTAL 2.1
ubuntu debian 16.04
Biopython 1.73

Thanks

Paulo

I edited my question.
Sorry

biopython custalw • 775 views
ADD COMMENTlink modified 8 months ago by 8746818170 • written 12 months ago by psschlogl30

Why are you using windows style file paths (and a windows executable clustalw2.exe), if all this is happening on Ubuntu?

ADD REPLYlink modified 12 months ago • written 12 months ago by genomax83k

I change it to ubuntu. tried :
~/usr/bin/clustalw
usr/bin/clustalw
bin/clustalw
with ./clustalw and many more.

import os
from Bio.Align.Applications import ClustalwCommandline
clustalw_exe = "clustalw2.exe"
clustalw_cline = ClustalwCommandline("~/usr/bin/clustalw, infile=data/opuntia.fasta")
assert os.path.isfile(clustalw_exe), "Clustal W executable missing"
stdout, stderr = clustalw_cline()
ADD REPLYlink modified 12 months ago • written 12 months ago by psschlogl30

What does that mean? You will need to use unix file paths and proper executable if you are actually using Ubuntu.

ADD REPLYlink modified 12 months ago • written 12 months ago by genomax83k
1
gravatar for psschlogl
12 months ago by
psschlogl30
psschlogl30 wrote:

I got it done. I simple didint need all that code

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

And that works great. Thank you

ADD COMMENTlink modified 12 months ago • written 12 months ago by psschlogl30
1

Please edit your answer and add how you got it working - this would help others facing similar problems in the future.

ADD REPLYlink written 12 months ago by RamRS27k
0
gravatar for 874681817
8 months ago by
8746818170
8746818170 wrote:

I just solved this problem. First ,you have to make sure that you have clustalw2 installed on your computer. Next,add clustalw2 paths to environment variables Last,run the following code:

import os
from Bio.Align.Applications import ClustalwCommandline
clustalw_exe = r"C:\Program Files (x86)\ClustalW2\clustalw2.exe"   #Please fill in the software location correctly.
clustalw_cline = ClustalwCommandline(clustalw_exe, infile="opuntia.fasta")
assert os.path.isfile(clustalw_exe), "Clustal W executable missing"
stdout, stderr = clustalw_cline()

Goodluck!

ADD COMMENTlink modified 8 months ago by genomax83k • written 8 months ago by 8746818170
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: 995 users visited in the last hour