Question: Musclecommandline Not Writing File
0
gravatar for Jabovl
8.1 years ago by
Jabovl50
Jabovl50 wrote:

I'm trying to work through the Biopython tutorial on multiple sequence alignment and get an error whenever I try to use subprocess:

child = subprocess.Popen(str(cline),
         stdout = subprocess.PIPE,
         stderr = subprocess.PIPE,
         shell = (sys.platform!="win32"))

I get this error:

    Traceback (most recent call last):
  File "<pyshell#36>", line 2, in <module>
    stdout = subprocess.PIPE)
  File "C:\Python27\lib\subprocess.py", line 672, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 882, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

I've gone so far as to copy and paste the tutorial into the interpreter and no luck. Neither ClustalW nor Muscle are writing the alignment files (I tried the depreciated MultipleAlignCL as well with no luck).

I'm using Python v2.7 and Biopython v1.55 and have tried reinstalling both. Any advice?

alignment biopython • 2.6k views
ADD COMMENTlink modified 8.1 years ago • written 8.1 years ago by Jabovl50

What system are you using?

ADD REPLYlink written 8.1 years ago by Thaman3.2k

Can you put code you have written above child=subprocess.Popen(str(cline)

ADD REPLYlink written 8.1 years ago by Thaman3.2k

subprocess is not a BioPython library. Which tutorial are you following?

ADD REPLYlink written 8.1 years ago by Giovanni M Dall'Olio26k
2
gravatar for Brad Chapman
8.1 years ago by
Brad Chapman9.4k
Boston, MA
Brad Chapman9.4k wrote:

subprocess is giving you a generic error message that it can't find the executables you want to run. Do you have ClustaW and Muscle installed on your Windows machine? Are they directly callable from the commandline?

The best way to test this is to add:

print str(cline)

to your Python code, and then try to run the commandline that is printed from a terminal. What errors does this give?

Feel free to edit your initial question with this additional information.

ADD COMMENTlink written 8.1 years ago by Brad Chapman9.4k
1
gravatar for Thaman
8.1 years ago by
Thaman3.2k
Finland
Thaman3.2k wrote:

You are using Windows so my guess is that MUSCLE.exe is not in system PATH. So what I suggest you define first MUSCLE command line wrapper in the system PATH. How? Link. Under Windows either you have to give complete PATH or set PATH. I think setting PATH will ease your problem. Else everything must work fine.

import sys,os, subprocess
from Bio import AlignIO
from Bio.Align.Applications import MuscleCommandline
out_file = "opuntia.aln"
cline = MuscleCommandline(input="opuntia.fasta", out=out_file)
child= subprocess.Popen(str(cline),
                         stdout = subprocess.PIPE,
                         stderr=subprocess.PIPE,
                        shell=(sys.platform!="win32"))

Or you can test directly from Windows command prompt to validate whether MUSCLE is working by:

C:\MyPrograms\Muscle\muscle.exe -in opuntia.fa -out opuntia.aln

Further Suggestion, put

C:Python27lib; C:Python27; C:Python27Scripts

too in the System Variable PATH.

Hope this helps, if not comment further so I can again edit my answer precisely

ADD COMMENTlink modified 8.1 years ago • written 8.1 years ago by Thaman3.2k
0
gravatar for Jabovl
8.1 years ago by
Jabovl50
Jabovl50 wrote:

Wow, it wasn't installed. How embarrassing. It's working now, thanks!

ADD COMMENTlink written 8.1 years ago by Jabovl50
1

Also on recent Biopython you can just do child() rather than calling subprocess yourself.

ADD REPLYlink written 8.1 years ago by Peter5.8k
1

Thank you for explaining us the solution to your problem. However, you should use the 'Mark this answer as the correct one' function instead of writing an answer as you did here.

ADD REPLYlink written 8.1 years ago by Giovanni M Dall'Olio26k
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: 1614 users visited in the last hour