[Biopython] How does pairwise2 alignement returns begin on first matching amino acid?

Ebert Maximilian m.ebert at umontreal.ca
Tue Feb 2 21:11:33 UTC 2016


Hi there,
I aligned two sequences using the following:

from Bio import pairwise2
from Bio.pairwise2 import format_alignment
from Bio.SubsMat import MatrixInfo as matlist

seq1="SKFQQVEQDVKAIEVSLSARIGVSVLDTQNGEYWDYNGNQRFPLTSTFKTIACAKLLYDAEQGKVNPNST"
seq2="HPETLVKVKDAEDQLGARVGYIELDLNSGKILESFRPEERFPLTSTFKVLLCGAVLSRVDAGQEQLGRRI"
matrix = matlist.blosum62
gap_open = -11
gap_extend = -1
alns = pairwise2.align.localds(seq1, seq2, matrix, gap_open, gap_extend)
for a in alns:
print(format_alignment(*a))
So the result is (hard to see in text mode here is a link to biostars forum entry https://www.biostars.org/p/175229/):

SKFQQVEQDVKAIEVSLSARIGVSVLDTQNGEYWD-YNGNQRFPLTSTFKTIACAKLLYDAEQGKVNPNST-
        ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--HPETLVKVKDAEDQLGARVGYIELDLNSGKILESFRPEERFPLTSTFKVLLCGAVLSRVDAGQEQLGRRI
 Score=98
And hence the begin is 9 but I want the beginning to be 2. Also for the end I want it to be the T/R combination and not K/Q. Any idea how to do this?

Thanks!



More information about the Biopython mailing list