[Biopython-dev] [Biopython] Pairwise alignment - is it a generic function?

Eric Talevich eric.talevich at gmail.com
Wed Oct 26 13:27:17 UTC 2011


On Wed, Oct 26, 2011 at 7:11 AM, Peter Cock <p.j.a.cock at googlemail.com>wrote:

> On Wed, Oct 26, 2011 at 12:02 PM, João Rodrigues <anaryin at gmail.com>
> wrote:
> > Hey Peter,
> > Thanks for the answer. How do I pass the matrix and which format should
> it
> > be on? Is there an example I could read?
> > João [...] Rodrigues
> > http://nmr.chem.uu.nl/~joao
>
> Not that I know of, but adding one to the docstrings and test_pairwise2.py
> would be great. I think you use it with a score matrix as a dictionary from
> Bio.SubsMat.MatrixInfo
>
> Peter
>
>
Here's an example:

from Bio import pairwise2, SeqIO
from Bio.SubsMat.MatrixInfo import blosum62

# pairwise2 works with raw strings, not SeqRecords
seq1 = str(SeqIO.read("seq1.fa", "fasta"))
seq2 = str(SeqIO.read("seq2.fa", "fasta"))

results = pairwise2.align.globalds(seq1, seq2, blosum62, -10, -0.5)
# Returns a tuple: (seqA, seqB, score, begin, end)
return results[0][2]




More information about the Biopython-dev mailing list