MafftCommandline error, doesn't recognize mafft as an internal or external command
0
0
Entering edit mode
8.4 years ago
erikras1223 ▴ 10

Hello I am new to python and biopython, but I thought I had the code just about right but I am getting this error File "C:\Python27\lib\site-packages\Bio\Application\__init__.py", line 517, in __call__stdout_str, stderr_str) Bio.Application.ApplicationError: Non-zero return code 1 from 'mafft NA.fa', message "'mafft' is not recognized as an internal or external command

The line it crashes at is stdout,stderr = mafft_cline(), I don't really understand what it means by "mafft" is not recognized as an internal or external command, but I just want to do an alignment on the file NA.fa. I would very grateful for some help on why it get this exceptions.

The file looks like this:

>NA
MNPNQKIITIGSVCMTIGMANLILQIGNIISIWISHSIQLGNQNQIETCNQSVITYENNTWVNQTYVNISNTNFAAGQSVVPVKLAGNSSLCPVSGWAIYSKDNSIRIGSKGDVFVIREPFISCSPLECRTFFLTQGALLNDKHSNGTIKDRSPYRTLMSCPIGEVPSPYNSRFESVAWSASACHDGINWLTIGISGPDNGAVAVLKYNGIITDTIKSWRNNILRTQESECACVNGSCFTVMTDGPSDGQASYKIFRIEKGKIVKSVEMNAPNYHYEECSCYPDSSEITCVCRDNWHGSNRPWVSFNQNLEYQIGYICSGIFGDNPRPNDKTGSCGPVSSNGANGVKGFSFKYGNGVWIGRTKSISSRNGFEMIWDPNGWTGTDNNFSIKQDIVGINEWSGYSGSFVQHPELTGLDCIRPCFWVELIRGRPKENTIWTSGSSISFCGVNSGTVGWSWPDGAELPFTIDK
>NA
MNPNQKIITIGSVCMTIGMANLILQIGNIISIWISHSIQLGNQNQIETCNQSVITYENNTWVNQTYVNISNTNFAAGQSMVSVKLTGNSSLCPVSGWAIYSKDNSVRIGSKGDVFVIREPFISCSPLECRTFFLTQGALLNDKHSNGTIKDRSPYRTLMSCPIGEVPSPYNSRFESVAWSASACHDGINWLTIGISGPDNGAVAVLKYNGIITDTIKSWRNNILRTQESECACVNGSCFTVMTDGPSNGQASYKIFRIEKGKIVKSVEMNAPNYHYEECSCYPDSSEITCVCRDNWHGSNRPWVSFNQNLEYQIGYICSGIFGDNPRPNDKTGSCGPVSSNGANGVKGFSFKYGNGVWIGRTKSISSRNGFEMIWDPNGWTGTDNNFSIKQDIVGINEWSGYSGSFVQHPELTGLDCIRPCFWVELIRGRPKENTIWTSGSSISFCGVNSDTVGWSWPDGAELPFTIDK
>NA
MNPNQKIITIGSVCITIGMANLILQIGNIISIWVSHSIQIGNQSQIETCNQSVITYENNTWVNQTYVNISNTNFAAGQSVVSVKLAGNSSLCPVSGWAIYSKDNSVRIGSKGDVFVIREPFISCSPLECRTFFLTQGALLNDKHSNGTIKDRSPYRTLMSCPIGEVPSPYNSRFESVAWSASACHDGINWLTIGISGPDSGAVAVLKYNGIITDTIKSWRNNILRTQESECACVNGSCFTIMTDGPSDGQASYKIFRIEKGKIVKSVEMNAPNYHYEECSCYPDSSEITCVCRDNWHGSNRPWVSFNQNLEYQIGYICSGVFGDNPRPNDKTGSCGPVSSNGANGVKGFSFKYGNGVWIGRTKSISSRKGFEMIWDPNGWTGTDNKFSIKQDVVGINEWSGYSGSFVQHPELTGLDCIRPCFWVELIRGRPEENTIWTSGSSISFCGVNSDTVGWSWPDGAELPFTIDK

The code looks like this:

from Bio.Align.Applications import MafftCommandline

for filename in glob("*.fa"):
    with open(filename) as f:
        output = str(filename)
        output += "-aligned.fa"
        in_file = str(filename)
        mafft_cline = MafftCommandline(input= in_file)
        print mafft_cline

        stdout, stderr = mafft_cline()
        with open(output, "-w") as handle:
            handle.write(stdout)
mafft error alignment • 5.1k views
ADD COMMENT
1
Entering edit mode

Do you have MAFFT installed?

ADD REPLY
0
Entering edit mode

Ok so i've now download MAFFT ran cygwin to extract it, I am just having a mental gap on how to use the MafftCommandLine recognize that mafft is installed. I know I will have to give it a path but I used cygwin to extract the tar file of mafft and it seems to of installed it in some location I can't find it gives me like a psuedo path if that makes any sense

ADD REPLY
0
Entering edit mode

Did you compile MAFFT, or just extracted it?

ADD REPLY
0
Entering edit mode

I downloaded this file mafft-7.266-mingwxx.tar and through cygwin used this command tar xfv mafft-7.266-mingwxx.tar -C /. So just extracted I am not sure how to compile it. From that point I could run mafft through cygwins shell but not through my python script. I was under the impression that if installed bioPython and its dependencies it would have the applications like mafft, already compiled. Is that not correct?

ADD REPLY
0
Entering edit mode

No, it is a bit more complex than that, you probably have to set up the PATH environment variable. You have a problem, in which very few people is using Cygwin to work with bioinformatics, so few people will be able to help - most people use linux or macosx.

Anyway, it seems you have some reading to do, you could start here.

ADD REPLY

Login before adding your answer.

Traffic: 3101 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