Question: Pariwise Local And Global Alignment
gravatar for Thaman
7.3 years ago by
Thaman3.2k 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 • 4.0k views
ADD COMMENTlink modified 7.3 years ago by Simon Cockell7.2k • written 7.3 years ago by Thaman3.2k
gravatar for Simon Cockell
7.3 years ago by
Simon Cockell7.2k
Simon Cockell7.2k 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 7.3 years ago by Simon Cockell7.2k
gravatar for Pierre Lindenbaum
7.3 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum96k wrote:

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

ADD COMMENTlink written 7.3 years ago by Pierre Lindenbaum96k
gravatar for Neilfws
7.3 years ago by
Sydney, Australia
Neilfws47k 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 7.3 years ago by Neilfws47k
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: 1366 users visited in the last hour