Question: Pariwise Local And Global Alignment
gravatar for Thaman
5.5 years ago by
Thaman3.0k wrote:


I like to build python script which can take fasta file and can run either pairwise local or global alignment of all sequences in a fasta file and completing by printing scores in the tables.

I read Bio.pairwise2 but couldn't find in detail how to intake fasta file and moreover pairwise2 seems to be slow alignment module. Is there any alternative beside pariwise2 if not then what are my options?

pairwise local alignment • 2.8k views
ADD COMMENTlink modified 5.5 years ago by Simon Cockell6.8k • written 5.5 years ago by Thaman3.0k
gravatar for Simon Cockell
5.5 years ago by
Simon Cockell6.8k
Simon Cockell6.8k wrote:

As Neil notes, the EMBOSS package provides the functionality you are after, and BioPython has decent wrappers for constructing command line calls:

From the BioPython docs:

>>> from Bio.Emboss.Applications import WaterCommandline
>>> cline = WaterCommandline(gapopen=10, gapextend=0.5)
>>> cline.asequence = "asis:ACCCGGGCGCGGT"
>>> cline.bsequence = "asis:ACCCGAGCGCGGT"
>>> cline.outfile = "temp_water.txt"
>>> print cline
water -outfile=temp_water.txt -asequence=asis:ACCCGGGCGCGGT -bsequence=asis:ACCCGAGCGCGGT -gapopen=10 -gapextend=0.5
>>> cline
WaterCommandline(cmd='water', outfile='temp_water.txt', asequence='asis:ACCCGGGCGCGGT', bsequence='asis:ACCCGAGCGCGGT', gapopen=10, gapextend=0.5)

You would typically run the command line via a standard Python operating system call (e.g. using the subprocess module).

ADD COMMENTlink written 5.5 years ago by Simon Cockell6.8k
gravatar for Pierre Lindenbaum
5.5 years ago by
Pierre Lindenbaum77k wrote:

The entry about the Needleman-Wunsch algorithm in wikipedia contains a nice pseudocode that should be easy to implement.

ADD COMMENTlink written 5.5 years ago by Pierre Lindenbaum77k
gravatar for Neilfws
5.5 years ago by
Sydney, Australia
Neilfws45k wrote:

The EMBOSS package implements global alignment (stretcher, needle) and local alignment (matcher, supermatcher, water). I believe that Biopython has a Bio.Emboss module to interact with EMBOSS. Otherwise, it should not be too difficult to call the programs from python and parse the output.

ADD COMMENTlink written 5.5 years ago by Neilfws45k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1535 users visited in the last hour