Question: alignment using needleman wunsch in biopython
0
gravatar for sumithrasank75
2.8 years ago by
United States
sumithrasank7580 wrote:

I want to align two sequnces in bipython using needleman wunsch algorithm

file1.faa:

>seq_1
gagtcccagctgtgcctgactaaccgtgtttctcttgtatctaggagtgctcccaccccagcccgttgctgcccagctgtttaattgagttgtcatatgttaataacggtatattggaacactgtataacaccaacacactcgagtctttcaagactgcagataagaagctccttttggaacaagcagcaaatgaggttagctg

file2.faa:

>seq_2

GAGTCCCAGCTGTGCCTGACTAACCGTGTTTCTCTTGTATCTAGGAGTGCTCCCACCCCAGCCCGTTGCTGCCCAGCTGTTTAATTGAGTTGTCATATGTTAATAACGGTATTGGAACACTGTATAACACCAACACACTCGAGTCTTTCAAGACTGCAGATAAGAAGCTCCTTTTGGAACAAGCAGCAAATGAGGTTAGCTGAGATCGGAAGAGCACACGTCTGAACTCCAGTCACTAGCGTTCTCATCT

 

I have tried 

>>from Bio.Emboss.Applications import NeedleCommandline

>>> from Bio import AlignIO

>>> needle_cline = NeedleCommandline(asequence="file1.faa", bsequence="file2.faa",gapopen=10, gapextend=0.5, outfile="needle.txt")

But the output file needle.txt does not get written. Can you help?

 

alignment • 1.6k views
ADD COMMENTlink modified 2.8 years ago by utzermel120 • written 2.8 years ago by sumithrasank7580
1
gravatar for utzermel
2.8 years ago by
utzermel120
Germany
utzermel120 wrote:

It seems you only created the wrapper object for the function call. Assuming you have the EMBOSS toolkit installed, this means you still have to call the actual function to make Biopython execute the command. So after creating the wrapper object like this:

>>> needle_cline = NeedleCommandline(asequence="file1.faa", bsequence="file2.faa",gapopen=10, gapextend=0.5, outfile="needle.txt")

you need to actually execute the function like this:

>>> stdout, stderr = needle_cline()

This will create the output file and save any output of the command to the stderr and stdout streams to the respective variables.

ADD COMMENTlink modified 2.8 years ago • written 2.8 years ago by utzermel120

I did the above but I get an error 

Bio.Application.ApplicationError: Non-zero return code 127 from 'needle -outfile=needle.txt -asequence=file1.faa -bsequence=file2.faa -gapopen=10 -gapextend=0.5', message '/bin/sh: needle: command not found'

I have installed emboss, so I guess it is a path problem. Can you suggest a fix?

ADD REPLYlink written 2.8 years ago by sumithrasank7580

If you are using a Linux operating system, you can append the EMBOSS executables to your path by creating a file entitled EMBOSS.sh (name doesn't matter, but it has to be .sh) in 

/etc/profile.d/

Make the contents of the file the following:

PATH=$PATH:/path/to/your/EMBOSS/executables
export PATH

Then save the file and restart the terminal you are using python from. For other operating systems I unfortunately don't know how to append things to the PATH, but is should be easy to find out by a simple google search.

ADD REPLYlink written 2.8 years ago by utzermel120
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: 705 users visited in the last hour