Musclecommandline Not Writing File
2
0
Entering edit mode
13.9 years ago
Jabovl ▴ 50

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?

biopython alignment • 5.2k views
ADD COMMENT
0
Entering edit mode

What system are you using?

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode

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

ADD REPLY
1
Entering edit mode

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 REPLY
0
Entering edit mode

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

ADD REPLY
2
Entering edit mode
13.9 years ago

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

The best way to test this is to add:

print str(cline)

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

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

ADD COMMENT
1
Entering edit mode
13.9 years ago
Thaman ★ 3.3k

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? 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 COMMENT

Login before adding your answer.

Traffic: 1447 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6