Question: No alignment produced ClustalW with python wrapper
0
gravatar for josephine.yates
14 months ago by
josephine.yates0 wrote:

Hello to all,

I am trying to produce alignments from fasta files with the ClustalwCommandline as explained in the Biopython tutorial. However, even though I do not get an error message, no alignment is produced from my code and I do not understand why.

If someone could help me with this issue, it would be of great help.

Here is my current code:

def score_align(reffile):
    clustalw_exe = r"C:\Users\josep\Anaconda3\Lib\site-packages\Bio\Align\Applications\_Clustalw.py"
    assert os.path.isfile(clustalw_exe), "Clustal W executable missing"
    cline=ClustalwCommandline(clustalw_exe, infile=reffile+".fasta", type="PROTEIN", output="FASTA", outfile=reffile+"_aligned.fasta", quiet=True)
    cline()

score_align("balibase/RV11.unaligned/BBS11001")

I have tried using the python subprocess to run to get an error message this way:

def score_align(reffile):
    clustalw_exe = r"C:\Users\josep\Anaconda3\Lib\site-packages\Bio\Align\Applications\_Clustalw.py"
    assert os.path.isfile(clustalw_exe), "Clustal W executable missing"
    child = subprocess.call(str(clustalw_exe)+" -align -infile="+reffile_name+".fasta -seqnos ON -type protein", shell=True)
    print(child)

score_align("balibase/RV11.unaligned/BBS11001")

this returned 0 (from what I gathered it means the execution went well and I should have a .aln file.

Thank you for your help.

clustalw alignment • 566 views
ADD COMMENTlink modified 13 months ago by Biostar ♦♦ 20 • written 14 months ago by josephine.yates0

Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
code_formatting

Thank you!

ADD REPLYlink written 14 months ago by genomax83k

I'm sorry, it's my first post I didn't know it wouldn't format it. Thank you for doing it this time !

ADD REPLYlink written 14 months ago by josephine.yates0

No worries.

clustalw_exe = r"C:\Users\josep\Anaconda3\Lib\site-packages\Bio\Align\Applications\_Clustalw.py"

Based on the slashes looks like you are using Windows? If so you are not pointing to the actual clustalw executable/program. It should be something like clustalw.exe.

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

I am having the same problem... did you solve it ?

ADD REPLYlink written 13 months ago by carla.boudargham0
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: 1138 users visited in the last hour